mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tracing/osnoise: Use built-in RCU list checking
@ 2022-12-27  2:30 Chuang Wang
  2023-01-11  9:54 ` Daniel Bristot de Oliveira
  0 siblings, 1 reply; 2+ messages in thread
From: Chuang Wang @ 2022-12-27  2:30 UTC (permalink / raw)
  Cc: Chuang Wang, Steven Rostedt, Daniel Bristot de Oliveira,
	Masami Hiramatsu, linux-kernel

list_for_each_entry_rcu() has built-in RCU and lock checking.

Pass cond argument to list_for_each_entry_rcu() to silence false lockdep
warning when CONFIG_PROVE_RCU_LIST is enabled.

Execute as follow:

 [tracing]# echo osnoise > current_tracer
 [tracing]# echo 1 > tracing_on
 [tracing]# echo 0 > tracing_on

The trace_types_lock is held when osnoise_tracer_stop() or
timerlat_tracer_stop() are called in the non-RCU read side section.
So, pass lockdep_is_held(&trace_types_lock) to silence false lockdep
warning.

Fixes: dae181349f1e ("tracing/osnoise: Support a list of trace_array *tr")
Signed-off-by: Chuang Wang <nashuiliang@gmail.com>
---
 kernel/trace/trace_osnoise.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 94c1b5eb1dc0..210e1f168392 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -147,9 +147,8 @@ static void osnoise_unregister_instance(struct trace_array *tr)
 	 * register/unregister serialization is provided by trace's
 	 * trace_types_lock.
 	 */
-	lockdep_assert_held(&trace_types_lock);
-
-	list_for_each_entry_rcu(inst, &osnoise_instances, list) {
+	list_for_each_entry_rcu(inst, &osnoise_instances, list,
+				lockdep_is_held(&trace_types_lock)) {
 		if (inst->tr == tr) {
 			list_del_rcu(&inst->list);
 			found = 1;
-- 
2.37.2


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

* Re: [PATCH] tracing/osnoise: Use built-in RCU list checking
  2022-12-27  2:30 [PATCH] tracing/osnoise: Use built-in RCU list checking Chuang Wang
@ 2023-01-11  9:54 ` Daniel Bristot de Oliveira
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Bristot de Oliveira @ 2023-01-11  9:54 UTC (permalink / raw)
  To: Chuang Wang; +Cc: Steven Rostedt, Masami Hiramatsu, linux-kernel

On 12/27/22 03:30, Chuang Wang wrote:
> list_for_each_entry_rcu() has built-in RCU and lock checking.
> 
> Pass cond argument to list_for_each_entry_rcu() to silence false lockdep
> warning when CONFIG_PROVE_RCU_LIST is enabled.
> 
> Execute as follow:
> 
>  [tracing]# echo osnoise > current_tracer
>  [tracing]# echo 1 > tracing_on
>  [tracing]# echo 0 > tracing_on
> 
> The trace_types_lock is held when osnoise_tracer_stop() or
> timerlat_tracer_stop() are called in the non-RCU read side section.
> So, pass lockdep_is_held(&trace_types_lock) to silence false lockdep
> warning.
> 
> Fixes: dae181349f1e ("tracing/osnoise: Support a list of trace_array *tr")
> Signed-off-by: Chuang Wang <nashuiliang@gmail.com>

Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>

Thanks!
-- Daniel

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

end of thread, other threads:[~2023-01-11  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-27  2:30 [PATCH] tracing/osnoise: Use built-in RCU list checking Chuang Wang
2023-01-11  9:54 ` Daniel Bristot de Oliveira

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®