Message ID | 1670392853-28252-1-git-send-email-ssengar@linux.microsoft.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v2] mm/gup: fix gup_pud_range() for dax | expand |
On Tue, 6 Dec 2022 22:00:53 -0800 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. > > This fixes the below kernel panic: > > ... > > Fixes: 414fd080d125 ("mm/gup: fix gup_pmd_range() for dax") Feb 2019. > 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 c2c2c6d..e776540 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -2765,7 +2765,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; I assume this should be backported into -stable kernels?
On Wed, Dec 07, 2022 at 01:31:30PM -0800, Andrew Morton wrote: > On Tue, 6 Dec 2022 22:00:53 -0800 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. > > > > This fixes the below kernel panic: > > > > ... > > > > Fixes: 414fd080d125 ("mm/gup: fix gup_pmd_range() for dax") > > Feb 2019. > > > 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 c2c2c6d..e776540 100644 > > --- a/mm/gup.c > > +++ b/mm/gup.c > > @@ -2765,7 +2765,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; > > I assume this should be backported into -stable kernels? That would be helpful, thanks.
diff --git a/mm/gup.c b/mm/gup.c index c2c2c6d..e776540 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2765,7 +2765,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;