[PATCH v11 05/19] dyndbg: add desc, dev fields to event record
Jim Cromie
jim.cromie at gmail.com
Fri Jan 7 05:29:28 UTC 2022
commit:HEAD~1 added pr_debug(), dev_dbg() params to the new events,
but didn't actually capture the params. Do that now; add the other
TP_* parts: __fields, fast-assign, and printk elements for the
desccriptor and device params.
The message capture part is copied from printk:console, it gets the
whole message, including dyndbg's prefixing: the dev_name() etc, the
optional module:function:line decorations, and the trailing newline
(which is trimmed).
dyndbg->trace-events must be enabled on both sides:
in tracefs: echo 1 > /sys/kernel/tracing/events/dyndbg/enable
in dyndbg: echo module drm +T > /proc/dynamic_debug/control
This is good; it gives 2 orthogonal cuts at trace traffic, dyndbg can
enable callsites indvidually, tracefs can (in principle) filter and
trigger on the incoming event stream.
ATM, TP_print adds "__entry->desc->{modname,function}", which is
redundant with +Tmf enabled callsites.
RFC
Perhaps the whole decorations/prefix should be excluded from the event
capture ? Vincent's skip-past-KERN_DEBUG trick could be extended to
skip part or all of the prefix, and leave the "decorating" of events
solely to TP_printk. Whats the right separation of concerns ?
NB: __entry->desc is a pointer into kernel .data, a pretty stable
reference, at least while the kernel is running.
Signed-off-by: Jim Cromie <jim.cromie at gmail.com>
---
include/trace/events/dyndbg.h | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/include/trace/events/dyndbg.h b/include/trace/events/dyndbg.h
index 82620b10e968..2ac296cb451c 100644
--- a/include/trace/events/dyndbg.h
+++ b/include/trace/events/dyndbg.h
@@ -14,10 +14,12 @@ TRACE_EVENT(prdbg,
TP_ARGS(desc, text, len),
TP_STRUCT__entry(
+ __field(const struct _ddebug *, desc)
__dynamic_array(char, msg, len + 1)
),
TP_fast_assign(
+ __entry->desc = desc;
/*
* Each trace entry is printed in a new line.
* If the msg finishes with '\n', cut it off
@@ -30,8 +32,8 @@ TRACE_EVENT(prdbg,
__get_str(msg)[len] = 0;
),
- TP_printk("%s", __get_str(msg))
-
+ TP_printk("%s.%s %s", __entry->desc->modname,
+ __entry->desc->function, __get_str(msg))
);
/* capture dev_dbg() callsite descriptor, device, and message */
@@ -42,10 +44,14 @@ TRACE_EVENT(devdbg,
TP_ARGS(desc, dev, text, len),
TP_STRUCT__entry(
+ __field(const struct _ddebug *, desc)
+ __field(const struct device *, dev)
__dynamic_array(char, msg, len + 1)
),
TP_fast_assign(
+ __entry->desc = desc;
+ __entry->dev = (struct device *) dev;
/*
* Each trace entry is printed in a new line.
* If the msg finishes with '\n', cut it off
@@ -58,7 +64,8 @@ TRACE_EVENT(devdbg,
__get_str(msg)[len] = 0;
),
- TP_printk("%s", __get_str(msg))
+ TP_printk("%s.%s %s", __entry->desc->modname,
+ __entry->desc->function, __get_str(msg))
);
#endif /* _TRACE_DYNDBG_H */
--
2.33.1
More information about the amd-gfx
mailing list