Netdev List
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "linux-trace-kernel@vger.kernel.org"
	<linux-trace-kernel@vger.kernel.org>,
	 "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [RFC PATCH 1/4] tracing: add __print_sym() to replace __print_symbolic()
Date: Thu, 21 Sep 2023 17:17:06 +0200	[thread overview]
Message-ID: <73ddab4151160d4d30aa83fb24ba6c976125da4a.camel@sipsolutions.net> (raw)
In-Reply-To: <20230921105129.cd040deee13e.I9bd2617499f0d170df58471bc51379742190f92d@changeid>

On Thu, 2023-09-21 at 08:51 +0000, Johannes Berg wrote:
> 
>  - Is it correct that we can assume RCU critical section when in
>    the lookup function? The SKB code currently does, but I may
>    not ever have actually run this code yet.

Well, I could easily answer that myself, and no, it's incorrect.

It'd be really useful though for these lookups to be able to do them
under RCU, so I think I'll fold this?

--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -34,7 +34,7 @@ struct trace_eval_map {
 struct trace_sym_def {
 	const char		*system;
 	const char		*symbol_id;
-	/* may return NULL */
+	/* may return NULL, called under rcu_read_lock() */
 	const char *		(*lookup)(unsigned long long);
 	/*
 	 * Must print the list: ', { val, "name"}, ...'
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -155,11 +155,13 @@ trace_print_sym_seq(struct trace_seq *p, unsigned
long long val,
 	const char *ret = trace_seq_buffer_ptr(p);
 	const char *name;
 
+	rcu_read_lock();
 	name = lookup(val);
 	if (name)
 		trace_seq_puts(p, name);
 	else
 		trace_seq_printf(p, "0x%llx", val);
+	rcu_read_unlock();
 
 	trace_seq_putc(p, 0);
 


johannes


  reply	other threads:[~2023-09-21 17:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21  8:51 [PATCH 0/4] tracing: improve symbolic printing Johannes Berg
2023-09-21  8:51 ` [RFC PATCH 1/4] tracing: add __print_sym() to replace __print_symbolic() Johannes Berg
2023-09-21 15:17   ` Johannes Berg [this message]
2023-09-21  8:51 ` [RFC PATCH 2/4] net: dropreason: use new __print_sym() in tracing Johannes Berg
2023-09-21  8:51 ` [RFC PATCH 3/4] net: drop_monitor: use drop_reason_lookup() Johannes Berg
2023-09-21 17:54   ` Johannes Berg
2023-09-21  8:51 ` [RFC PATCH 4/4] tracing/timer: use __print_sym() Johannes Berg
2023-10-04 16:22 ` [PATCH 0/4] tracing: improve symbolic printing Jakub Kicinski
2023-10-04 16:35   ` Steven Rostedt
2023-10-04 16:54     ` Jakub Kicinski
2023-10-04 17:29       ` Steven Rostedt
2023-10-04 21:35         ` Alan Maguire
2023-10-04 21:43           ` Steven Rostedt
2023-10-04 22:07             ` Alan Maguire
2023-10-04 18:38   ` Johannes Berg
2023-10-04 18:46     ` 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=73ddab4151160d4d30aa83fb24ba6c976125da4a.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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