lkml.org 
[lkml]   [2022]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -printk] printk, tracing: fix console tracepoint
On Thu 2022-07-14 11:17:49, Steven Rostedt wrote:
> Although printk is not really a fast path, you could do this and avoid the
> check when the trace event is not active:
>
> (Not even compiled tested)
>
> Tweaked the comment, and used raw_smp_processor_id() as I'm not sure we are
> in a preempt disabled context, and we don't care if we are not.

Makes sense.

> diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h
> index 13d405b2fd8b..d0a5f63920bb 100644
> --- a/include/trace/events/printk.h
> +++ b/include/trace/events/printk.h
> @@ -7,11 +7,20 @@
>
> #include <linux/tracepoint.h>
>
> -TRACE_EVENT(console,
> +TRACE_EVENT_CONDITION(console,
> TP_PROTO(const char *text, size_t len),
>
> TP_ARGS(text, len),
>
> + /*
> + * trace_console_rcuidle() is not working in NMI. printk()
> + * is used more often in NMI than in rcuidle context.
> + * Choose the less evil solution here.
> + *
> + * raw_smp_processor_id() is reliable in rcuidle context.
> + */
> + TP_CONDITION(!rcu_is_idle_cpu(raw_smp_processor_id())),
> +
> TP_STRUCT__entry(
> __dynamic_array(char, msg, len + 1)
> ),

It looks better. I am going to test it and send as a proper patch
for review.

Thanks for help.

Best Regards,
Petr

\
 
 \ /
  Last update: 2022-07-15 11:40    [W:0.069 / U:0.968 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site