Message ID | 20200821063043.1949509-1-elver@google.com |
---|---|
State | New |
Headers | show |
Series | random32: Use rcuidle variant for tracepoint | expand |
[ Late reply, due to Plumbers followed by a much needed vacation and then drowning in 3 weeks of unread email! ] On Fri, 21 Aug 2020 17:35:32 +0200 Marco Elver <elver@google.com> wrote: > So, if the _rcuidle() variant here doesn't break your usecase, there > should be no harm in using the _rcuidle() variant. This also lifts the > restriction on where prandom_u32() is usable to what it was before, > which should be any context. > > Steven, Peter: What's the downside to of _rcuidle()? _rcuidle() only has a slightly more overhead in the tracing path (it's no different when not tracing). There's not a issue with _rcuidle() itself. The issue is that we need to have it. We'd like it to be that rcu *is* watching always except for a very minimal locations when switching context (kernel to and from user and running to and from idle), and then we just don't let tracing or anything that needs rcu in those locations. But for your patch: Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> -- Steve
diff --git a/lib/random32.c b/lib/random32.c index 932345323af0..1c5607a411d4 100644 --- a/lib/random32.c +++ b/lib/random32.c @@ -83,7 +83,7 @@ u32 prandom_u32(void) u32 res; res = prandom_u32_state(state); - trace_prandom_u32(res); + trace_prandom_u32_rcuidle(res); put_cpu_var(net_rand_state); return res;
With KCSAN enabled, prandom_u32() may be called from any context, including idle CPUs. Therefore, switch to using trace_prandom_u32_rcuidle(), to avoid various issues due to recursion and lockdep warnings when KCSAN and tracing is enabled. Fixes: 94c7eb54c4b8 ("random32: add a tracepoint for prandom_u32()") Link: https://lkml.kernel.org/r/20200820155923.3d5c4873@oasis.local.home Suggested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Marco Elver <elver@google.com> Cc: Eric Dumazet <edumazet@google.com> Cc: Peter Zijlstra <peterz@infradead.org> --- lib/random32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)