Commit 685b64e4 authored by Chuang Wang's avatar Chuang Wang Committed by Steven Rostedt (Google)

tracing/osnoise: Use built-in RCU list checking

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.

Link: https://lkml.kernel.org/r/20221227023036.784337-1-nashuiliang@gmail.com

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Fixes: dae18134 ("tracing/osnoise: Support a list of trace_array *tr")
Acked-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: default avatarChuang Wang <nashuiliang@gmail.com>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent ac28d0a0
...@@ -147,9 +147,8 @@ static void osnoise_unregister_instance(struct trace_array *tr) ...@@ -147,9 +147,8 @@ static void osnoise_unregister_instance(struct trace_array *tr)
* register/unregister serialization is provided by trace's * register/unregister serialization is provided by trace's
* trace_types_lock. * trace_types_lock.
*/ */
lockdep_assert_held(&trace_types_lock); list_for_each_entry_rcu(inst, &osnoise_instances, list,
lockdep_is_held(&trace_types_lock)) {
list_for_each_entry_rcu(inst, &osnoise_instances, list) {
if (inst->tr == tr) { if (inst->tr == tr) {
list_del_rcu(&inst->list); list_del_rcu(&inst->list);
found = 1; found = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment