Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp818151rwd; Tue, 16 May 2023 08:05:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ZXOVOg82MEPP3FMFTHTb2rkkKK2btyVpbin9HujbrFgRqqSfvGunaAQmtZccrRLmD8M2m X-Received: by 2002:a9d:77cf:0:b0:68f:2134:9a3a with SMTP id w15-20020a9d77cf000000b0068f21349a3amr12215610otl.30.1684249544151; Tue, 16 May 2023 08:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684249544; cv=none; d=google.com; s=arc-20160816; b=Azsm3t/MTnQUiH+TcTKsu9SNk8VFheTmxcvQcxmTdks+dutiPn/iOF5g4x0cMb6x4o fGafEmMntXIJPa81uM/2cgEuNMhCalrBIITjiH+D/U0hOsDbj6mACfN2rmCv5+abCe/l Z7PAjTJl8FPBnw5jo5voQs36FvBGWjk5BZyCVBH/InOtOSQQ1rK/nWWxc7WCCVj2yI3o 10t4aCFoISebuMmKUc7k2GRor7iY9/TJska1ew3lC/DmiXVPRrFGOLcwra0An6+FU5OR kkpFs18BR/7zu4WUU6Z9NOMXsSqQl4mJsia7Xq8IeCY+9hlfNdB0bsJ3UXwUI1KP717j dDAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=4YEPKrVR9zT024XK7Pjo91EG5vcxIVFCJtB9CTxRlDM=; b=Fipl56RUrhr98KB1J+czwiTTvHNZMEmW2SB8Ud6FIb+G3hss84IAL+7Uth+fYvCEt1 KTY6j3LFQ6BrwyZH9V5mNqc5cW5uTs/yn7jxV/F2YXLBp9d+jL1+yhRWiYELiSvdNiLj TClXeAsPiG9mtPTM8KP0Rhj0DumPDY44w9xxcsS5pa7QqTl+kWPbKjPG7ERSE7c8jB6n hxno9mSAj88KiS6EZQxYD3A8kCadoDT5rA+9oMIwhIvNEXSj/tJlKPzKan55J8+6FbHY /1+s8GGS0GSx3H1aq3GP+p0xEbIO7qf/L3sKMov1HwpXiP5lt6FqwT0QXJmxNIcuS7P7 lR8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=hqHcxjQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ci12-20020a05683063cc00b006ab274c6f8fsi10907849otb.107.2023.05.16.08.05.25; Tue, 16 May 2023 08:05:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=hqHcxjQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233915AbjEPOaH (ORCPT + 99 others); Tue, 16 May 2023 10:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233791AbjEPOaE (ORCPT ); Tue, 16 May 2023 10:30:04 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD2971BC6 for ; Tue, 16 May 2023 07:30:03 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-559c416b024so154250517b3.1 for ; Tue, 16 May 2023 07:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684247403; x=1686839403; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=4YEPKrVR9zT024XK7Pjo91EG5vcxIVFCJtB9CTxRlDM=; b=hqHcxjQbJBGZla48WsupFSE1qX/Q50O/tDR9HRispcTqhozzhNaDapI1iUI+nV5Dqa +1YztNS7sMj7wiHDm0+uAOJXhAOMuPVrU6pHbFstZqhwb/IN4HRrOjpIO8eadjPxWAiv 74ZKC4fPNkL7uHLKcrORbKVAL6lyxZVoThJRc2570yDONMDvXbttp+1WyG/KPEVI0Mbj /NITT/iX9eusiaFbGu44753OhtSEHfnh4iDWqcOdXFdq/GRuHbEd3f6wqf1Ezyk3tHWu lGLELXUKPIoHXEUyM1vl7ctdC6KLkFsE4Fe4uGvSVPO5JyNR6ut5eE1mOnGUTpwSdULf SuMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684247403; x=1686839403; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4YEPKrVR9zT024XK7Pjo91EG5vcxIVFCJtB9CTxRlDM=; b=ACXzIR7fq9uUKAmKhS1b1P75TJOU242ytLMw0G7K1mrqmGB9TeyRFQA0fddqbmH6wz QhbtEynmYWoVhMk7mwe8SFRtq43HgR02kSjUFzsKXO42kTYBtYSLD3htJ4a3lLRIL+91 pSaY8nTnGg7eAIqEysrmmLNxo/wxOgXfCMBHPR9823rVIoSEIYyKEvmwHWStiTcxTjd+ TmgIv4gCqIze8bqWWx0+EeUuD3uJdU/ksJAw+sAVSqn3es36kPP6xpv99VsFZfoIeRzF dHxUbiNEFmd4S1jKwPZn5tHsYoV4dBSo55sZUP2pv/Kt4qkmDj5pF2Lx8G2HnOuRB0AS C4Gw== X-Gm-Message-State: AC+VfDy4j2HNvn6UqbzDA0X7+pzifra3jWTwBbWzcafAuS+jHxgOQwxR 1FRtmAduQSkbFXvAAjJpHwcjAGlJjuo= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:c903:0:b0:556:cacc:1f1d with SMTP id o3-20020a81c903000000b00556cacc1f1dmr22415308ywi.8.1684247402987; Tue, 16 May 2023 07:30:02 -0700 (PDT) Date: Tue, 16 May 2023 07:30:01 -0700 In-Reply-To: Mime-Version: 1.0 References: Message-ID: Subject: Re: [PATCH v5 1/6] mm/gup: remove unused vmas parameter from get_user_pages() From: Sean Christopherson To: David Hildenbrand Cc: Lorenzo Stoakes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Matthew Wilcox , x86@kernel.org, linux-sgx@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kvm@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Jarkko Sakkinen , "H . Peter Anvin" , Xinhui Pan , David Airlie , Daniel Vetter , Dimitri Sivanich , Arnd Bergmann , Greg Kroah-Hartman , Paolo Bonzini , Jens Axboe , Pavel Begunkov , Jason Gunthorpe , John Hubbard , Christian Konig , Jason Gunthorpe Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 16, 2023, David Hildenbrand wrote: > On 15.05.23 21:07, Sean Christopherson wrote: > > On Sun, May 14, 2023, Lorenzo Stoakes wrote: > > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > > > index cb5c13eee193..eaa5bb8dbadc 100644 > > > --- a/virt/kvm/kvm_main.c > > > +++ b/virt/kvm/kvm_main.c > > > @@ -2477,7 +2477,7 @@ static inline int check_user_page_hwpoison(unsigned long addr) > > > { > > > int rc, flags = FOLL_HWPOISON | FOLL_WRITE; > > > - rc = get_user_pages(addr, 1, flags, NULL, NULL); > > > + rc = get_user_pages(addr, 1, flags, NULL); > > > return rc == -EHWPOISON; > > > > Unrelated to this patch, I think there's a pre-existing bug here. If gup() returns > > a valid page, KVM will leak the refcount and unintentionally pin the page. That's > > When passing NULL as "pages" to get_user_pages(), __get_user_pages_locked() > won't set FOLL_GET. As FOLL_PIN is also not set, we won't be messing with > the mapcount of the page. Ah, that's what I'm missing. > So even if get_user_pages() returns "1", we should be fine. > > > Or am I misunderstanding your concern? Nope, you covered everything. I do think we can drop the extra gup() though, AFAICT it's 100% redundant. But it's not a bug. Thanks!