[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211005160252.54640350@gandalf.local.home>
Date: Tue, 5 Oct 2021 16:02:52 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Jan Engelhardt <jengelh@...i.de>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
linux-kernel <linux-kernel@...r.kernel.org>,
Paul <paulmck@...ux.vnet.ibm.com>,
Josh Triplett <josh@...htriplett.org>,
Lai Jiangshan <jiangshanlai@...il.com>,
"Joel Fernandes, Google" <joel@...lfernandes.org>,
Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>,
Florian Westphal <fw@...len.de>,
"David S. Miller" <davem@...emloft.net>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
David Ahern <dsahern@...nel.org>,
Jakub Kicinski <kuba@...nel.org>, rcu <rcu@...r.kernel.org>,
netfilter-devel <netfilter-devel@...r.kernel.org>,
coreteam <coreteam@...filter.org>,
netdev <netdev@...r.kernel.org>
Subject: Re: [RFC][PATCH] rcu: Use typeof(p) instead of typeof(*p) *
On Tue, 5 Oct 2021 12:46:43 -0700
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Tue, Oct 5, 2021 at 12:40 PM Steven Rostedt <rostedt@...dmis.org> wrote:
> >
> > I may try it, because exposing the structure I want to hide, is pulling out
> > a lot of other crap with it :-p
>
> One option is just "don't do rcu_access of a pointer that you're not
> supposed to touch in a file that isn't supposed to touch it".
The problem is, the RCU isn't for touching it, it is for knowing it exists.
>
> IOW, why are you doing that
>
> pid_list = rcu_dereference_sched(tr->function_pids);
>
> in a place that isn't supposed to look at the pid_list in the first place?
>
> Yeah, yeah, I see how you just pass it to trace_ignore_this_task() as
> an argument, but maybe the real fix is to just pass that trace_array
> pointer instead?
>
> IOW, if you want to keep that structure private, maybe you really just
> shouldn't have non-private users of it randomly doing RCU lookups of
> it?
>
Ideally, I wanted to keep the logic of the pid lists separate, and not have
it know about the trace array at all.
And this was the best "incremental" approach I had, as the code is
currently all just open coded.
The RCU lookups are not an internal use functionality of the pid lists. The
updates to the pid list are done by allocating a new pid_list, copying the
old pid_list with the new updates and then swapping the pointers. The logic
of the pid_list is orthogonal to the RCU update. It's just "allocate some
random thing" and use RCU to swap it with the old random thing.
That is, the logic to synchronize updates is left to the user not the pid
list itself.
I also want to limit function calls, as this is called from the function
tracer (every function being traced) and if the pid_list pointer is NULL it
skips it. Hence, I want to avoid calling a function to know if the pointer
is NULL or not.
-- Steve
Powered by blists - more mailing lists