Skip to content

dyndbg: Rework classmap API to fix module dependency issues

Jim Cromie linux-doc lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest30 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/30docs/dyndbg: update examples \012 to \nDocumentation/admin-guide/dynamic-debug-howto.rst+10 -100 replies
2/30docs/dyndbg: explain flags parse 1stDocumentation/admin-guide/dynamic-debug-howto.rst+12 -30 replies
3/30test-dyndbg: fixup CLASSMAP usage errorlib/test_dynamic_debug.c+1 -10 replies
4/30dyndbg: reword "class unknown," to "class:_UNKNOWN_"lib/dynamic_debug.c+1 -10 replies
5/30dyndbg: make ddebug_class_param union members same sizeinclude/linux/dynamic_debug.h lib/dynamic_debug.c+2 -20 replies
6/30dyndbg: drop NUM_TYPE_ARRAYinclude/linux/dynamic_debug.h+1 -30 replies
7/30dyndbg: tweak pr_fmt to avoid expansion conflictslib/dynamic_debug.c+1 -10 replies
8/30dyndbg: reduce verbose/debug clutterlib/dynamic_debug.c+6 -150 replies
9/30dyndbg: refactor param_set_dyndbg_classes and belowlib/dynamic_debug.c+40 -250 replies
10/30dyndbg: tighten fn-sig of ddebug_apply_class_bitmaplib/dynamic_debug.c+11 -100 replies
11/30dyndbg: replace classmap list with a vectorinclude/linux/dynamic_debug.h lib/dynamic_debug.c+32 -310 replies
12/30dyndbg: macrofy a 2-index for-loop patternlib/dynamic_debug.c+16 -30 replies
13/30dyndbg: DECLARE_DYNDBG_CLASSMAP needs stub defninclude/linux/dynamic_debug.h+20 -190 replies
14/30dyndbg,module: make proper substructs in _ddebug_infoinclude/asm-generic/vmlinux.lds.h include/linux/dynamic_debug.h kernel/module/main.c +2 more+87 -780 replies
15/30dyndbg: hoist classmap-filter-by-modname up to ddebug_add_modulelib/dynamic_debug.c+32 -240 replies
16/30dyndbg: move mod_name from ddebug_table down to _ddebug_infoinclude/linux/dynamic_debug.h lib/dynamic_debug.c+24 -220 replies
17/30dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and codeinclude/linux/dynamic_debug.h lib/dynamic_debug.c lib/test_dynamic_debug.c+14 -1370 replies
18/30selftests-dyndbg: add a dynamic_debug run_tests targetMAINTAINERS tools/testing/selftests/Makefile tools/testing/selftests/dynamic_debug/Makefile +2 more+275 -00 replies
19/30dyndbg: change __dynamic_func_call_cls* macros into expressionsinclude/linux/dynamic_debug.h+4 -40 replies
20/30dyndbg-API: replace DECLARE_DYNDBG_CLASSMAPMAINTAINERS include/asm-generic/vmlinux.lds.h include/linux/dynamic_debug.h +6 more+397 -790 replies
21/30dyndbg: detect class_id reservation conflictslib/dynamic_debug.c lib/test_dynamic_debug.c+35 -00 replies
22/30dyndbg: check DYNAMIC_DEBUG_CLASSMAP_DEFINE args at compile-timeinclude/linux/dynamic_debug.h lib/test_dynamic_debug.c+21 -10 replies
23/30dyndbg-test: change do_prints testpoint to accept a loopctlib/test_dynamic_debug.c+21 -110 replies
24/30dyndbg-API: promote DYNAMIC_DEBUG_CLASSMAP_PARAM to APIinclude/linux/dynamic_debug.h lib/dynamic_debug.c lib/test_dynamic_debug.c +1 more+106 -500 replies
25/30dyndbg: treat comma as a token separatorDocumentation/admin-guide/dynamic-debug-howto.rst lib/dynamic_debug.c tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh+39 -80 replies
26/30dyndbg: split multi-query strings with %Documentation/admin-guide/dynamic-debug-howto.rst lib/dynamic_debug.c tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh+30 -40 replies
27/30selftests-dyndbg: add test_mod_submodtools/testing/selftests/dynamic_debug/dyndbg_selftest.sh+73 -00 replies
28/30dyndbg: resolve "protection" of class'd pr_debugsinclude/linux/dynamic_debug.h lib/dynamic_debug.c+100 -280 replies
29/30dyndbg: add DYNAMIC_DEBUG_CLASSMAP_USE_(clname,_base)include/linux/dynamic_debug.h lib/dynamic_debug.c+35 -140 replies
30/30docs/dyndbg: add classmap info to howtoDocumentation/admin-guide/dynamic-debug-howto.rst+116 -130 replies

Reviews trailers per patch

13 of 30 patches have a Reviewed-by or Acked-by.

PatchLouis Chauvet
1/30R-b T-b
2/30R-b
3/30R-b T-b
4/30R-b
5/30R-b
6/30R-b
7/30
8/30R-b
9/30R-b
10/30R-b
11/30
12/30R-b
13/30
14/30
15/30
16/30R-b
17/30
18/30
19/30
20/30
21/30
22/30
23/30
24/30
25/30
26/30R-b
27/30R-b
28/30
29/30
30/30

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [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
Signature · 1 line
2.51.0