mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 00/30] dyndbg: Rework classmap API to fix module dependency issues
@ 2025-09-11 21:37 Jim Cromie
  2025-09-11 21:37 ` [PATCH 01/30] docs/dyndbg: update examples \012 to \n Jim Cromie
                   ` (29 more replies)
  0 siblings, 30 replies; 31+ messages in thread
From: Jim Cromie @ 2025-09-11 21:37 UTC (permalink / raw)
  To: jbaron; +Cc: gregkh, ukaszb, louis.chauvet, linux-kernel, Jim Cromie

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


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2025-09-11 21:39 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-11 21:37 [PATCH 00/30] dyndbg: Rework classmap API to fix module dependency issues Jim Cromie
2025-09-11 21:37 ` [PATCH 01/30] docs/dyndbg: update examples \012 to \n Jim Cromie
2025-09-11 21:37 ` [PATCH 02/30] docs/dyndbg: explain flags parse 1st Jim Cromie
2025-09-11 21:37 ` [PATCH 03/30] test-dyndbg: fixup CLASSMAP usage error Jim Cromie
2025-09-11 21:37 ` [PATCH 04/30] dyndbg: reword "class unknown," to "class:_UNKNOWN_" Jim Cromie
2025-09-11 21:37 ` [PATCH 05/30] dyndbg: make ddebug_class_param union members same size Jim Cromie
2025-09-11 21:37 ` [PATCH 06/30] dyndbg: drop NUM_TYPE_ARRAY Jim Cromie
2025-09-11 21:38 ` [PATCH 07/30] dyndbg: tweak pr_fmt to avoid expansion conflicts Jim Cromie
2025-09-11 21:38 ` [PATCH 08/30] dyndbg: reduce verbose/debug clutter Jim Cromie
2025-09-11 21:38 ` [PATCH 09/30] dyndbg: refactor param_set_dyndbg_classes and below Jim Cromie
2025-09-11 21:38 ` [PATCH 10/30] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap Jim Cromie
2025-09-11 21:38 ` [PATCH 11/30] dyndbg: replace classmap list with a vector Jim Cromie
2025-09-11 21:38 ` [PATCH 12/30] dyndbg: macrofy a 2-index for-loop pattern Jim Cromie
2025-09-11 21:38 ` [PATCH 13/30] dyndbg: DECLARE_DYNDBG_CLASSMAP needs stub defn Jim Cromie
2025-09-11 21:38 ` [PATCH 14/30] dyndbg,module: make proper substructs in _ddebug_info Jim Cromie
2025-09-11 21:38 ` [PATCH 15/30] dyndbg: hoist classmap-filter-by-modname up to ddebug_add_module Jim Cromie
2025-09-11 21:38 ` [PATCH 16/30] dyndbg: move mod_name from ddebug_table down to _ddebug_info Jim Cromie
2025-09-11 21:38 ` [PATCH 17/30] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code Jim Cromie
2025-09-11 21:38 ` [PATCH 18/30] selftests-dyndbg: add a dynamic_debug run_tests target Jim Cromie
2025-09-11 21:38 ` [PATCH 19/30] dyndbg: change __dynamic_func_call_cls* macros into expressions Jim Cromie
2025-09-11 21:38 ` [PATCH 20/30] dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP Jim Cromie
2025-09-11 21:38 ` [PATCH 21/30] dyndbg: detect class_id reservation conflicts Jim Cromie
2025-09-11 21:38 ` [PATCH 22/30] dyndbg: check DYNAMIC_DEBUG_CLASSMAP_DEFINE args at compile-time Jim Cromie
2025-09-11 21:38 ` [PATCH 23/30] dyndbg-test: change do_prints testpoint to accept a loopct Jim Cromie
2025-09-11 21:38 ` [PATCH 24/30] dyndbg-API: promote DYNAMIC_DEBUG_CLASSMAP_PARAM to API Jim Cromie
2025-09-11 21:38 ` [PATCH 25/30] dyndbg: treat comma as a token separator Jim Cromie
2025-09-11 21:38 ` [PATCH 26/30] dyndbg: split multi-query strings with % Jim Cromie
2025-09-11 21:38 ` [PATCH 27/30] selftests-dyndbg: add test_mod_submod Jim Cromie
2025-09-11 21:38 ` [PATCH 28/30] dyndbg: resolve "protection" of class'd pr_debugs Jim Cromie
2025-09-11 21:38 ` [PATCH 29/30] dyndbg: add DYNAMIC_DEBUG_CLASSMAP_USE_(clname,_base) Jim Cromie
2025-09-11 21:38 ` [PATCH 30/30] docs/dyndbg: add classmap info to howto Jim Cromie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®