From: Amol Grover <frextrite@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>,
"David S . Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org,
Joel Fernandes <joel@joelfernandes.org>,
Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>,
"Paul E . McKenney" <paulmck@kernel.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH] tcp: Pass lockdep expression to RCU lists
Date: Thu, 20 Feb 2020 09:17:02 +0530 [thread overview]
Message-ID: <20200220034702.GA2349@workstation-portable> (raw)
In-Reply-To: <b628d0ad-e066-46f5-5746-74dfba1816a8@gmail.com>
On Wed, Feb 19, 2020 at 11:35:21AM -0800, Eric Dumazet wrote:
>
>
> On 2/19/20 2:05 AM, Amol Grover wrote:
> > tcp_cong_list is traversed using list_for_each_entry_rcu
> > outside an RCU read-side critical section but under the protection
> > of tcp_cong_list_lock.
> >
>
> This is not true.
>
> There are cases where RCU read lock is held,
> and others where the tcp_cong_list_lock is held.
>
That's true but this patch specifically fixes those occurences of
list_for_each_entry_rcu() that are traversed under tcp_cong_list_lock.
Moreover, an implicit check is done for being inside RCU read-side
critical section along with testing for this newly added lockdep
expression.
> I believe you need to be more precise in the changelog.
>
> If there was a bug, net tree would be the target for this patch,
> with a required Fixes: tag.
>
> Otherwise, if net-next tree is the intended target, you have to signal
> it, as instructed in Documentation/networking/netdev-FAQ.rst
>
I don't think this fixes a "bug". However, this may fix potential bugs
that may creep in. Should I send it against net-next tree?
Thanks
Amol
> Thanks.
>
>
> > Hence, add corresponding lockdep expression to silence false-positive
> > warnings, and harden RCU lists.
> >
> > Signed-off-by: Amol Grover <frextrite@gmail.com>
> > ---
> > net/ipv4/tcp_cong.c | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
> > index 3737ec096650..8d4446ed309e 100644
> > --- a/net/ipv4/tcp_cong.c
> > +++ b/net/ipv4/tcp_cong.c
> > @@ -25,7 +25,8 @@ static struct tcp_congestion_ops *tcp_ca_find(const char *name)
> > {
> > struct tcp_congestion_ops *e;
> >
> > - list_for_each_entry_rcu(e, &tcp_cong_list, list) {
> > + list_for_each_entry_rcu(e, &tcp_cong_list, list,
> > + lockdep_is_held(&tcp_cong_list_lock)) {
> > if (strcmp(e->name, name) == 0)
> > return e;
> > }
> > @@ -55,7 +56,8 @@ struct tcp_congestion_ops *tcp_ca_find_key(u32 key)
> > {
> > struct tcp_congestion_ops *e;
> >
> > - list_for_each_entry_rcu(e, &tcp_cong_list, list) {
> > + list_for_each_entry_rcu(e, &tcp_cong_list, list,
> > + lockdep_is_held(&tcp_cong_list_lock)) {
> > if (e->key == key)
> > return e;
> > }
> > @@ -317,7 +319,8 @@ int tcp_set_allowed_congestion_control(char *val)
> > }
> >
> > /* pass 2 clear old values */
> > - list_for_each_entry_rcu(ca, &tcp_cong_list, list)
> > + list_for_each_entry_rcu(ca, &tcp_cong_list, list,
> > + lockdep_is_held(&tcp_cong_list_lock))
> > ca->flags &= ~TCP_CONG_NON_RESTRICTED;
> >
> > /* pass 3 mark as allowed */
> >
prev parent reply other threads:[~2020-02-20 3:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-19 10:05 [PATCH] tcp: Pass lockdep expression to RCU lists Amol Grover
2020-02-19 19:35 ` Eric Dumazet
2020-02-20 3:47 ` Amol Grover [this message]
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=20200220034702.GA2349@workstation-portable \
--to=frextrite@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=joel@joelfernandes.org \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=madhuparnabhowmik10@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=yoshfuji@linux-ipv6.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