From: Xin Long <lucien.xin@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
linux-sctp@vger.kernel.org, davem <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
Neil Horman <nhorman@tuxdriver.com>
Subject: Re: [PATCH net] sctp: not disable bh in the whole sctp_get_port_local()
Date: Fri, 21 Aug 2020 06:57:25 +0000 [thread overview]
Message-ID: <CADvbK_eej9URRLMrN=nLTAdcmaHJAmT+69-Ghk7i8JLcSmzENg@mail.gmail.com> (raw)
In-Reply-To: <661ff148-627d-3b1f-f450-015dafefd137@gmail.com>
On Thu, Aug 20, 2020 at 9:13 PM Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
>
> On 8/19/20 11:48 PM, Xin Long wrote:
> > With disabling bh in the whole sctp_get_port_local(), when
> > snum = 0 and too many ports have been used, the do-while
> > loop will take the cpu for a long time and cause cpu stuck:
> >
> > [ ] watchdog: BUG: soft lockup - CPU#11 stuck for 22s!
> > [ ] RIP: 0010:native_queued_spin_lock_slowpath+0x4de/0x940
> > [ ] Call Trace:
> > [ ] _raw_spin_lock+0xc1/0xd0
> > [ ] sctp_get_port_local+0x527/0x650 [sctp]
> > [ ] sctp_do_bind+0x208/0x5e0 [sctp]
> > [ ] sctp_autobind+0x165/0x1e0 [sctp]
> > [ ] sctp_connect_new_asoc+0x355/0x480 [sctp]
> > [ ] __sctp_connect+0x360/0xb10 [sctp]
> >
> > There's no need to disable bh in the whole function of
> > sctp_get_port_local. So fix this cpu stuck by removing
> > local_bh_disable() called at the beginning, and using
> > spin_lock_bh() instead.
> >
> > The same thing was actually done for inet_csk_get_port() in
> > Commit ea8add2b1903 ("tcp/dccp: better use of ephemeral
> > ports in bind()").
> >
> > Thanks to Marcelo for pointing the buggy code out.
> >
> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> > Reported-by: Ying Xu <yinxu@redhat.com>
> > Signed-off-by: Xin Long <lucien.xin@gmail.com>
> > ---
>
>
> Any reason you chose to not use a cond_resched() then ?
>
> Clearly this function needs to yield, not only BH, but to other threads.
>
Right, it explains why the cpu stuck is gone, but sctp_get_port_local()
still use the cpu quite a lot:
Thanks, will post v2.
prev parent reply other threads:[~2020-08-21 6:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-20 6:48 [PATCH net] sctp: not disable bh in the whole sctp_get_port_local() Xin Long
2020-08-20 13:13 ` Eric Dumazet
2020-08-21 6:57 ` Xin Long [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='CADvbK_eej9URRLMrN=nLTAdcmaHJAmT+69-Ghk7i8JLcSmzENg@mail.gmail.com' \
--to=lucien.xin@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=linux-sctp@vger.kernel.org \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.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).