linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/gup: fix gup_pud_range() for dax
@ 2022-10-20 18:14 Saurabh Sengar
  2022-10-20 22:18 ` Yu Zhao
  0 siblings, 1 reply; 3+ messages in thread
From: Saurabh Sengar @ 2022-10-20 18:14 UTC (permalink / raw)
  To: ssengar, akpm, yuzhao, jack, linux-mm, linux-kernel, jostarks

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))) {
 			if (!gup_huge_pud(pud, pudp, addr, next, flags,
 					  pages, nr))
 				return 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/gup: fix gup_pud_range() for dax
  2022-10-20 18:14 [PATCH] mm/gup: fix gup_pud_range() for dax Saurabh Sengar
@ 2022-10-20 22:18 ` Yu Zhao
  2022-12-07  5:40   ` Saurabh Singh Sengar
  0 siblings, 1 reply; 3+ messages in thread
From: Yu Zhao @ 2022-10-20 22:18 UTC (permalink / raw)
  To: Saurabh Sengar
  Cc: ssengar, akpm, jack, linux-mm, linux-kernel, jostarks,
	Matthew Wilcox, Dan Williams

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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/gup: fix gup_pud_range() for dax
  2022-10-20 22:18 ` Yu Zhao
@ 2022-12-07  5:40   ` Saurabh Singh Sengar
  0 siblings, 0 replies; 3+ messages in thread
From: Saurabh Singh Sengar @ 2022-12-07  5:40 UTC (permalink / raw)
  To: Yu Zhao
  Cc: ssengar, akpm, jack, linux-mm, linux-kernel, jostarks,
	Matthew Wilcox, Dan Williams

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
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-07  5:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20 18:14 [PATCH] mm/gup: fix gup_pud_range() for dax Saurabh Sengar
2022-10-20 22:18 ` Yu Zhao
2022-12-07  5:40   ` Saurabh Singh Sengar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).