drm_debug_enabled() is called a lot to do unlikely bit-tests to control debug printing; this is a good job for dynamic-debug, IFF it is built with JUMP_LABEL.
Enable the use of dynamic-debug to avoid drm_debug_enabled() overheads, opt in with CONFIG_DRM_USE_DYNAMIC_DEBUG=y.
I have this patchset running bare-metal on an i915 laptop & an amdgpu desktop (both as loadable modules).
I booted the amdgpu box with:
BOOT_IMAGE=(hd2,gpt2)/vmlinuz-5.13.0-dd7-13692-g8def25788f56 \ root=UUID=mumble ro \ rootflags=subvol=root00 rhgb \ dynamic_debug.verbose=3 main.dyndbg=+p \ amdgpu.debug=1 amdgpu.test=1 \ "amdgpu.dyndbg=format ^[ +p"
That last line activates ~1700 callsites with a format like '[DML' etc at boot, causing ~76k prdbgs in 409 seconds, before I turned them off with:
echo module amdgpu -p > /proc/dynamic_debug/control
[root@gandalf jimc]# journalctl -b-0 | grep -P '[(DML|VBLANK|SURFACE|BIOS|BANDWIDTH)' | wc 68708 578503 5054437 [root@gandalf jimc]# journalctl -b-0 | grep -P '[(DML|VBLANK|SURFACE|BIOS|BANDWIDTH|\w+)' | wc 76298 661176 6028087
IOW, things appear to hold up under some stress.
this is on top of master @ v5.13-13688-gde5540965853
v1 is here: https://lore.kernel.org/lkml/20201204035318.332419-1-jim.cromie@gmail.com/
Jim Cromie (4): drm_print.h: rewrap __DRM_DEFINE_DBG_RATELIMITED macro drm: fixup comment spelling drm: RFC add choice to use dynamic debug in drm-debug i915: map gvt pr_debug categories to bits in parameters/debug_gvt
drivers/gpu/drm/Kconfig | 13 ++++ drivers/gpu/drm/drm_print.c | 75 +++++++++++++++++- drivers/gpu/drm/i915/gvt/Makefile | 4 + drivers/gpu/drm/i915/i915_params.c | 76 ++++++++++++++++++ include/drm/drm_print.h | 119 ++++++++++++++++++++--------- 5 files changed, 249 insertions(+), 38 deletions(-)