Skip to contentSkip to conversation

drm: 2 quick fixes

PATCH Superseded Jim Cromie 1 participant 3 messages Sep 26

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jim Cromie

author
#0 lore raw

cover drm: 2 quick fixes

1. make __drm_debug __read_mostly
it is rarely written, and read at up to 80khz

2. fix CFLAGS -> ccflags mis-spelling
this fails to add -DDYNAMIC_DEBUG_MODULE to ccflags currently masked by DRM_USE_DYNAMIC_DEBUG=n

---
Jim Cromie (2):
drm/print: Mark __drm_debug as __read_mostly
drm: Fix incorrect ccflags-y spelling inside Makefile

 drivers/gpu/drm/Makefile    | 3 ++-
 drivers/gpu/drm/drm_print.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

---
base-commit: 93f51579e7df248780214094418f205253383cc5
change-id: 20260925-rd-mostly-6a2fc0cd6fd6

Best regards,

Signature · 1 line
Jim Cromie <[email protected]>
author
#1 lore raw

PATCH 1/2 drm/print: Mark __drm_debug as __read_mostly

Under a multi-client workload of 12 concurrent vkcubes on AMD iGPU, __drm_debug is read at ~83.3 kHz across multiple cores during atomic and vblank checks.

__drm_debug is written only when userspace does:
echo 0xff > /sys/module/drm/parameters/debug

Currently the linker packs __drm_debug into .bss adjacent to hot
structures: drm_lease_idr_object, drm_class, and drm_global_mutex, causing unnecessary cacheline invalidations.

Mark __drm_debug as __read_mostly to relocate it to .data..read_mostly.

---
 drivers/gpu/drm/drm_print.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_print.c +1 -1
index 86cef1a37678..50cdeb1b15e2 100644
@@ -40,7 +40,7 @@
  * __drm_debug: Enable debug output.
  * Bitmask of DRM_UT_x. See include/drm/drm_print.h for details.
  */
-unsigned long __drm_debug;
+unsigned long __drm_debug __read_mostly;
 EXPORT_SYMBOL(__drm_debug);
 
 MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n"
Signature · 1 line
2.55.0
author
#2 lore raw

PATCH 2/2 drm: Fix incorrect ccflags-y spelling inside Makefile

In reply to Jim Cromie

Fix a longstanding spelling error in the DRM Makefile by changing 'CFLAGS-y' to 'ccflags-y'. This fixes CONFIG_DRM_USE_DYNAMIC_DEBUG=y dependent addition of -DDYNAMIC_DEBUG_MODULE, which is needed to enable dyndbg-under-drm-debug when only CONFIG_DYNAMIC_DEBUG_CORE is enabled (and not CONFIG_DYNAMIC_DEBUG itself).

---
 drivers/gpu/drm/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/Makefile +2 -1
index e635fcffd379..c42884d84ad1 100644
@@ -3,7 +3,8 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-CFLAGS-$(CONFIG_DRM_USE_DYNAMIC_DEBUG)	+= -DDYNAMIC_DEBUG_MODULE
+ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG)		+= -DDYNAMIC_DEBUG_MODULE
+subdir-ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG)	+= -DDYNAMIC_DEBUG_MODULE
 
 # Unconditionally enable W=1 warnings locally
 # --- begin copy-paste W=1 warnings from scripts/Makefile.warn
Signature · 1 line
2.55.0