Skip to content

Commit 84ec672

Browse files
jimcgregkh
authored andcommitted
drm_print: wrap drm_*_dbg in dyndbg descriptor factory macro
For CONFIG_DRM_USE_DYNAMIC_DEBUG=y, wrap __drm_dbg() & __drm_dev_dbg() in one of dyndbg's Factory macros: _dynamic_func_call_no_desc(). This adds the callsite descriptor into the code, and an entry for each into /proc/dynamic_debug/control. #> echo class DRM_UT_ATOMIC +p > /proc/dynamic_debug/control CONFIG_DRM_USE_DYNAMIC_DEBUG=y/n is configurable because of the .data footprint cost of per-callsite control; 56 bytes/site * ~2k for i915, ~4k callsites for amdgpu. This is large enough that a kernel builder might not want it. Signed-off-by: Jim Cromie <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e820f52 commit 84ec672

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

drivers/gpu/drm/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ config DRM_DEBUG_MM
5050

5151
If in doubt, say "N".
5252

53+
config DRM_USE_DYNAMIC_DEBUG
54+
bool "use dynamic debug to implement drm.debug"
55+
default y
56+
depends on DRM
57+
depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE
58+
depends on JUMP_LABEL
59+
help
60+
Use dynamic-debug to avoid drm_debug_enabled() runtime overheads.
61+
Due to callsite counts in DRM drivers (~4k in amdgpu) and 56
62+
bytes per callsite, the .data costs can be substantial, and
63+
are therefore configurable.
64+
5365
config DRM_DEBUG_SELFTEST
5466
tristate "kselftests for DRM"
5567
depends on DRM

drivers/gpu/drm/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Makefile for the drm device driver. This driver provides support for the
44
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
55

6+
CFLAGS-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE
7+
68
drm-y := drm_aperture.o drm_auth.o drm_cache.o \
79
drm_file.o drm_gem.o drm_ioctl.o \
810
drm_drv.o \

include/drm/drm_print.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,14 @@ void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
384384
} \
385385
})
386386

387+
#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
387388
#define drm_dev_dbg(dev, cat, fmt, ...) \
388389
__drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__)
390+
#else
391+
#define drm_dev_dbg(dev, cat, fmt, ...) \
392+
_dynamic_func_call_no_desc(fmt, __drm_dev_dbg, \
393+
dev, cat, fmt, ##__VA_ARGS__)
394+
#endif
389395

390396
/**
391397
* DRM_DEV_DEBUG() - Debug output for generic drm code
@@ -492,7 +498,13 @@ void ___drm_dbg(enum drm_debug_category category, const char *format, ...);
492498
__printf(1, 2)
493499
void __drm_err(const char *format, ...);
494500

501+
#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
495502
#define __drm_dbg(fmt, ...) ___drm_dbg(fmt, ##__VA_ARGS__)
503+
#else
504+
#define __drm_dbg(cat, fmt, ...) \
505+
_dynamic_func_call_no_desc(fmt, ___drm_dbg, \
506+
cat, fmt, ##__VA_ARGS__)
507+
#endif
496508

497509
/* Macros to make printk easier */
498510

0 commit comments

Comments
 (0)