[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <73ddab4151160d4d30aa83fb24ba6c976125da4a.camel@sipsolutions.net>
Date: Thu, 21 Sep 2023 17:17:06 +0200
From: Johannes Berg <johannes@...solutions.net>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: "linux-trace-kernel@...r.kernel.org"
<linux-trace-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>
Subject: Re: [RFC PATCH 1/4] tracing: add __print_sym() to replace
__print_symbolic()
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
Powered by blists - more mailing lists