[PATCH v3 0/5] drm: use dyndbg in drm_print

From: Jim Cromie
Date: Wed Jul 14 2021 - 13:51:52 EST


hi dri-devel,

Im pretty new in this particular playground.
Im using this to send, is it too spammy ? too --to ?
git send-email --dry-run \
--to-cmd='scripts/get_maintainer.pl --no-rolestats v3-000*.patch' \
--to=jbaron@xxxxxxxxxx v3-000*.patch

drm_debug_enabled() is called a lot (by drm_dev_dbg) to do unlikely
bit-tests to selectively enable debug printing; this is a good job for
dynamic-debug, IFF it is built with JUMP_LABEL.

This patchset enables the use of dynamic-debug to avoid those
drm_debug_enabled() overheads, if CONFIG_DRM_USE_DYNAMIC_DEBUG=y.

v3: fixes missed SOB, && on BOL, commit-log tweaks
reordered patches, 1 is comment, 2 is whitespace.
dropped RFC, to see what happens.
v2: https://lore.kernel.org/lkml/20210711055003.528167-1-jim.cromie@xxxxxxxxx/
v1: https://lore.kernel.org/lkml/20201204035318.332419-1-jim.cromie@xxxxxxxxx/

Doing so creates many new pr_debug callsites,
otherwise i915 has ~120 prdbgs, and drm has just 1;

bash-5.1# modprobe i915
dyndbg: 8 debug prints in module video
dyndbg: 305 debug prints in module drm
dyndbg: 207 debug prints in module drm_kms_helper
dyndbg: 2 debug prints in module ttm
dyndbg: 1720 debug prints in module i915

On amdgpu, enabling it adds ~3200 prdbgs, currently at 56 bytes each.
So CONFIG_DRM_USE_DYNAMIC_DEBUG=y affects resource requirements.

Im running this patchset 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 enables ~1700 prdbg callsites with a format like '[DML'
etc at boot, and amdgpu.test=1 triggers 3 minutes of tests, causing
~76k prdbgs in 409 seconds, before I turned them off with:

echo module amdgpu -p > /proc/dynamic_debug/control

This is on top of master @ v5.14-rc1
Should I rebase onto something else ?

Jim Cromie (5):
drm/print: fixup spelling in a comment
drm_print.h: rewrap __DRM_DEFINE_DBG_RATELIMITED macro
drm/print: RFC add choice to use dynamic debug in drm-debug
drm/print: move conditional deref into macro defn
i915: map gvt pr_debug categories to bits in parameters/debug_gvt

Note: 3/5, 5/5 have bits that are here for POC, but belong in
dynamic_debug.c.


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 | 117 ++++++++++++++++++++---------
5 files changed, 247 insertions(+), 38 deletions(-)

--
2.31.1