lkml.org 
[lkml]   [2019]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -tip] kprobes: Lock rcu_read_lock() while searching kprobe

* Paul E. McKenney <paulmck@kernel.org> wrote:

> > * This list-traversal primitive may safely run concurrently with
> > * the _rcu list-mutation primitives such as hlist_add_head_rcu()
> > * as long as the traversal is guarded by rcu_read_lock().
> > */
> > #define hlist_for_each_entry_rcu(pos, head, member, cond...) \
> >
> > is actively harmful. Why is it there?
>
> For cases where common code might be invoked both from the reader
> (with RCU protection) and from the updater (protected by some
> lock). This common code can then use the optional argument to
> hlist_for_each_entry_rcu() to truthfully tell lockdep that it might be
> called with either form of protection in place.
>
> This also combines with the __rcu tag used to mark RCU-protected
> pointers, in which case sparse complains when a non-RCU API is applied
> to these pointers, to get back to your earlier question about use of
> hlist_for_each_entry_rcu() within the update-side lock.
>
> But what are you seeing as actively harmful about all of this?
> What should we be doing instead?

Yeah, so basically in the write-locked path hlist_for_each_entry()
generates (slightly) more efficient code than hlist_for_each_entry_rcu(),
correct?

Also, the principle of passing warning flags around is problematic - but
I can see the point in this specific case.

Thanks,

Ingo

\
 
 \ /
  Last update: 2019-12-04 11:07    [W:0.490 / U:1.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site