public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v13 00/36] fix dynamic-debug classmaps regression for DRM
@ 2026-04-08 20:01 Jim Cromie
  2026-04-08 20:01 ` [PATCH v13 01/36] dyndbg: fix NULL ptr on i386 due to section mis-alignment Jim Cromie
                   ` (35 more replies)
  0 siblings, 36 replies; 37+ messages in thread
From: Jim Cromie @ 2026-04-08 20:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, jbaron, louis.chauvet, Jim Cromie

dynamic-debug classmaps in master is BROKEN for DRM, due to a design
error in DECLARE_DYNAMIC_DEBUG_ClASSMAP; its use in both drm-core and
drivers made multiple/redundant definitions of the classmap.  This led
to a regression enabling drm.debug at boot, on builtin drivers.

This patchset retires the macro, and replaces it with
DYNAMIC_DEBUG_ClASSMAP_DEFINE and DYNAMIC_DEBUG_ClASSMAP_USE.  1st is
invoked in drm-core, and defines the classmap, 2nd refers to that
exported definition, and is used in drivers and drm-helpers.

-v13 is a basically a -v12-resend, but:

1. Drops DRM's use of the new API; it can adopt them on its schedule.
   IOW it omits the 1-liner calls to DYNAMIC_DEBUG_CLASSMAP_USE().
   and a few other patches.
   
2. rewords 2 macro-invokes to verify validations on bad API uses.
   changed to better explain what is being tested and prevented.
   these are inactive unless compiled with -DDD_MACRO_ARGCHECK

3. includes patch from Philip Hahn to fix pr_fmt with 2+ terms
   this was also in v12.

-v12 
https://lore.kernel.org/lkml/20260326185413.1205870-1-jim.cromie@gmail.com/
had:

vmlinux.lds.h is refactored:
- BOUNDED_SECTION* macros are pulled into bounded_section.lds.h
- dynamic-debug sections are factored into dyndbg.lds.h,
  which reuses bounded_section.lds.h
- scripts/module.lds.S gets proper output sections for dyndbg
  this fixes lost sections seen in some setups
- based upon codetag.lds.h

DYNAMIC_DEBUG_CLASSMAP_USE*() is refined:
- previous had static class-map decl and unique names
- now have extern'd <classname>-<usermod> names, matching 1-per-module model
- now with compile-time offset check
- _USE/_USE_ together allows more squashing

better modprobe-time classmap definition error detection:
- test descriptors for unknown class-names
- more complete class-map/user conflict detection

rebased onto -rc5
- applies cleanly to drm-misc-fixes
- passes a few more tests on DRM-CI

include patch from Philipp Hahn <phahn-oss@avm.de>

clean subsystem chunks
- dyndbg 1st
- drm - fixes for DRM-CI, adapt,use new API, un-BROKEN
- drm/accel - least mature, I have no HW

-v11 is here
https://lore.kernel.org/lkml/20260313132103.2529746-1-jim.cromie@gmail.com/



Jim Cromie (35):
  dyndbg: fix NULL ptr on i386 due to section mis-alignment
  vmlinux.lds.h: move BOUNDED_SECTION_* macros to reuse later
  dyndbg.lds.S: fix lost dyndbg sections in modules
  vmlinux.lds.h: drop unused HEADERED_SECTION* macros
  dyndbg: factor ddebug_match_desc out from ddebug_change
  dyndbg: add stub macro for DECLARE_DYNDBG_CLASSMAP
  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,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
  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,USE_} 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_debug
  dyndbg: harden classmap and descriptor validation
  docs/dyndbg: add classmap info to howto

Philipp Hahn (1):
  dyndbg: Ignore additional arguments from pr_fmt

 .../admin-guide/dynamic-debug-howto.rst       | 184 +++-
 MAINTAINERS                                   |   3 +-
 include/asm-generic/bounded_sections.lds.h    |  21 +
 include/asm-generic/dyndbg.lds.h              |  26 +
 include/asm-generic/vmlinux.lds.h             |  48 +-
 include/linux/dynamic_debug.h                 | 309 +++++--
 kernel/module/main.c                          |  15 +-
 lib/Kconfig.debug                             |  24 +-
 lib/Makefile                                  |   5 +
 lib/dynamic_debug.c                           | 831 ++++++++++++------
 lib/test_dynamic_debug.c                      | 211 +++--
 lib/test_dynamic_debug_submod.c               |  21 +
 scripts/module.lds.S                          |   2 +
 tools/testing/selftests/Makefile              |   1 +
 .../testing/selftests/dynamic_debug/Makefile  |   9 +
 tools/testing/selftests/dynamic_debug/config  |   7 +
 .../dynamic_debug/dyndbg_selftest.sh          | 373 ++++++++
 17 files changed, 1595 insertions(+), 495 deletions(-)
 create mode 100644 include/asm-generic/bounded_sections.lds.h
 create mode 100644 include/asm-generic/dyndbg.lds.h
 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.53.0


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

end of thread, other threads:[~2026-04-08 20:02 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-08 20:01 [PATCH v13 00/36] fix dynamic-debug classmaps regression for DRM Jim Cromie
2026-04-08 20:01 ` [PATCH v13 01/36] dyndbg: fix NULL ptr on i386 due to section mis-alignment Jim Cromie
2026-04-08 20:01 ` [PATCH v13 02/36] vmlinux.lds.h: move BOUNDED_SECTION_* macros to reuse later Jim Cromie
2026-04-08 20:01 ` [PATCH v13 03/36] dyndbg.lds.S: fix lost dyndbg sections in modules Jim Cromie
2026-04-08 20:01 ` [PATCH v13 04/36] vmlinux.lds.h: drop unused HEADERED_SECTION* macros Jim Cromie
2026-04-08 20:01 ` [PATCH v13 05/36] dyndbg: factor ddebug_match_desc out from ddebug_change Jim Cromie
2026-04-08 20:01 ` [PATCH v13 06/36] dyndbg: add stub macro for DECLARE_DYNDBG_CLASSMAP Jim Cromie
2026-04-08 20:01 ` [PATCH v13 07/36] docs/dyndbg: update examples \012 to \n Jim Cromie
2026-04-08 20:01 ` [PATCH v13 08/36] docs/dyndbg: explain flags parse 1st Jim Cromie
2026-04-08 20:01 ` [PATCH v13 09/36] test-dyndbg: fixup CLASSMAP usage error Jim Cromie
2026-04-08 20:01 ` [PATCH v13 10/36] dyndbg: reword "class unknown," to "class:_UNKNOWN_" Jim Cromie
2026-04-08 20:01 ` [PATCH v13 11/36] dyndbg: make ddebug_class_param union members same size Jim Cromie
2026-04-08 20:01 ` [PATCH v13 12/36] dyndbg: drop NUM_TYPE_ARRAY Jim Cromie
2026-04-08 20:01 ` [PATCH v13 13/36] dyndbg: tweak pr_fmt to avoid expansion conflicts Jim Cromie
2026-04-08 20:01 ` [PATCH v13 14/36] dyndbg: reduce verbose/debug clutter Jim Cromie
2026-04-08 20:01 ` [PATCH v13 15/36] dyndbg: refactor param_set_dyndbg_classes and below Jim Cromie
2026-04-08 20:01 ` [PATCH v13 16/36] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap Jim Cromie
2026-04-08 20:01 ` [PATCH v13 17/36] dyndbg: replace classmap list with a vector Jim Cromie
2026-04-08 20:01 ` [PATCH v13 18/36] dyndbg: macrofy a 2-index for-loop pattern Jim Cromie
2026-04-08 20:01 ` [PATCH v13 19/36] dyndbg,module: make proper substructs in _ddebug_info Jim Cromie
2026-04-08 20:01 ` [PATCH v13 20/36] dyndbg: move mod_name down from struct ddebug_table to _ddebug_info Jim Cromie
2026-04-08 20:01 ` [PATCH v13 21/36] dyndbg: hoist classmap-filter-by-modname up to ddebug_add_module Jim Cromie
2026-04-08 20:01 ` [PATCH v13 22/36] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code Jim Cromie
2026-04-08 20:01 ` [PATCH v13 23/36] selftests-dyndbg: add a dynamic_debug run_tests target Jim Cromie
2026-04-08 20:01 ` [PATCH v13 24/36] dyndbg: change __dynamic_func_call_cls* macros into expressions Jim Cromie
2026-04-08 20:02 ` [PATCH v13 25/36] dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP Jim Cromie
2026-04-08 20:02 ` [PATCH v13 26/36] dyndbg: detect class_id reservation conflicts Jim Cromie
2026-04-08 20:02 ` [PATCH v13 27/36] dyndbg: check DYNAMIC_DEBUG_CLASSMAP_{DEFINE,USE_} args at compile-time Jim Cromie
2026-04-08 20:02 ` [PATCH v13 28/36] dyndbg-test: change do_prints testpoint to accept a loopct Jim Cromie
2026-04-08 20:02 ` [PATCH v13 29/36] dyndbg-API: promote DYNAMIC_DEBUG_CLASSMAP_PARAM to API Jim Cromie
2026-04-08 20:02 ` [PATCH v13 30/36] dyndbg: treat comma as a token separator Jim Cromie
2026-04-08 20:02 ` [PATCH v13 31/36] dyndbg: split multi-query strings with % Jim Cromie
2026-04-08 20:02 ` [PATCH v13 32/36] selftests-dyndbg: add test_mod_submod Jim Cromie
2026-04-08 20:02 ` [PATCH v13 33/36] dyndbg: resolve "protection" of class'd pr_debug Jim Cromie
2026-04-08 20:02 ` [PATCH v13 34/36] dyndbg: harden classmap and descriptor validation Jim Cromie
2026-04-08 20:02 ` [PATCH v13 35/36] docs/dyndbg: add classmap info to howto Jim Cromie
2026-04-08 20:02 ` [PATCH v13 36/36] dyndbg: Ignore additional arguments from pr_fmt Jim Cromie

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