From: Jim Cromie via B4 Relay <devnull+jim.cromie.gmail.com@kernel.org>
To: Jason Baron <jbaron@akamai.com>, Shuah Khan <shuah@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>, Arnd Bergmann <arnd@arndb.de>,
Luis Chamberlain <mcgrof@kernel.org>,
Petr Pavlu <petr.pavlu@suse.com>,
Daniel Gomez <da.gomez@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>,
Aaron Tomlin <atomlin@atomlin.com>,
Jonathan Corbet <corbet@net.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nsc@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Pavel Machek <pavel@kernel.org>, Len Brown <lenb@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-arch@vger.kernel.org,
linux-modules@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kbuild@vger.kernel.org, linux-pm@vger.kernel.org,
Jim Cromie <jim.cromie@gmail.com>
Subject: [PATCH v10 14/38] dyndbg: Bind callsites and classmaps to DDEBUG_MODNAME
Date: Wed, 16 Sep 2026 09:33:06 -0600 [thread overview]
Message-ID: <20260916-dd-cmap-part2-clean-v10-14-af4cf4767707@gmail.com> (raw)
In-Reply-To: <20260916-dd-cmap-part2-clean-v10-0-af4cf4767707@gmail.com>
From: Jim Cromie <jim.cromie@gmail.com>
Currently, dyndbg binds KBUILD_MODNAME directly into callsite and
classmap declarator macros.
For built-ins, KBUILD_MODNAME defaults to the basename of the source
file. For many subsystems, this fragments what should be a single
module into separate file basenames: kernel/power/ produces "main",
"suspend", "hibernate", "snapshot", and "swap" when all should be
"power". Conversely, multiple unrelated built-in files across the tree
(init/main.c, kernel/power/main.c) all collide under "main".
While consolidating these fragments into unified subsystem names is
desirable for query targeting and classmaps, attempting a bulk heuristic
renaming across Kbuild introduces broad churn and disrupts control file
output across the kernel. Module naming should remain under explicit
maintainer control instead.
Define DDEBUG_MODNAME in include/linux/dynamic_debug.h guarded with
#ifndef, defaulting cleanly to KBUILD_MODNAME. Bind DDEBUG_MODNAME into
callsite and classmap declarator macros instead of hardcoding
KBUILD_MODNAME.
This establishes an opt-in hook allowing subsystem maintainers to
consolidate their module fragments if desired (e.g. via
ccflags-y += -DDDEBUG_MODNAME='"power"' in a subsystem Makefile)
while preserving existing module-name invariants by default.
What's Unchanged:
- Default module names remain strictly identical to KBUILD_MODNAME.
- Zero callsite memory overhead or layout changes in struct _ddebug.
- dynamic_debug/control output remains unchanged across the tree.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
include/linux/dynamic_debug.h | 12 +++++++--
.../selftests/dynamic_debug/dyndbg_selftest.sh | 29 +++++++++++-----------
2 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index baf5c0853f45..85863e24ad13 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -10,6 +10,14 @@
#define __DDEBUG_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+/*
+ * DDEBUG_MODNAME: Subsystem/module name hook for callsites and classmaps.
+ * Defaults to KBUILD_MODNAME.
+ */
+#ifndef DDEBUG_MODNAME
+#define DDEBUG_MODNAME KBUILD_MODNAME
+#endif
+
/*
* An instance of this structure is created in a special
* ELF section at every dynamic debug callsite. At runtime,
@@ -121,7 +129,7 @@ struct ddebug_class_param {
static struct ddebug_class_map __aligned(8) __used \
__section("__dyndbg_classes") _var = { \
.mod = THIS_MODULE, \
- .mod_name = KBUILD_MODNAME, \
+ .mod_name = DDEBUG_MODNAME, \
.base = _base, \
.map_type = _maptype, \
.class_names = _var##_classnames, \
@@ -160,7 +168,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
#define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt) \
static struct _ddebug __aligned(8) \
__section("__dyndbg") name = { \
- .modname = KBUILD_MODNAME, \
+ .modname = DDEBUG_MODNAME, \
.function = __func__, \
.filename = __FILE__, \
.format = (fmt), \
diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
index 972f12c70a8e..09a8dbf239dc 100755
--- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
+++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
@@ -267,34 +267,35 @@ function FT_grammar_errs {
ddcmd =_
}
-# these queries run against the builtin module: params, and change
-# flags. The control file state-of-interest is found by path,
-# kernel/params.c, to avoid module keyword entirely
+# these queries run against the builtin file: kernel/params.c, and change
+# flags. The control file state-of-interest is found by path $f,
+# perfectly binding the stimulus scope to the observation slice.
function FT_basic_queries {
v_echo "${GREEN}# BASIC_TESTS ${NC}"
if [ $LACK_DD_BUILTIN -eq 1 ]; then
- echo "SKIP - test requires params, which is a builtin module"
+ echo "SKIP - test requires dynamic_debug built into kernel"
return
fi
+ local f='kernel/params.c'
ddcmd =_ # zero everything
- ddcmd "module params +mf" 'kernel/params.c'
- ddcmd "module params +l" 'kernel/params.c'
- ddcmd "module params -m" 'kernel/params.c'
- ddcmd "module params =_" 'kernel/params.c'
+ ddcmd "file $f +mf" "$f"
+ ddcmd "file $f +l" "$f"
+ ddcmd "file $f -m" "$f"
+ ddcmd "file $f =_" "$f"
# multi-query commands split on ; on a single line
- ddcmd "module params +mf ; module params func parse_args +sl" 'kernel/params.c'
+ ddcmd "file $f +mf ; file $f func parse_args +sl" "$f"
# verify multi-cmd input, newline separated, with embedded comments
ddcmd =_ # reset before multiline query to capture full transition
- ddcmd "module params =_ # clear params
- module params +ml # set flags
- module params func parse_args +fs # set other flags" \
- 'kernel/params.c'
+ ddcmd "file $f =_ # clear params
+ file $f +ml # set flags
+ file $f func parse_args +fs # set other flags" \
+ "$f"
# clear flags and verify
- ddcmd "module params =_" 'kernel/params.c'
+ ddcmd "file $f =_" "$f"
}
# Built-in Feature Tests (Can run on any CONFIG_DYNAMIC_DEBUG kernel, modular or monolithic)
--
2.55.0
next prev parent reply other threads:[~2026-09-16 15:33 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 15:32 [PATCH v10 00/38] dyndbg: Fix classmaps API for subsystems, query extensions, selftests Jim Cromie via B4 Relay
2026-09-16 15:32 ` [PATCH v10 01/38] selftests/dyndbg: Add kselftest script to verify dynamic-debug Jim Cromie via B4 Relay
2026-09-16 15:32 ` [PATCH v10 02/38] vmlinux.lds.h: refactor BOUNDED_SECTION_* macros into bounded_sections.lds.h Jim Cromie via B4 Relay
2026-09-16 15:32 ` [PATCH v10 03/38] vmlinux.lds.h: drop unused HEADERED_SECTION* macros Jim Cromie via B4 Relay
2026-09-16 15:32 ` [PATCH v10 04/38] vmlinux.lds.h: Fix ALIGN(8) omission causing NULL ptr on i386 Jim Cromie via B4 Relay
2026-09-16 15:32 ` [PATCH v10 05/38] vmlinux.lds.h: remove redundant ALIGN(8) directives Jim Cromie via B4 Relay
2026-09-16 15:32 ` [PATCH v10 06/38] dyndbg.lds.S: fix lost dyndbg sections in modules Jim Cromie via B4 Relay
2026-09-16 15:32 ` [PATCH v10 07/38] dyndbg: factor ddebug_match_desc out from ddebug_change Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 08/38] dyndbg: add stub macro for DECLARE_DYNDBG_CLASSMAP Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 09/38] dyndbg: reword "class unknown," to "class:_UNKNOWN_" Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 10/38] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 11/38] dyndbg: drop NUM_TYPE_ARGS Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 12/38] dyndbg: bump num-tokens in a query-cmd from 9 to 15 Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 13/38] dyndbg: reduce verbose/debug clutter Jim Cromie via B4 Relay
2026-09-16 15:33 ` Jim Cromie via B4 Relay [this message]
2026-09-16 15:33 ` [PATCH v10 15/38] dyndbg: refactor param_set_dyndbg_classes and below Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 16/38] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 17/38] dyndbg: replace classmap list with an array-slice Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 18/38] dyndbg: macrofy a 2-index for-loop pattern Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 19/38] dyndbg: reduce class param storage to u32 Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 20/38] dyndbg,module: make proper substructs in _ddebug_info Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 21/38] dyndbg: move mod_name down from struct ddebug_table to _ddebug_info Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 22/38] dyndbg: hoist classmap-filter-by-modname up to ddebug_add_module Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 23/38] dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 24/38] selftests/dyndbg: Enable FT_classmap_inheritance Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 25/38] dyndbg: detect class_id reservation conflicts Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 26/38] dyndbg: check DYNAMIC_DEBUG_CLASSMAP_{DEFINE,USE_} args at compile-time Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 27/38] dyndbg-test: add do_bulk testpoint, rename do_prints to do_classes Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 28/38] dyndbg-API: promote DYNAMIC_DEBUG_CLASSMAP_PARAM to API Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 29/38] dyndbg: control-parser: treat comma as a token separator Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 30/38] selftests: enable comma-terminator tests Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 31/38] dyndbg: split multi-query strings with @ Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 32/38] dyndbg: resolve "protection" of class'd pr_debug Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 33/38] dyndbg: harden classmap and descriptor validation Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 34/38] docs/dyndbg: add classmap info to howto Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 35/38] dyndbg: Ignore additional arguments from pr_fmt Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 36/38] dyndbg: add epilogue to dynamic_debug/control file Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 37/38] dyndbg: add +c flag to count advantage of classmaps for DRM Jim Cromie via B4 Relay
2026-09-16 15:33 ` [PATCH v10 38/38] dyndbg: add DEBUG-biased fallback stubs for _dynamic_func_call_cls Jim Cromie via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260916-dd-cmap-part2-clean-v10-14-af4cf4767707@gmail.com \
--to=devnull+jim.cromie.gmail.com@kernel.org \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=atomlin@atomlin.com \
--cc=corbet@net.net \
--cc=da.gomez@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=jbaron@akamai.com \
--cc=jim.cromie@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mcgrof@kernel.org \
--cc=mripard@kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=pavel@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=rafael@kernel.org \
--cc=rdunlap@infradead.org \
--cc=samitolvanen@google.com \
--cc=shuah@kernel.org \
--cc=simona@ffwll.ch \
--cc=skhan@linuxfoundation.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®