[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1851876075.21840.1583779960064.JavaMail.zimbra@efficios.com>
Date: Mon, 9 Mar 2020 14:52:40 -0400 (EDT)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: rostedt <rostedt@...dmis.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
linux-kernel <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
paulmck <paulmck@...nel.org>,
"Joel Fernandes, Google" <joel@...lfernandes.org>,
Frederic Weisbecker <frederic@...nel.org>
Subject: Re: Instrumentation and RCU
----- On Mar 9, 2020, at 2:44 PM, rostedt rostedt@...dmis.org wrote:
> On Mon, 9 Mar 2020 14:37:40 -0400 (EDT)
> Mathieu Desnoyers <mathieu.desnoyers@...icios.com> wrote:
>
>> So I think we could go back to plain RCU for rcuidle tracepoints if we do
>> the cheaper "rcu_is_watching()" check rather than invoking
>> rcu_irq_{enter,exit}_irqson() unconditionally.
>
> You mean something like this?
I have a hard time applying this patch to any tree I can fetch, so
I will use caution and say: probably not. ;-)
And when I say "go back to plain RCU", I really mean removing use of SRCU
from the tracepoints until we have other purposes for it (e.g. taking
faults within specific tracepoint probes such as syscall enter/exit).
Thanks,
Mathieu
>
> -- Steve
>
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 5f4de82ffa0f..1904dbb3a921 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -164,7 +164,7 @@ static inline struct tracepoint
> *tracepoint_ptr_deref(tracepoint_ptr_t *p)
> struct tracepoint_func *it_func_ptr; \
> void *it_func; \
> void *__data; \
> - int __maybe_unused __idx = 0; \
> + int __maybe_unused __idx = -1; \
> \
> if (!(cond)) \
> return; \
> @@ -179,8 +179,8 @@ static inline struct tracepoint
> *tracepoint_ptr_deref(tracepoint_ptr_t *p)
> * For rcuidle callers, use srcu since sched-rcu \
> * doesn't work from the idle path. \
> */ \
> - if (rcuidle) \
> - __idx = srcu_read_lock_notrace(&tracepoint_srcu);\
> + if (rcuidle && !rcu_is_watching()) \
> + __idx = srcu_read_lock_notrace(&tracepoint_srcu); \
> \
> it_func_ptr = rcu_dereference_raw((tp)->funcs); \
> \
> @@ -199,7 +199,7 @@ static inline struct tracepoint
> *tracepoint_ptr_deref(tracepoint_ptr_t *p)
> } while ((++it_func_ptr)->func); \
> } \
> \
> - if (rcuidle) \
> + if (rcuidle && __idx != -1) \
> rcu_irq_exit_irqson(); \
> \
> preempt_enable_notrace(); \
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists