linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amol Grover <frextrite@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>, Andrii Nakryiko <andriin@fb.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	Joel Fernandes <joel@joelfernandes.org>,
	Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>,
	"Paul E . McKenney" <paulmck@kernel.org>
Subject: Re: [PATCH] bpf: devmap: Pass lockdep expression to RCU lists
Date: Thu, 23 Jan 2020 22:40:25 +0530	[thread overview]
Message-ID: <20200123171025.GB4484@workstation-portable> (raw)
In-Reply-To: <87a76e9tn8.fsf@toke.dk>

On Thu, Jan 23, 2020 at 02:42:03PM +0100, Toke Høiland-Jørgensen wrote:
> Jesper Dangaard Brouer <brouer@redhat.com> writes:
> 
> > On Thu, 23 Jan 2020 17:34:38 +0530
> > Amol Grover <frextrite@gmail.com> wrote:
> >
> >> head is traversed using hlist_for_each_entry_rcu outside an
> >> RCU read-side critical section but under the protection
> >> of dtab->index_lock.
> >
> > We do hold the lock in update and delete cases, but not in the lookup
> > cases.  Is it then still okay to add the lockdep_is_held() annotation?
> 
> I concluded 'yes' from the comment on hlist_for_each_entry_rcu():
> 
> The lockdep condition gets passed to this:
> 
> #define __list_check_rcu(dummy, cond, extra...)				\
> 	({								\
> 	check_arg_count_one(extra);					\
> 	RCU_LOCKDEP_WARN(!cond && !rcu_read_lock_any_held(),		\
> 			 "RCU-list traversed in non-reader section!");	\
> 	 })
> 
> 
> so that seems fine :)
> 

Yes, adding a lockdep expression will be okay. This is because an
implicit check is done to check if list_for_each_entry_rcu() is
traversed under RCU read-side critical section. In case the traversal is
outside RCU read-side critical section, the lockdep expression makes
sure the traversal is done under the mentioned lock.

Thanks
Amol

> -Toke
> 

  reply	other threads:[~2020-01-23 17:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23 12:04 [PATCH] bpf: devmap: Pass lockdep expression to RCU lists Amol Grover
2020-01-23 13:37 ` Jesper Dangaard Brouer
2020-01-23 13:42   ` Toke Høiland-Jørgensen
2020-01-23 17:10     ` Amol Grover [this message]
2020-01-23 13:38 ` Toke Høiland-Jørgensen
2020-01-23 15:59   ` Daniel Borkmann
2020-01-23 17:18 ` Amol Grover
2020-01-23 22:04   ` Daniel Borkmann

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=20200123171025.GB4484@workstation-portable \
    --to=frextrite@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=hawk@kernel.org \
    --cc=jakub.kicinski@netronome.com \
    --cc=joel@joelfernandes.org \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madhuparnabhowmik04@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=toke@redhat.com \
    --cc=yhs@fb.com \
    /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;
as well as URLs for NNTP newsgroup(s).