Linux Modules
 help / color / mirror / Atom feed
* [PATCH v3 00/24] dynamic-debug cleanups refactors maintenance + alignment fix
@ 2026-06-01 12:04 Jim Cromie
  2026-06-01 12:04 ` [PATCH v3 01/24] docs/dyndbg: update examples \012 to \n Jim Cromie
                   ` (23 more replies)
  0 siblings, 24 replies; 30+ messages in thread
From: Jim Cromie @ 2026-06-01 12:04 UTC (permalink / raw)
  To: Jonathan Corbet, Shuah Khan, Arnd Bergmann, Jason Baron,
	Luis Chamberlain, Petr Pavlu, Daniel Gomez, Sami Tolvanen,
	Aaron Tomlin, Andrew Morton, Shuah Khan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: linux-doc, linux-kernel, linux-arch, linux-modules,
	linux-kselftest, dri-devel, Jim Cromie, Louis Chauvet,
	Łukasz Bartosik

This series starts with 2 doc-only patches updating the current state
of dynamic-debug, they were posted separately here, without pushback.

https://lore.kernel.org/linux-doc/20260502-dyndbg-doc-v1-0-67cc4a93a77e@gmail.com/
    
Next 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.

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-25 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/20260504-dd-cleanups-2-v1-0-6fdd24040642@gmail.com/
    
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/20260515-asm-generic-1-v3-0-680b273666d4@gmail.com/
    
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
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/20260523-dd-maint-2-v2-0-b937312aa083@gmail.com

---
Jim Cromie (24):
      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
      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 +++---
 kernel/module/main.c                               |  12 +-
 lib/dynamic_debug.c                                | 501 ++++++++++-----------
 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     | 294 ++++++++++++
 16 files changed, 736 insertions(+), 437 deletions(-)
---
base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8
change-id: 20260521-dd-maint-2-76c542079420

Best regards,
-- 
Jim Cromie <jim.cromie@gmail.com>


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

end of thread, other threads:[~2026-06-01 12:28 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-01 12:04 [PATCH v3 00/24] dynamic-debug cleanups refactors maintenance + alignment fix Jim Cromie
2026-06-01 12:04 ` [PATCH v3 01/24] docs/dyndbg: update examples \012 to \n Jim Cromie
2026-06-01 12:04 ` [PATCH v3 02/24] docs/dyndbg: explain flags parse 1st Jim Cromie
2026-06-01 12:04 ` [PATCH v3 03/24] vmlinux.lds.h: refactor BOUNDED_SECTION_* macros into bounded_sections.lds.h Jim Cromie
2026-06-01 12:04 ` [PATCH v3 04/24] vmlinux.lds.h: drop unused HEADERED_SECTION* macros Jim Cromie
2026-06-01 12:04 ` [PATCH v3 05/24] vmlinux.lds.h: Fix ALIGN(8) omission causing NULL ptr on i386 Jim Cromie
2026-06-01 12:04 ` [PATCH v3 06/24] vmlinux.lds.h: remove redundant ALIGN(8) directives Jim Cromie
2026-06-01 12:04 ` [PATCH v3 07/24] dyndbg.lds.S: fix lost dyndbg sections in modules Jim Cromie
2026-06-01 12:04 ` [PATCH v3 08/24] dyndbg: factor ddebug_match_desc out from ddebug_change Jim Cromie
2026-06-01 12:04 ` [PATCH v3 09/24] dyndbg: add stub macro for DECLARE_DYNDBG_CLASSMAP Jim Cromie
2026-06-01 12:04 ` [PATCH v3 10/24] dyndbg: reword "class unknown," to "class:_UNKNOWN_" Jim Cromie
2026-06-01 12:04 ` [PATCH v3 11/24] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code Jim Cromie
2026-06-01 12:04 ` [PATCH v3 12/24] dyndbg: drop NUM_TYPE_ARGS Jim Cromie
2026-06-01 12:04 ` [PATCH v3 13/24] dyndbg: reduce verbose/debug clutter Jim Cromie
2026-06-01 12:16   ` sashiko-bot
2026-06-01 12:05 ` [PATCH v3 14/24] dyndbg: refactor param_set_dyndbg_classes and below Jim Cromie
2026-06-01 12:05 ` [PATCH v3 15/24] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap Jim Cromie
2026-06-01 12:05 ` [PATCH v3 16/24] dyndbg: replace classmap list with an array-slice Jim Cromie
2026-06-01 12:05 ` [PATCH v3 17/24] dyndbg: macrofy a 2-index for-loop pattern Jim Cromie
2026-06-01 12:05 ` [PATCH v3 18/24] dyndbg: Upgrade class param storage to u64 for 64-bit classmaps Jim Cromie
2026-06-01 12:20   ` sashiko-bot
2026-06-01 12:05 ` [PATCH v3 19/24] dyndbg,module: make proper substructs in _ddebug_info Jim Cromie
2026-06-01 12:20   ` sashiko-bot
2026-06-01 12:05 ` [PATCH v3 20/24] dyndbg: move mod_name down from struct ddebug_table to _ddebug_info Jim Cromie
2026-06-01 12:05 ` [PATCH v3 21/24] dyndbg: hoist classmap-filter-by-modname up to ddebug_add_module Jim Cromie
2026-06-01 12:05 ` [PATCH v3 22/24] selftests-dyndbg: add a dynamic_debug run_tests target Jim Cromie
2026-06-01 12:21   ` sashiko-bot
2026-06-01 12:05 ` [PATCH v3 23/24] dyndbg: change __dynamic_func_call_cls* macros into expressions Jim Cromie
2026-06-01 12:05 ` [PATCH v3 24/24] dynamic_debug: use KBUILD_MODFILE for unique builtin module names Jim Cromie
2026-06-01 12:28   ` sashiko-bot

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