This should work: echo module=amd* format=^[IF_TRACE]: +p >/proc/dynamic_debug/control
consider drivers/gpu/drm/amd/display/include/logger_types.h: It has 11 defines like: #define DC_LOG_IF_TRACE(...) pr_debug("[IF_TRACE]:"__VA_ARGS__) These defines are used 804 times at recent count; they are a perfect test case to leverage existing format-message based classifications of *pr_debug*. Those macros prefix the supplied message with a fixed string, Id expect nearly all existing classification schemes to do so. Hence we want to be able to anchor our match to the beginning of the format string, so ddebug_exec_queries() can be more exact. This gives easier contruction of reliable queries to enable/disable those callsites. This makes no attempt at wider regex features, just the one we need. Since this is a corner-case of sorts, lets examine one more, hidden in the example above; note the "module=amd*" query term. // normal usage ddebug_exec_queries("format=^[IF_TRACE]: +p", MODULE) // wildcard 1 ddebug_exec_queries("module=amd* format=^[IF_TRACE]: +p", NULL) // wildcard 2 ddebug_exec_queries("format=^[IF_TRACE]: +p", "amd*") Now, I doubt that "amd*" is useful here, but I dont see a reason to preclude it; multiple modules with coordinated classifcation schemes is reasonable. That said, a single call can have multiple queries, each with an exact module name. I also see little reason to prefer either of forms 1 or 2. Its case-by-case, judging brevity, clarity, and query specificity and robustness. Signed-off-by: Jim Cromie <jim.cro...@gmail.com> --- lib/dynamic_debug.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index b00f536d6d12..d737c733967a 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -176,9 +176,15 @@ static int ddebug_change(const struct ddebug_query *query, continue; /* match against the format */ - if (query->format && - !strstr(dp->format, query->format)) - continue; + if (query->format) { + if (*query->format == '^') { + /* anchored search. match must be at beginning */ + char *p = strstr(dp->format, query->format+1); + if (p != dp->format) + continue; + } else if (!strstr(dp->format, query->format)) + continue; + } /* match against the line number range */ if (query->first_lineno && -- 2.26.2