Skip to content

Commit

Permalink
lisa.trace: Restrict trace_printk@myevent supported events
Browse files Browse the repository at this point in the history
In order to support trace_printk meta events more easily in upcoming
parsers, restrict the format that is accepted so that:

* the format string is only used to infer the format of the event
* the variable arguments buffer is used for the values
* we must get a bprint, not bputs event
  • Loading branch information
douglas-raillard-arm committed Jan 8, 2024
1 parent 205c6d4 commit 69add1b
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions lisa/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -4010,23 +4010,31 @@ def df_event(self, event, raw=None, window=None, signals=None, signals_init=True
In addition to actual events, the following formats for meta events
are supported:
* ``trace_printk@``: the event will be assumed to be embedded in
textual form inside the field of another event as a string,
typically emitted using the ``trace_printk()`` kernel function:
* ``trace_printk@``: The event format is described by the
``bprint`` event format string, and the field values are decoded
from the variable arguments buffer. Note that:
* The field values *must* be in the buffer, i.e. the format
string is only used as the event format, no "literal value"
will be extracted from it.
* The event *must* have fields. If not, ``trace_printk()``
will emit a bputs event that will be ignored at the moment.
We need to get a bprint event.
.. code-block:: C
// trace.df_event('trace_printk@event')
// trace.df_event('trace_printk@myevent')
void foo(void) {
trace_printk("event: field1=foo field2=42");
trace_printk("myevent: field1=%s field2=%i", "foo", 42);
}
* ``userspace@``: the event is generated by userspace:
.. code-block:: shell
# trace.df_event('userspace@event')
echo "event: field1=foo field2=42" > /sys/kernel/debug/tracing/trace_marker
# trace.df_event('userspace@myevent')
echo "myevent: field1=foo field2=42" > /sys/kernel/debug/tracing/trace_marker
.. note:: All meta event names are expected to be valid C language
identifiers. Usage of other characters will prevent correct
Expand Down

0 comments on commit 69add1b

Please sign in to comment.