[PATCH v4 13/25] dyndbg: reduce verbose/debug clutter
From: Jim Cromie <jim.cromie@gmail.com>
Date: 2026-06-02 22:48:51
Also in:
dri-devel, linux-arch, linux-doc, linux-kselftest, lkml
Subsystem:
dynamic debug, library code, the rest · Maintainers:
Jason Baron, Jim Cromie, Andrew Morton, Linus Torvalds
currently, for verbose=3, these are logged (blank lines for clarity):
dyndbg: query 0: "class DRM_UT_CORE +p" mod:*
dyndbg: split into words: "class" "DRM_UT_CORE" "+p"
dyndbg: op='+'
dyndbg: flags=0x1
dyndbg: *flagsp=0x1 *maskp=0xffffffff
dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=...
dyndbg: no matches for query
dyndbg: no-match: func="" file="" module="" format="" lineno=0-0 class=...
dyndbg: processed 1 queries, with 0 matches, 0 errs
That is excessive, so this patch:
- shrinks 3 lines of 2nd stanza to single line
- drops 1st 2 lines of 3rd stanza
3rd line is like 1st, with result, not procedure.
2nd line is just status, retold in 4th, with more info.
New output:
dyndbg: query 0: "class DRM_UT_CORE +p"
dyndbg: split into words: "class" "DRM_UT_CORE" "+p"
dyndbg: op='+' flags=0x1 maskp=0xffffffff
dyndbg: processed 1 queries, with 0 matches, 0 errs
Also drop several verbose=3 messages in ddebug_add_module
When modprobing a module, dyndbg currently logs/says "add-module", and
then "skipping" if the module has no prdbgs. Instead just check 1st
and return quietly.
no functional change
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
v4: rename vpr_dq_info to v3pr_dq_info to tell its active logging level
adjust some vX levels per doc'd intentions
v2: RvB after SoB
trivial change to verbose-debug output line to output the actual
"module" keyword rather than "mod:", and do so only when the module is
constrained by the callchain (ie as part of a modprobe).
was: query X: "(keyword value)* [+-=]flags" mod:*
now: query X: "(keyword value)* [+-=]flags"
or query X: module FOO "keyword value)* [+-=]flags"
IOW, adjust output to reflect the input grammar more closely.
drop-info-parsed
vinfo-applied-nomatch
dyndbg: tweak verbose-levels per doc
---
lib/dynamic_debug.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 0377d9f8dcd1..a967e3ef1dbc 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c@@ -128,7 +128,7 @@ do { \ #define v3pr_info(fmt, ...) vnpr_info(3, fmt, ##__VA_ARGS__) #define v4pr_info(fmt, ...) vnpr_info(4, fmt, ##__VA_ARGS__) -static void vpr_info_dq(const struct ddebug_query *query, const char *msg) +static void v3pr_info_dq(const struct ddebug_query *query, const char *msg) { /* trim any trailing newlines */ int fmtlen = 0;
@@ -276,9 +276,6 @@ static int ddebug_change(const struct ddebug_query *query, } mutex_unlock(&ddebug_lock); - if (!nfound && verbose) - pr_info("no matches for query\n"); - return nfound; }
@@ -487,7 +484,6 @@ static int ddebug_parse_query(char *words[], int nwords, */ query->module = modname; - vpr_info_dq(query, "parsed"); return 0; }
@@ -511,7 +507,6 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) pr_err("bad flag-op %c, at start of %s\n", *str, str); return -EINVAL; } - v3pr_info("op='%c'\n", op); for (; *str ; ++str) { for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) {
@@ -525,7 +520,6 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) return -EINVAL; } } - v3pr_info("flags=0x%x\n", modifiers->flags); /* calculate final flags, mask based upon op */ switch (op) {
@@ -541,7 +535,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) modifiers->flags = 0; break; } - v3pr_info("*flagsp=0x%x *maskp=0x%x\n", modifiers->flags, modifiers->mask); + v3pr_info("op='%c' flags=0x%x maskp=0x%x\n", op, modifiers->flags, modifiers->mask); return 0; }
@@ -570,7 +564,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) } /* actually go and implement the change */ nfound = ddebug_change(&query, &modifiers); - vpr_info_dq(&query, nfound ? "applied" : "no-match"); + v3pr_info_dq(&query, nfound ? "applied" : "no-match"); return nfound; }
@@ -593,7 +587,10 @@ static int ddebug_exec_queries(char *query, const char *modname) if (!query || !*query || *query == '#') continue; - vpr_info("query %d: \"%s\" mod:%s\n", i, query, modname ?: "*"); + if (modname) + v2pr_info("query %d: module %s \"%s\"\n", i, modname, query); + else + v2pr_info("query %d: \"%s\"\n", i, query); rc = ddebug_exec_query(query, modname); if (rc < 0) {
@@ -1159,11 +1156,10 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname) { struct ddebug_table *dt; - v3pr_info("add-module: %s.%d sites\n", modname, di->num_descs); - if (!di->num_descs) { - v3pr_info(" skip %s\n", modname); + if (!di->num_descs) return 0; - } + + v3pr_info("add-module: %s %d sites\n", modname, di->num_descs); dt = kzalloc_obj(*dt); if (dt == NULL) {
--
2.54.0