Message ID | 1666289686-22798-1-git-send-email-ssengar@linux.microsoft.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp261893wrr; Thu, 20 Oct 2022 11:30:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6uasPGo9oPF3R25q4N4EN4lzuvwx82baCkrF3XvFgZAzNAFYOi9riBNHh/TFAQ211nOnPQ X-Received: by 2002:a17:90b:2705:b0:20a:b25d:5d93 with SMTP id px5-20020a17090b270500b0020ab25d5d93mr53183099pjb.218.1666290626666; Thu, 20 Oct 2022 11:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666290626; cv=none; d=google.com; s=arc-20160816; b=Vrh5R/SuWH/oVYXRJAPIgZSxvertaLaFmlIhUH2KdM90az0zRRxSwm2dh+4RoMECkG AKw8x7zZGGwqMNmpxR/9SPXSguuqT1b5f9KyKr9C30k3ZfUBbOgRQqLX6V7pVykJLOJ+ kwyyGskwMcatTgAn1nAvLy6q2dZnShk9+GL+JHBPG4jNLC2IE8ytG0SAzy13/t3Zzj3J HPo9JL8WXEe+ad2kjU0VE6jlmxipThgglZDkl98Tcv59dxRegjJ34E+HrLHgl0+RyoPr aUDsRqaby7FrXNDNhl5F6sSQYqRNFhrLreSMC/hkI3/aUGKOZNOhgicv2TaDyhL6yS2j 4haQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from:dkim-signature :dkim-filter; bh=ur8sScAym4ijq/4v4hHXNXCn8sXMfCruhdPnVBD9Zds=; b=jM93lIRAgbRHoYrTshCk3Jm4sJKlnbZTnpW5Ux9eJ3xJ+8IHcausbQoiP8ZpBYWoWC 2HBiyeQ3mbRcyF3XNj+1Tco1FdDlxFAWw5NsOS4JlmLOMjSUWE/S2iUkdNFy/lOttHd7 7n7f6gsMJDH4xvdPN7SirSC+ABoBuXFdiJpumKUBZF6FdI67tZIUNqoGFKHUZ45Wi/LC x5JNQTtqHMypBTOalZ6wfeORJweEPslDBFTmtDASbkVKxiyCxOTAJjM+HuN7L+Ofa61E VaRz6K2nQSpNxBS1JBSfsLdx743T9WR0ZSdUNm7vXf2qeZWSSbGKz9CizpF0EmSK1tGt fi4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=aGdm5Sd5; 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=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a170903244b00b001780ba6c694si25099663pls.35.2022.10.20.11.30.11; Thu, 20 Oct 2022 11:30:26 -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=@linux.microsoft.com header.s=default header.b=aGdm5Sd5; 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=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229931AbiJTSO5 (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Thu, 20 Oct 2022 14:14:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbiJTSOy (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 20 Oct 2022 14:14:54 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A55D63DBCC for <linux-kernel@vger.kernel.org>; Thu, 20 Oct 2022 11:14:51 -0700 (PDT) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 50BB420477CE; Thu, 20 Oct 2022 11:14:50 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 50BB420477CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1666289690; bh=ur8sScAym4ijq/4v4hHXNXCn8sXMfCruhdPnVBD9Zds=; h=From:To:Subject:Date:From; b=aGdm5Sd5dRnM54VEat6X0IA6HURGs2w6iDFe1M5AjRDo+qOYJGIkBoAjhec+7pOXf Su/Ht7+8b0sj4sMAL4q3aqMM6Msd6gKq6Mz0zVOnpT3LvVRocGTUciRTrT43/edgu5 EV+LQBrQHqwS5Ru4noDwXZxPph2C39m+VXqFTBwc= From: Saurabh Sengar <ssengar@linux.microsoft.com> To: ssengar@microsoft.com, akpm@linux-foundation.org, yuzhao@google.com, jack@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org, jostarks@microsoft.com Subject: [PATCH] mm/gup: fix gup_pud_range() for dax Date: Thu, 20 Oct 2022 11:14:46 -0700 Message-Id: <1666289686-22798-1-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747232360343863953?= X-GMAIL-MSGID: =?utf-8?q?1747232360343863953?= |
Series |
mm/gup: fix gup_pud_range() for dax
|
|
Commit Message
Saurabh Singh Sengar
Oct. 20, 2022, 6:14 p.m. UTC
From: John Starks <jostarks@microsoft.com> For dax pud, pud_huge() returns true on x86. So the function works as long as hugetlb is configured. However, dax doesn't depend on hugetlb. Commit 414fd080d125 ("mm/gup: fix gup_pmd_range() for dax") fixed devmap-backed huge PMDs, but missed devmap-backed huge PUDs. Fix this as well. Fixes: 414fd080d125 ("mm/gup: fix gup_pmd_range() for dax") Signed-off-by: John Starks <jostarks@microsoft.com> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com> --- mm/gup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, Oct 20, 2022 at 12:14 PM Saurabh Sengar <ssengar@linux.microsoft.com> wrote: > > From: John Starks <jostarks@microsoft.com> > > For dax pud, pud_huge() returns true on x86. So the function works as long > as hugetlb is configured. However, dax doesn't depend on hugetlb. > Commit 414fd080d125 ("mm/gup: fix gup_pmd_range() for dax") fixed > devmap-backed huge PMDs, but missed devmap-backed huge PUDs. Fix this as > well. > > Fixes: 414fd080d125 ("mm/gup: fix gup_pmd_range() for dax") > Signed-off-by: John Starks <jostarks@microsoft.com> > Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com> > --- > mm/gup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/gup.c b/mm/gup.c > index 05068d3d2557..9e07aa54a4cd 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -2687,7 +2687,7 @@ static int gup_pud_range(p4d_t *p4dp, p4d_t p4d, unsigned long addr, unsigned lo > next = pud_addr_end(addr, end); > if (unlikely(!pud_present(pud))) > return 0; > - if (unlikely(pud_huge(pud))) { > + if (unlikely(pud_huge(pud) || pud_devmap(pud))) { Perhaps s/pud_huge/pud_leaf/ ? > if (!gup_huge_pud(pud, pudp, addr, next, flags, > pages, nr)) > return 0; > -- > 2.25.1 >
On Thu, Oct 20, 2022 at 04:18:37PM -0600, Yu Zhao wrote: > On Thu, Oct 20, 2022 at 12:14 PM Saurabh Sengar > <ssengar@linux.microsoft.com> wrote: > > > > From: John Starks <jostarks@microsoft.com> > > > > For dax pud, pud_huge() returns true on x86. So the function works as long > > as hugetlb is configured. However, dax doesn't depend on hugetlb. > > Commit 414fd080d125 ("mm/gup: fix gup_pmd_range() for dax") fixed > > devmap-backed huge PMDs, but missed devmap-backed huge PUDs. Fix this as > > well. > > > > Fixes: 414fd080d125 ("mm/gup: fix gup_pmd_range() for dax") > > Signed-off-by: John Starks <jostarks@microsoft.com> > > Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com> > > --- > > mm/gup.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/mm/gup.c b/mm/gup.c > > index 05068d3d2557..9e07aa54a4cd 100644 > > --- a/mm/gup.c > > +++ b/mm/gup.c > > @@ -2687,7 +2687,7 @@ static int gup_pud_range(p4d_t *p4dp, p4d_t p4d, unsigned long addr, unsigned lo > > next = pud_addr_end(addr, end); > > if (unlikely(!pud_present(pud))) > > return 0; > > - if (unlikely(pud_huge(pud))) { > > + if (unlikely(pud_huge(pud) || pud_devmap(pud))) { > > Perhaps s/pud_huge/pud_leaf/ ? Looks good to me but I am not sure the wider impact of this, I will let maintainers comment on it. Meanwhile I will send a V2 with more description of panic observed. > > > if (!gup_huge_pud(pud, pudp, addr, next, flags, > > pages, nr)) > > return 0; > > -- > > 2.25.1 > >
diff --git a/mm/gup.c b/mm/gup.c index 05068d3d2557..9e07aa54a4cd 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2687,7 +2687,7 @@ static int gup_pud_range(p4d_t *p4dp, p4d_t p4d, unsigned long addr, unsigned lo next = pud_addr_end(addr, end); if (unlikely(!pud_present(pud))) return 0; - if (unlikely(pud_huge(pud))) { + if (unlikely(pud_huge(pud) || pud_devmap(pud))) { if (!gup_huge_pud(pud, pudp, addr, next, flags, pages, nr)) return 0;