From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Martin KaFai Lau <kafai@fb.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
Kuniyuki Iwashima <kuniyu@amazon.co.jp>,
eric.dumazet@gmail.com, davem@davemloft.net, dsahern@kernel.org,
efault@gmx.de, netdev@vger.kernel.org, tglx@linutronix.de,
yoshfuji@linux-ipv6.org
Subject: Re: [PATCH net v2] tcp: Don't acquire inet_listen_hashbucket::lock with disabled BH.
Date: Fri, 10 Dec 2021 17:21:13 +0100 [thread overview]
Message-ID: <YbN+edCO3DGMDPmj@linutronix.de> (raw)
In-Reply-To: <20211209200632.wpusjdlad5hyaal6@kafai-mbp.dhcp.thefacebook.com>
On 2021-12-09 12:06:32 [-0800], Martin KaFai Lau wrote:
> > local_bh_disable() + spin_lock(&ilb->lock):
> > inet_listen()
> > inet_csk_listen_start()
> > sk->sk_prot->hash() := inet_hash()
> > local_bh_disable()
> > __inet_hash()
> > spin_lock(&ilb->lock);
> > acquire(&ilb->lock);
> >
> > Reverse order: spin_lock(&ilb->lock) + local_bh_disable():
> > tcp_seq_next()
> > listening_get_next()
> > spin_lock(&ilb->lock);
> The net tree has already been using ilb2 instead of ilb.
> It does not change the problem though but updating
> the commit log will be useful to avoid future confusion.
You think so? But having ilb2 and ilb might suggest that these two are
different locks while they are the same. I could repost it early next
week if you this actually confuses more…
> iiuc, established_get_next() does not hit this because
> it calls spin_lock_bh() which then keeps the
> local_bh_disable() => spin_lock() ordering?
Yes. BH was disabled before the spin_lock was acquired so it is the same
ordering. The important part is not to disable BH after the spin_lock
was acquired and in the reverse order.
> The patch lgtm.
> Acked-by: Martin KaFai Lau <kafai@fb.com>
Sebastian
next prev parent reply other threads:[~2021-12-10 16:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 12:02 [PATCH net v2] tcp: Don't acquire inet_listen_hashbucket::lock with disabled BH Sebastian Andrzej Siewior
2021-12-09 20:06 ` Martin KaFai Lau
2021-12-10 16:21 ` Sebastian Andrzej Siewior [this message]
2021-12-10 21:22 ` Martin KaFai Lau
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=YbN+edCO3DGMDPmj@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=efault@gmx.de \
--cc=eric.dumazet@gmail.com \
--cc=kafai@fb.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.co.jp \
--cc=netdev@vger.kernel.org \
--cc=tglx@linutronix.de \
--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;
as well as URLs for NNTP newsgroup(s).