public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Daniel Bristot de Oliveira <bristot@kernel.org>,
	Chuang Wang <nashuiliang@gmail.com>
Subject: [for-linus][PATCH 05/11] tracing/osnoise: Use built-in RCU list checking
Date: Wed, 25 Jan 2023 11:18:29 -0500	[thread overview]
Message-ID: <20230125162010.631776115@goodmis.org> (raw)
In-Reply-To: 20230125161824.332648375@goodmis.org

From: Chuang Wang <nashuiliang@gmail.com>

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: dae181349f1e ("tracing/osnoise: Support a list of trace_array *tr")
Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Chuang Wang <nashuiliang@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 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.39.0

  parent reply	other threads:[~2023-01-25 16:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 16:18 [for-linus][PATCH 00/11] tracing: Updates for 6.2 Steven Rostedt
2023-01-25 16:18 ` [for-linus][PATCH 01/11] ftrace: Export ftrace_free_filter() to modules Steven Rostedt
2023-01-25 16:18 ` [for-linus][PATCH 02/11] tracing: Make sure trace_printk() can output as soon as it can be used Steven Rostedt
2023-01-25 16:18 ` [for-linus][PATCH 03/11] ftrace/scripts: Update the instructions for ftrace-bisect.sh Steven Rostedt
2023-01-25 16:18 ` [for-linus][PATCH 04/11] tracing: Kconfig: Fix spelling/grammar/punctuation Steven Rostedt
2023-01-25 16:18 ` Steven Rostedt [this message]
2023-01-25 16:18 ` [for-linus][PATCH 06/11] trace_events_hist: add check for return value of create_hist_field Steven Rostedt
2023-01-25 16:18 ` [for-linus][PATCH 07/11] lib: Kconfig: fix spellos Steven Rostedt
2023-01-25 16:18 ` [for-linus][PATCH 08/11] tracing/filter: fix kernel-doc warnings Steven Rostedt
2023-01-25 16:18 ` [for-linus][PATCH 09/11] ftrace: Maintain samples/ftrace Steven Rostedt
2023-01-25 16:18 ` [for-linus][PATCH 10/11] rv: remove redundant initialization of pointer ptr Steven Rostedt
2023-01-25 16:18 ` [for-linus][PATCH 11/11] bootconfig: Update MAINTAINERS file to add tree and mailing list Steven Rostedt
2023-01-25 16:22 ` [for-linus][PATCH 00/11] tracing: Updates for 6.2 Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230125162010.631776115@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=bristot@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=nashuiliang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox