[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250911213823.374806-1-jim.cromie@gmail.com>
Date: Thu, 11 Sep 2025 15:37:53 -0600
From: Jim Cromie <jim.cromie@...il.com>
To: jbaron@...mai.com
Cc: gregkh@...uxfoundation.org,
ukaszb@...omium.org,
louis.chauvet@...tlin.com,
linux-kernel@...r.kernel.org,
Jim Cromie <jim.cromie@...il.com>
Subject: [PATCH 00/30] dyndbg: Rework classmap API to fix module dependency issues
This series reworks the dynamic_debug (dyndbg) classmap API to fix a
fundamental design flaw that caused issues in subsystems sharing
classmaps across several modules, in the 1st use case: DRM
This broke it:
commit aad0214f3026 ("dyndbg: add DECLARE_DYNDBG_CLASSMAP macro")
This recognized it:
commit bb2ff6c27bc9 ("drm: Disable dynamic debug as broken").
Key changes in this series:
* Core API Rework:
- Replaced DECLARE_DYNDBG_CLASSMAP with a new DEFINE/USE pattern
(DYNAMIC_DEBUG_CLASSMAP_DEFINE and DYNAMIC_DEBUG_CLASSMAP_USE) to
allow for shared classmap definitions between modules. This is the
core fix for the module dependency issue.
- compile-time and run-time checks to detect and prevent misuses of
the classmap API, such as overlapping class_id ranges.
- Refined the logic for "protecting" classmaps that implement a
stable ABI (like drm.debug).
- undo dumb namespace noise: DYNDBG_, ddebug (w/o the leading _)
* New Test:
- `cd tools/testing/selftests; make TARGETS=dynamic_debug run_tests`
- supplants DRM as the necessary test
- good for `Tested-by:` ?
* cleanup, maintenance, refactoring:
- drop unneeded linked list, keep classmaps as "vector"
- tighten/declutter internal callchains, etc
- several macros to de-duplicate code.
* excluded DRM parts
- previous revisions included them for testing, validating
- but this complicated things: audience & purpose
* Documentation:
- The documentation has been updated to reflect all the new API
changes and explain the design rationale.
This series has been tested on 3 x86 boxen (w amdgpu, nouveau) and in
virtme-ng with 8 permuted variations of the CONFIG_*DYNAMIC_DEBUG*
options and others.
The testing included DRM-specific adaptation patches which are
excluded here for clarity, but which are the actual user of this
feature, and needed for "proof-on-HW-devices".
Jim Cromie (30):
docs/dyndbg: update examples \012 to \n
docs/dyndbg: explain flags parse 1st
test-dyndbg: fixup CLASSMAP usage error
dyndbg: reword "class unknown," to "class:_UNKNOWN_"
dyndbg: make ddebug_class_param union members same size
dyndbg: drop NUM_TYPE_ARRAY
dyndbg: tweak pr_fmt to avoid expansion conflicts
dyndbg: reduce verbose/debug clutter
dyndbg: refactor param_set_dyndbg_classes and below
dyndbg: tighten fn-sig of ddebug_apply_class_bitmap
dyndbg: replace classmap list with a vector
dyndbg: macrofy a 2-index for-loop pattern
dyndbg: DECLARE_DYNDBG_CLASSMAP needs stub defn
dyndbg,module: make proper substructs in _ddebug_info
dyndbg: hoist classmap-filter-by-modname up to ddebug_add_module
dyndbg: move mod_name from ddebug_table down to _ddebug_info
dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code
selftests-dyndbg: add a dynamic_debug run_tests target
dyndbg: change __dynamic_func_call_cls* macros into expressions
dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP
dyndbg: detect class_id reservation conflicts
dyndbg: check DYNAMIC_DEBUG_CLASSMAP_DEFINE args at compile-time
dyndbg-test: change do_prints testpoint to accept a loopct
dyndbg-API: promote DYNAMIC_DEBUG_CLASSMAP_PARAM to API
dyndbg: treat comma as a token separator
dyndbg: split multi-query strings with %
selftests-dyndbg: add test_mod_submod
dyndbg: resolve "protection" of class'd pr_debugs
dyndbg: add DYNAMIC_DEBUG_CLASSMAP_USE_(clname,_base)
docs/dyndbg: add classmap info to howto
.../admin-guide/dynamic-debug-howto.rst | 179 ++++-
MAINTAINERS | 3 +-
include/asm-generic/vmlinux.lds.h | 5 +-
include/linux/dynamic_debug.h | 304 ++++++--
kernel/module/main.c | 15 +-
lib/Kconfig.debug | 24 +-
lib/Makefile | 5 +
lib/dynamic_debug.c | 675 +++++++++++-------
lib/test_dynamic_debug.c | 198 +++--
lib/test_dynamic_debug_submod.c | 21 +
tools/testing/selftests/Makefile | 1 +
.../testing/selftests/dynamic_debug/Makefile | 9 +
tools/testing/selftests/dynamic_debug/config | 7 +
.../dynamic_debug/dyndbg_selftest.sh | 373 ++++++++++
14 files changed, 1392 insertions(+), 427 deletions(-)
create mode 100644 lib/test_dynamic_debug_submod.c
create mode 100644 tools/testing/selftests/dynamic_debug/Makefile
create mode 100644 tools/testing/selftests/dynamic_debug/config
create mode 100755 tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
--
2.51.0
Powered by blists - more mailing lists