V4 of this series drops 2 doc-only patches in v3, recently picked up
by linux-doc, thx Jonathan
So new 1st 5 are a fix to a linker-script alignment problem in 32bit
arches causing a null-ptr scanning dyndbg-descriptor section on i386.
These were reviewed by Petr Pavlu.
V4 main change is addition and use of match_wildcard_hyphen(), which
allows that "i2c_hid" is same as "i2c-hid" wrt to modname comparison.
This addresses sashiko-dev's feedback on V3.
v3:
The remaining patches are cleanups, refactors in preparation for an
API change needed to fix a regression in DRM when it uses classmaps.
I split these out for easier review, I will follow up with the API
change afterwards.
The biggest revision vs V2 is the new patch: 25. It addresses a flaw
detected by sashiko which is best described by example.
Dyndbg uses KBUILD_MODNAME to provide module-name, this works well for
loadable modules (module loader requires unique module names), but for
builtin modules, is effectively kbasename, and not unique.
So we get 4 modules named "main": init/main, kernel/power/main,
kernel/base/poser/main. This ambiguity is visible in user-space since
the beginning of dyndbg.
Now suppose kernel/{,base}/power/main want to define classmaps to
categorize the various pr-debugs they have. The current code finds a
module's classmaps by strcmp on modname, so init/main will match
against classmaps defined by both kernel/{,base}/power/main.
The current code will also map "main" classes to kernel/*/power/main,
so they will probably work at first, but 2 independent classmaps can
both use class-ids 0-N, but will conflict if they're both used by a
module. Then we have classmap overlaps and unpredictable results.
patch-24 eliminates the ambiguity by using KBUILD_MODFILE to provide a
unique module-name, then adds matching against kbasename(modname) to
restore the legacy query behavior. It *does* change the modname
exposed in /proc/dynamic_debug/control, but not the result of a query
like "module main +p".
OLDER VERSIONS:
V2 primarily revises:
https://lore.kernel.org/lkml/[email protected]/
V2 addressed most of sashiko's feedback on V1:
https://sashiko.dev/#/patchset/20260504-dd-cleanups-2-v1-0-6fdd24040642%40gmail.com
It dropped the pr-fmt patch, as not reproducible,
advanced the drop-NAMES patch to reduce subsequent churn,
and fixed the classmaps PARAMs to u64 to avoid 32bit flags on 32bit arches
For easy one-stop-shopping, V2 also included 2 smaller series:
1st fixes a section alignment problem, with Reviewed-by from Petr Pavlu
https://lore.kernel.org/lkml/[email protected]/
Signed-off-by: Jim Cromie <[email protected]>
Signed-off-by: Jim Cromie <[email protected]>
---
Changes in v4:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v3:
https://lore.kernel.org/r/[email protected]
Changes in v3:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v2:
https://lore.kernel.org/r/[email protected]
---
Jim Cromie (25):
docs/dyndbg: update examples \012 to \n
docs/dyndbg: explain flags parse 1st
vmlinux.lds.h: refactor BOUNDED_SECTION_* macros into
bounded_sections.lds.h
vmlinux.lds.h: drop unused HEADERED_SECTION* macros
vmlinux.lds.h: Fix ALIGN(8) omission causing NULL ptr on i386
vmlinux.lds.h: remove redundant ALIGN(8) directives
dyndbg.lds.S: fix lost dyndbg sections in modules
dyndbg: factor ddebug_match_desc out from ddebug_change
dyndbg: add stub macro for DECLARE_DYNDBG_CLASSMAP
dyndbg: reword "class unknown," to "class:_UNKNOWN_"
dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code
dyndbg: drop NUM_TYPE_ARGS
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 an array-slice
dyndbg: macrofy a 2-index for-loop pattern
dyndbg: Upgrade class param storage to u64 for 64-bit classmaps
dyndbg,module: make proper substructs in _ddebug_info
dyndbg: move mod_name down from struct ddebug_table to _ddebug_info
dyndbg: hoist classmap-filter-by-modname up to ddebug_add_module
selftests-dyndbg: add a dynamic_debug run_tests target
dyndbg: change __dynamic_func_call_cls* macros into expressions
lib/parser: add match_wildcard_hyphen() for agnostic matching
dynamic_debug: use KBUILD_MODFILE for unique builtin module names
Documentation/admin-guide/dynamic-debug-howto.rst | 55 ++-
MAINTAINERS | 2 +
drivers/gpu/drm/drm_print.c | 6 +-
include/asm-generic/bounded_sections.lds.h | 32 ++
include/asm-generic/dyndbg.lds.h | 18 +
include/asm-generic/vmlinux.lds.h | 68 +--
include/drm/drm_print.h | 2 +-
include/linux/dynamic_debug.h | 133 +++---
include/linux/parser.h | 1 +
kernel/module/main.c | 12 +-
lib/dynamic_debug.c | 507 ++++++++++-----------
lib/parser.c | 58 ++-
lib/test_dynamic_debug.c | 30 +-
scripts/module.lds.S | 2 +
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/dynamic_debug/Makefile | 9 +
tools/testing/selftests/dynamic_debug/config | 8 +
.../selftests/dynamic_debug/dyndbg_selftest.sh | 343 ++++++++++++++
18 files changed, 833 insertions(+), 454 deletions(-)
---
base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8
change-id: 20260521-dd-maint-2-76c542079420
Best regards,
--
Jim Cromie <[email protected]>