Linux-Next discussions
 help / color / mirror / Atom feed
* Semantic conflict between 04b177544a04 in drm-misc-fixes and 0b6b1bb28482 in -mm
@ 2026-07-22 22:56 Nathan Chancellor
  2026-07-22 23:15 ` Matthew Brost
  0 siblings, 1 reply; 6+ messages in thread
From: Nathan Chancellor @ 2026-07-22 22:56 UTC (permalink / raw)
  To: Mark Brown, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Matthew Brost, Andrew Morton, Usama Arif
  Cc: linux-mm, dri-devel, linux-next

Hi Mark and drm and mm folks,

There is a semantic conflict between commit 04b177544a04 ("drm/pagemap:
Guard HPAGE_PMD_ORDER use with CONFIG_ARCH_ENABLE_THP_MIGRATION") in the
drm-misc-fixes tree and commit 0b6b1bb28482 ("mm: rename
ARCH_ENABLE_THP_MIGRATION to ARCH_HAS_PMD_SOFTLEAVES"), resulting in a
lone instance of CONFIG_ARCH_ENABLE_THP_MIGRATION with no way to define
it.

  $ git grep ARCH_ENABLE_THP_MIGRATION
  Next/merge.log:Merging drm-misc-fixes/for-linux-next-fixes (04b177544a040 drm/pagemap: Guard HPAGE_PMD_ORDER use with CONFIG_ARCH_ENABLE_THP_MIGRATION)
  drivers/gpu/drm/drm_pagemap.c:#if IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION)

This results in an objtool warning (or error with CONFIG_OBJTOOL_WERROR)
when building with clang because NR_PAGES(order) results in 1U << -1,
which causes clang to stop generating code for
drm_pagemap_migrate_to_devmem() when encountering unconditional
undefined behavior.

  drivers/gpu/drm/drm_gpusvm_helper.o: error: objtool: drm_pagemap_migrate_to_devmem() falls through to next function drm_pagemap_zdd_alloc()

Mark, could please apply the following diff to the -mm merge to avoid
this? Obviously, there will need to be further coordination for
resolving this upstream when the time comes but it is only an issue in
-next currently.

diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c
index 4a794544b7dc..f00c27edbfb9 100644
--- a/drivers/gpu/drm/drm_pagemap.c
+++ b/drivers/gpu/drm/drm_pagemap.c
@@ -12,7 +12,7 @@
 #include <drm/drm_pagemap_util.h>
 #include <drm/drm_print.h>
 
-#if IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION)
+#if IS_ENABLED(CONFIG_ARCH_HAS_PMD_SOFTLEAVES)
 #define DRM_PAGEMAP_PMD_ORDER	HPAGE_PMD_ORDER
 #else
 #define DRM_PAGEMAP_PMD_ORDER	(-1)
-- 
Cheers,
Nathan

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

* Re: Semantic conflict between 04b177544a04 in drm-misc-fixes and 0b6b1bb28482 in -mm
  2026-07-22 22:56 Semantic conflict between 04b177544a04 in drm-misc-fixes and 0b6b1bb28482 in -mm Nathan Chancellor
@ 2026-07-22 23:15 ` Matthew Brost
  2026-07-23 21:27   ` Nathan Chancellor
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Brost @ 2026-07-22 23:15 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Mark Brown, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Andrew Morton, Usama Arif, linux-mm, dri-devel, linux-next

On Wed, Jul 22, 2026 at 03:56:05PM -0700, Nathan Chancellor wrote:
> Hi Mark and drm and mm folks,
> 

Typically to get drm_pagemap.c to compile on various configs this is
what is needed:

109 #ifdef CONFIG_PGTABLE_HAS_HUGE_LEAVES
110 #define HPAGE_PMD_SHIFT PMD_SHIFT
111 #define HPAGE_PUD_SHIFT PUD_SHIFT
112 #else
113 #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
114 #define HPAGE_PUD_SHIFT ({ BUILD_BUG(); 0; })
115 #endif

So the drm_pagemap.c code could be:

-#if IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION)
+#if IS_ENABLED(CONFIG_PGTABLE_HAS_HUGE_LEAVES)
#define DRM_PAGEMAP_PMD_ORDER        HPAGE_PMD_ORDER
#else
#define DRM_PAGEMAP_PMD_ORDER        (-1)

This Kconfig has been around since 2024:
git format-patch -1 b979db1611a63

Would it be better for everyone for me to change this in the DRM branches?

Matt

> There is a semantic conflict between commit 04b177544a04 ("drm/pagemap:
> Guard HPAGE_PMD_ORDER use with CONFIG_ARCH_ENABLE_THP_MIGRATION") in the
> drm-misc-fixes tree and commit 0b6b1bb28482 ("mm: rename
> ARCH_ENABLE_THP_MIGRATION to ARCH_HAS_PMD_SOFTLEAVES"), resulting in a
> lone instance of CONFIG_ARCH_ENABLE_THP_MIGRATION with no way to define
> it.
> 
>   $ git grep ARCH_ENABLE_THP_MIGRATION
>   Next/merge.log:Merging drm-misc-fixes/for-linux-next-fixes (04b177544a040 drm/pagemap: Guard HPAGE_PMD_ORDER use with CONFIG_ARCH_ENABLE_THP_MIGRATION)
>   drivers/gpu/drm/drm_pagemap.c:#if IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION)
> 
> This results in an objtool warning (or error with CONFIG_OBJTOOL_WERROR)
> when building with clang because NR_PAGES(order) results in 1U << -1,
> which causes clang to stop generating code for
> drm_pagemap_migrate_to_devmem() when encountering unconditional
> undefined behavior.
> 
>   drivers/gpu/drm/drm_gpusvm_helper.o: error: objtool: drm_pagemap_migrate_to_devmem() falls through to next function drm_pagemap_zdd_alloc()
> 
> Mark, could please apply the following diff to the -mm merge to avoid
> this? Obviously, there will need to be further coordination for
> resolving this upstream when the time comes but it is only an issue in
> -next currently.
> 
> diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c
> index 4a794544b7dc..f00c27edbfb9 100644
> --- a/drivers/gpu/drm/drm_pagemap.c
> +++ b/drivers/gpu/drm/drm_pagemap.c
> @@ -12,7 +12,7 @@
>  #include <drm/drm_pagemap_util.h>
>  #include <drm/drm_print.h>
>  
> -#if IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION)
> +#if IS_ENABLED(CONFIG_ARCH_HAS_PMD_SOFTLEAVES)
>  #define DRM_PAGEMAP_PMD_ORDER	HPAGE_PMD_ORDER
>  #else
>  #define DRM_PAGEMAP_PMD_ORDER	(-1)
> -- 
> Cheers,
> Nathan

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

* Re: Semantic conflict between 04b177544a04 in drm-misc-fixes and 0b6b1bb28482 in -mm
  2026-07-22 23:15 ` Matthew Brost
@ 2026-07-23 21:27   ` Nathan Chancellor
  2026-07-23 23:09     ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Nathan Chancellor @ 2026-07-23 21:27 UTC (permalink / raw)
  To: Matthew Brost
  Cc: Mark Brown, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Andrew Morton, Usama Arif, linux-mm, dri-devel, linux-next

On Wed, Jul 22, 2026 at 04:15:49PM -0700, Matthew Brost wrote:
> On Wed, Jul 22, 2026 at 03:56:05PM -0700, Nathan Chancellor wrote:
> > Hi Mark and drm and mm folks,
> > 
> 
> Typically to get drm_pagemap.c to compile on various configs this is
> what is needed:
> 
> 109 #ifdef CONFIG_PGTABLE_HAS_HUGE_LEAVES
> 110 #define HPAGE_PMD_SHIFT PMD_SHIFT
> 111 #define HPAGE_PUD_SHIFT PUD_SHIFT
> 112 #else
> 113 #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
> 114 #define HPAGE_PUD_SHIFT ({ BUILD_BUG(); 0; })
> 115 #endif
> 
> So the drm_pagemap.c code could be:
> 
> -#if IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION)
> +#if IS_ENABLED(CONFIG_PGTABLE_HAS_HUGE_LEAVES)
> #define DRM_PAGEMAP_PMD_ORDER        HPAGE_PMD_ORDER
> #else
> #define DRM_PAGEMAP_PMD_ORDER        (-1)

Ah yeah, I probably should have looked at the bigger picture there.

> This Kconfig has been around since 2024:
> git format-patch -1 b979db1611a63
> 
> Would it be better for everyone for me to change this in the DRM branches?

I believe that would render this conflict moot and seems like the
correct thing to do anyways but you could wait for input from the mm
folks.

> > There is a semantic conflict between commit 04b177544a04 ("drm/pagemap:
> > Guard HPAGE_PMD_ORDER use with CONFIG_ARCH_ENABLE_THP_MIGRATION") in the
> > drm-misc-fixes tree and commit 0b6b1bb28482 ("mm: rename
> > ARCH_ENABLE_THP_MIGRATION to ARCH_HAS_PMD_SOFTLEAVES"), resulting in a
> > lone instance of CONFIG_ARCH_ENABLE_THP_MIGRATION with no way to define
> > it.
> > 
> >   $ git grep ARCH_ENABLE_THP_MIGRATION
> >   Next/merge.log:Merging drm-misc-fixes/for-linux-next-fixes (04b177544a040 drm/pagemap: Guard HPAGE_PMD_ORDER use with CONFIG_ARCH_ENABLE_THP_MIGRATION)
> >   drivers/gpu/drm/drm_pagemap.c:#if IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION)
> > 
> > This results in an objtool warning (or error with CONFIG_OBJTOOL_WERROR)
> > when building with clang because NR_PAGES(order) results in 1U << -1,
> > which causes clang to stop generating code for
> > drm_pagemap_migrate_to_devmem() when encountering unconditional
> > undefined behavior.
> > 
> >   drivers/gpu/drm/drm_gpusvm_helper.o: error: objtool: drm_pagemap_migrate_to_devmem() falls through to next function drm_pagemap_zdd_alloc()
> > 
> > Mark, could please apply the following diff to the -mm merge to avoid
> > this? Obviously, there will need to be further coordination for
> > resolving this upstream when the time comes but it is only an issue in
> > -next currently.
> > 
> > diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c
> > index 4a794544b7dc..f00c27edbfb9 100644
> > --- a/drivers/gpu/drm/drm_pagemap.c
> > +++ b/drivers/gpu/drm/drm_pagemap.c
> > @@ -12,7 +12,7 @@
> >  #include <drm/drm_pagemap_util.h>
> >  #include <drm/drm_print.h>
> >  
> > -#if IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION)
> > +#if IS_ENABLED(CONFIG_ARCH_HAS_PMD_SOFTLEAVES)
> >  #define DRM_PAGEMAP_PMD_ORDER	HPAGE_PMD_ORDER
> >  #else
> >  #define DRM_PAGEMAP_PMD_ORDER	(-1)
> > -- 
> > Cheers,
> > Nathan

-- 
Cheers,
Nathan

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

* Re: Semantic conflict between 04b177544a04 in drm-misc-fixes and 0b6b1bb28482 in -mm
  2026-07-23 21:27   ` Nathan Chancellor
@ 2026-07-23 23:09     ` Andrew Morton
  2026-07-23 23:11       ` Matthew Brost
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2026-07-23 23:09 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Matthew Brost, Mark Brown, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Usama Arif, linux-mm, dri-devel, linux-next

On Thu, 23 Jul 2026 14:27:24 -0700 Nathan Chancellor <nathan@kernel.org> wrote:

> > So the drm_pagemap.c code could be:
> > 
> > -#if IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION)
> > +#if IS_ENABLED(CONFIG_PGTABLE_HAS_HUGE_LEAVES)
> > #define DRM_PAGEMAP_PMD_ORDER        HPAGE_PMD_ORDER
> > #else
> > #define DRM_PAGEMAP_PMD_ORDER        (-1)
> 
> Ah yeah, I probably should have looked at the bigger picture there.
> 
> > This Kconfig has been around since 2024:
> > git format-patch -1 b979db1611a63
> > 
> > Would it be better for everyone for me to change this in the DRM branches?
> 
> I believe that would render this conflict moot and seems like the
> correct thing to do anyways but you could wait for input from the mm
> folks.

I'm fine the drm people changing things ;)

Otherwise I can disable "mm: rename ARCH_ENABLE_THP_MIGRATION to
ARCH_HAS_PMD_SOFTLEAVES" for now and fix&reintroduce it into mm.git
after drm-misc has merge into Linus.  Or something like that.


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

* Re: Semantic conflict between 04b177544a04 in drm-misc-fixes and 0b6b1bb28482 in -mm
  2026-07-23 23:09     ` Andrew Morton
@ 2026-07-23 23:11       ` Matthew Brost
  2026-07-24  0:13         ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Brost @ 2026-07-23 23:11 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Nathan Chancellor, Mark Brown, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Usama Arif, linux-mm, dri-devel, linux-next

On Thu, Jul 23, 2026 at 04:09:42PM -0700, Andrew Morton wrote:
> On Thu, 23 Jul 2026 14:27:24 -0700 Nathan Chancellor <nathan@kernel.org> wrote:
> 
> > > So the drm_pagemap.c code could be:
> > > 
> > > -#if IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION)
> > > +#if IS_ENABLED(CONFIG_PGTABLE_HAS_HUGE_LEAVES)
> > > #define DRM_PAGEMAP_PMD_ORDER        HPAGE_PMD_ORDER
> > > #else
> > > #define DRM_PAGEMAP_PMD_ORDER        (-1)
> > 
> > Ah yeah, I probably should have looked at the bigger picture there.
> > 
> > > This Kconfig has been around since 2024:
> > > git format-patch -1 b979db1611a63
> > > 
> > > Would it be better for everyone for me to change this in the DRM branches?
> > 
> > I believe that would render this conflict moot and seems like the
> > correct thing to do anyways but you could wait for input from the mm
> > folks.
> 
> I'm fine the drm people changing things ;)
> 

I'll jump make a DRM change so this is all worked out when it gets to
Linus.

Matt

> Otherwise I can disable "mm: rename ARCH_ENABLE_THP_MIGRATION to
> ARCH_HAS_PMD_SOFTLEAVES" for now and fix&reintroduce it into mm.git
> after drm-misc has merge into Linus.  Or something like that.
> 

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

* Re: Semantic conflict between 04b177544a04 in drm-misc-fixes and 0b6b1bb28482 in -mm
  2026-07-23 23:11       ` Matthew Brost
@ 2026-07-24  0:13         ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2026-07-24  0:13 UTC (permalink / raw)
  To: Matthew Brost
  Cc: Andrew Morton, Nathan Chancellor, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Usama Arif, linux-mm, dri-devel,
	linux-next

[-- Attachment #1: Type: text/plain, Size: 297 bytes --]

On Thu, Jul 23, 2026 at 04:11:48PM -0700, Matthew Brost wrote:
> On Thu, Jul 23, 2026 at 04:09:42PM -0700, Andrew Morton wrote:

> > I'm fine the drm people changing things ;)

> I'll jump make a DRM change so this is all worked out when it gets to
> Linus.

So should I drop Nathan's fixup then?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2026-07-24  0:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22 22:56 Semantic conflict between 04b177544a04 in drm-misc-fixes and 0b6b1bb28482 in -mm Nathan Chancellor
2026-07-22 23:15 ` Matthew Brost
2026-07-23 21:27   ` Nathan Chancellor
2026-07-23 23:09     ` Andrew Morton
2026-07-23 23:11       ` Matthew Brost
2026-07-24  0:13         ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox