Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp336667rwb; Tue, 6 Dec 2022 22:13:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf58OkpaHtHzHrTksc4jcXHyBuU97eVBs+BhZ5QIDDt2XfoQanwIeG0yRRGXF3lkohYX2SJI X-Received: by 2002:aa7:8b56:0:b0:56c:6f8:fe14 with SMTP id i22-20020aa78b56000000b0056c06f8fe14mr93415504pfd.75.1670393613371; Tue, 06 Dec 2022 22:13:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670393613; cv=none; d=google.com; s=arc-20160816; b=gY92kfSJluGQlOouAiJ+xK3jOZOYHiW2K9KtnoJvQkmgzKY2GLYn7idU/8nPEw5tdn mBZFSnP+fW9tw6hj+m2nmihaj6k9NF4ZvGmtPVkwb6x201c+Sngu2D+1n9OD1GBTZf0M dSyZp/ml9+pOStCBPLZFd6Qw6bE3rwTKLpLhIDi4hrLf7l4Nj1Bqi0/o/poD8sb9YVC8 JWrjmip8VTrOrkKQbST3yBkHi/lVdCUYJFNJ2gXcaW/6IeuMB1e36j6C7OvXsLXBhkj3 idKWEIcZn4ydfYbP/7eZ4xYL3Tbmwm/HUCThNTRW5GgvTnvKEGha99jkKf82vL8ay0/x MIMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=6L4SN9sqeQg1kBVQ7Wv7J5PUz/9QBV2D4TUzw2VzCtU=; b=UgtVIRArojaSyxi0zdEnkH02DKQu4UFtIx6yoz9itZ1fSFCslp53bpah0aZ3dAA8Mq cLueE8sol/ceOOZDJYUdfmtlSjt1bFsV+k7dDrLRHm8XVNkuIR+bMAkwkL9fHCFUaubp WIfaLyZFmzuskWZViS2qqO0F1rLGvCT5k+ad/acxJwPaIupupLiowk90PTbD/DPz6hg2 1Xfaw9UBeHCIRVzy1DZYAEbps4KYE0+GIVJxvamQruDqK4cYYJXvw+1CBzcdzgdFKoE2 xVBgyotmg4ztxKMFLs8XgMczmzxNmu20N/0FKE+s5Epbh6YEVw/My0qHNV61L418sr3o F//w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b="frEcGb/h"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 6-20020a170902c14600b00176c891c8a0si6222224plj.6.2022.12.06.22.13.23; Tue, 06 Dec 2022 22:13:33 -0800 (PST) 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="frEcGb/h"; 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 S229621AbiLGFkW (ORCPT + 76 others); Wed, 7 Dec 2022 00:40:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiLGFkT (ORCPT ); Wed, 7 Dec 2022 00:40:19 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 26E0058012 for ; Tue, 6 Dec 2022 21:40:19 -0800 (PST) Received: by linux.microsoft.com (Postfix, from userid 1127) id DA10120B6C40; Tue, 6 Dec 2022 21:40:18 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DA10120B6C40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1670391618; bh=6L4SN9sqeQg1kBVQ7Wv7J5PUz/9QBV2D4TUzw2VzCtU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=frEcGb/ho4Fik9QbOkU4s6Ff87yjSFaJvaZWwT+7mcSYuuCMWl0Gsh6No4zfEQclu +zXfHizeVD1Fqr/7G1CBlqWhOQL2bi62BmCQaJ8zlVG37St+NouMjIXcubv2bYVokO ZYIBlXw31JTMP4ztKDL30L5IGuDIDIBacNepZUVo= Date: Tue, 6 Dec 2022 21:40:18 -0800 From: Saurabh Singh Sengar To: Yu Zhao Cc: ssengar@microsoft.com, akpm@linux-foundation.org, jack@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org, jostarks@microsoft.com, Matthew Wilcox , Dan Williams Subject: Re: [PATCH] mm/gup: fix gup_pud_range() for dax Message-ID: <20221207054018.GB23765@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1666289686-22798-1-git-send-email-ssengar@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 20, 2022 at 04:18:37PM -0600, Yu Zhao wrote: > On Thu, Oct 20, 2022 at 12:14 PM Saurabh Sengar > wrote: > > > > From: John Starks > > > > 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 > > Signed-off-by: Saurabh Sengar > > --- > > 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 > >