Commit 701850d
printk, tracing: fix console tracepoint
The original intent of the 'console' tracepoint per the commit 9510035
("printk/tracing: Add console output tracing") had been to "[...] record
any printk messages into the trace, regardless of the current console
loglevel. This can help correlate (existing) printk debugging with other
tracing."
Petr points out [1] that calling trace_console_rcuidle() in
call_console_driver() had been the wrong thing for a while, because
"printk() always used console_trylock() and the message was flushed to
the console only when the trylock succeeded. And it was always deferred
in NMI or when printed via printk_deferred()."
With the commit 09c5ba0 ("printk: add kthread console printers"),
things only got worse, and calls to call_console_driver() no longer
happen with typical printk() calls but always appear deferred [2].
As such, the tracepoint can no longer serve its purpose to clearly
correlate printk() calls and other tracing, as well as breaks usecases
that expect every printk() call to result in a callback of the console
tracepoint. Notably, the KFENCE and KCSAN test suites, which want to
capture console output and assume a printk() immediately gives us a
callback to the console tracepoint.
Fix the console tracepoint by moving it into printk_sprint() [3].
One notable difference is that by moving tracing into printk_sprint(),
the 'text' will no longer include the "header" (loglevel and timestamp),
but only the raw message. Arguably this is less of a problem now that
the console tracepoint happens on the printk() call and isn't delayed.
Link: https://lore.kernel.org/all/Ym+WqKStCg%2FEHfh3@alley/ [1]
Link: https://lore.kernel.org/all/CA+G9fYu2kS0wR4WqMRsj2rePKV9XLgOU1PiXnMvpT+Z=c2ucHA@mail.gmail.com/ [2]
Link: https://lore.kernel.org/all/[email protected]/ [3]
Reported-by: Linux Kernel Functional Testing <[email protected]>
Signed-off-by: Marco Elver <[email protected]>
Cc: John Ogness <[email protected]>
Cc: Petr Mladek <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Acked-by: John Ogness <[email protected]>
Acked-by: Steven Rostedt (Google) <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]1 parent ab40681 commit 701850d
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2064 | 2064 | | |
2065 | 2065 | | |
2066 | 2066 | | |
2067 | | - | |
2068 | | - | |
2069 | 2067 | | |
2070 | 2068 | | |
2071 | 2069 | | |
| |||
2240 | 2238 | | |
2241 | 2239 | | |
2242 | 2240 | | |
| 2241 | + | |
| 2242 | + | |
2243 | 2243 | | |
2244 | 2244 | | |
2245 | 2245 | | |
| |||
0 commit comments