public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Joel Fernandes <joel@joelfernandes.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Anders Roxell <anders.roxell@linaro.org>,
	"Naveen N . Rao" <naveen.n.rao@linux.ibm.com>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
	David Miller <davem@davemloft.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -tip] kprobes: Lock rcu_read_lock() while searching kprobe
Date: Wed, 4 Dec 2019 11:05:50 +0100	[thread overview]
Message-ID: <20191204100549.GB114697@gmail.com> (raw)
In-Reply-To: <20191203175712.GI2889@paulmck-ThinkPad-P72>


* 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

  reply	other threads:[~2019-12-04 10:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-02  7:32 [PATCH -tip] kprobes: Lock rcu_read_lock() while searching kprobe Masami Hiramatsu
2019-12-02 15:17 ` Anders Roxell
2019-12-02 21:08 ` Joel Fernandes
2019-12-02 22:34   ` Masami Hiramatsu
2019-12-02 23:35     ` Joel Fernandes
2019-12-03  6:02       ` Masami Hiramatsu
2019-12-03  7:13   ` Ingo Molnar
2019-12-03 17:57     ` Paul E. McKenney
2019-12-04 10:05       ` Ingo Molnar [this message]
2019-12-04 16:12         ` Paul E. McKenney
2019-12-05  4:19           ` Masami Hiramatsu
2019-12-06  1:11           ` Joel Fernandes
2019-12-06  3:11             ` Paul E. McKenney
2019-12-08  0:08               ` Joel Fernandes
2019-12-09  3:39                 ` Paul E. McKenney
2019-12-17 14:59                   ` Masami Hiramatsu
2019-12-17 18:07                     ` Joel Fernandes
2019-12-04  4:09     ` Joel Fernandes
2019-12-04  4:20       ` Joel Fernandes

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=20191204100549.GB114697@gmail.com \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=anders.roxell@linaro.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=paulmck@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