[PATCH] mm: Fix compile error when CONFIG_SHMEM is not set
Steven Rostedt
rostedt at goodmis.org
Tue Jun 3 17:27:36 UTC 2025
[ Adding DRM folks ]
On Tue, 3 Jun 2025 17:26:23 +0100
Matthew Wilcox <willy at infradead.org> wrote:
> On Tue, Jun 03, 2025 at 10:29:59AM -0400, Steven Rostedt wrote:
> > On Tue, 3 Jun 2025 01:02:36 -0700 (PDT)
> > Hugh Dickins <hughd at google.com> wrote:
> >
> > > Agreed that ramfs does not use swap, so calling swap_writepage() would
> > > be weird. But, thanks for the build fix Steve, but it cannot be right
> > > because return 0 says shmem_writeout() successfully sent the page to
> > > swap, and that has unlocked the page (or soon will do so). It should
> > > return an error (-ENXIO?), but I haven't checked what the callers do with
> >
> > Yeah, I figured it should return an error, but looking at the code I
> > couldn't figure out what the proper error would be. Then I also noticed
> > that the other stub functions just returned zero so I did the same.
> >
> > Perhaps add a WARN_ON_ONCE() if it is called without CONFIG_SHMEM configured?
>
> Or just make this module depend on SHMEM? I don't think it makes much
> sense to use it without being able to swap, and shmem can't swap ...
Heh, not exactly sure what to make depend on CONFIG_SHMEM. The function is:
ttm_backup_backup_page()
Which is defined when CONFIG_DRM_TTM is set, but just doing:
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index f094797f3b2b..ebb948a0142f 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -187,7 +187,7 @@ source "drivers/gpu/drm/display/Kconfig"
config DRM_TTM
tristate
- depends on DRM && MMU
+ depends on DRM && MMU && SHMEM
help
GPU memory management subsystem for devices with multiple
GPU memory types. Will be enabled automatically if a device driver
Isn't good enough because "select" can override depends on :-p and DRM_TTM
gets selected by:
Symbol: DRM_TTM [=y]
Type : tristate
Defined at drivers/gpu/drm/Kconfig:188
Depends on: HAS_IOMEM [=y] && DRM [=y] && MMU [=y] && SHMEM [=n]
Selected by [y]:
- DRM_TTM_HELPER [=y] && HAS_IOMEM [=y] && DRM [=y]
- DRM_RADEON [=y] && HAS_IOMEM [=y] && DRM [=y] && PCI [=y] && MMU [=y] && (AGP [=n] || !AGP [=n])
- DRM_VMWGFX [=y] && HAS_IOMEM [=y] && DRM [=y] && PCI [=y] && MMU [=y] && (X86 [=y] && HYPERVISOR_GUEST [=y] || ARM64)
Selected by [n]:
- DRM_TTM_KUNIT_TEST [=n] && HAS_IOMEM [=y] && DRM [=y] && KUNIT [=n] && MMU [=y] && (UML || COMPILE_TEST [=n])
- DRM_AMDGPU [=n] && HAS_IOMEM [=y] && DRM [=y] && PCI [=y] && MMU [=y] && !UML
- DRM_NOUVEAU [=n] && HAS_IOMEM [=y] && DRM [=y] && PCI [=y] && MMU [=y]
- DRM_I915 [=n] && HAS_IOMEM [=y] && DRM [=y] && X86 [=y] && PCI [=y] && !PREEMPT_RT [=n]
- DRM_XE [=n] && HAS_IOMEM [=y] && DRM [=y] && PCI [=y] && MMU [=y] && (m [=m] && MODULES [=n] || KUNIT [=n]=y [=y]
- DRM_QXL [=n] && HAS_IOMEM [=y] && DRM [=y] && PCI [=y] && MMU [=y] && HAS_IOPORT [=y]
- DRM_LOONGSON [=n] && HAS_IOMEM [=y] && DRM [=y] && PCI [=y] && MMU [=y] && (LOONGARCH || MIPS || COMPILE_TEST [=n])
- DRM_HISI_HIBMC [=n] && HAS_IOMEM [=y] && DRM [=y] && PCI [=y] && MMU [=y]
- DRM_VBOXVIDEO [=n] && HAS_IOMEM [=y] && DRM [=y] && X86 [=y] && PCI [=y]
Should DRM itself depend on SHMEM?
-- Steve
More information about the dri-devel
mailing list