linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] random32: Use rcuidle variant for tracepoint
@ 2020-08-21  6:30 Marco Elver
  2020-08-21  8:58 ` Marco Elver
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Marco Elver @ 2020-08-21  6:30 UTC (permalink / raw)
  To: elver
  Cc: linux-kernel, davem, kuba, netdev, Steven Rostedt, Eric Dumazet,
	Peter Zijlstra

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(-)

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;
-- 
2.28.0.297.g1956fa8f8d-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-10-09  8:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-21  6:30 [PATCH] random32: Use rcuidle variant for tracepoint Marco Elver
2020-08-21  8:58 ` Marco Elver
2020-08-21  8:59 ` peterz
2020-08-21 15:06   ` Eric Dumazet
2020-08-21 15:35     ` Marco Elver
2020-09-18  1:21       ` Steven Rostedt
2020-08-21 15:38     ` Steven Rostedt
2020-08-21 15:41       ` Steven Rostedt
2020-08-21 18:38         ` Peter Zijlstra
2020-10-09  7:58 ` [tip: locking/core] kcsan: Use tracing-safe version of prandom tip-bot2 for Marco Elver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).