Re: [PATCH net v6 5/5] bnxt_en: stop the ULP around the reset task
From: willemb
Date: Wed Nov 25 2026 - 19:21:44 EST
Joe Damato wrote:
On Mon, Nov 23, 2026 at 06:31:04PM +0000, netdev-bot+sashiko@xxxxxxxxxx wrote:
> Thank you for your contribution! Sashiko AI review found 6 potential
> issue(s) to consider.
>
> Critical: 0 · High: 3 · Medium: 3 · Low: 0
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [High] Possible deadlock.
> - [High] bnxt_reset() decides to call bnxt_ulp_start() only from !silent
> && !BNXT_STATE_DMA_STOPPED, after dropping its locks.
> - [High] Incomplete fix.
> - [Medium] bnxt_reset_task() discards the return value of
> bnxt_open_nic(), and bnxt_reset() calls bnxt_ulp_start() whenever…
> - [Medium] The new DMA_STOPPED check exists only at the bnxt_reset() call
> site.
> - [Medium] Every non-silent reset now unregisters and re-registers the
> RoCE IB device, including the common case where DMA is never stopped,…
>
> --
>
> bnxt_en: stop the ULP around the reset task
>
> For non-silent resets, bnxt_reset() now calls bnxt_ulp_stop() before it
> takes rtnl and the netdev lock. Afterwards it calls bnxt_ulp_start() unless
> BNXT_STATE_DMA_STOPPED was set. The goal is to keep the RDMA driver off the
> device once the reset task has stopped DMA.
>
> > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > index 9daf053293a42..2abb721d87de8 100644
> > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > @@ -14710,10 +14710,14 @@ static void bnxt_tph_update(struct bnxt *bp)
> > /* Only called from bnxt_sp_task() */
> > static void bnxt_reset(struct bnxt *bp, bool silent)
> > {
> > + if (!silent)
> > + bnxt_ulp_stop(bp);
> > bnxt_rtnl_lock_sp(bp);
>
> [Severity: High]
> Can this deadlock against bnxt_close()?
>
> bnxt_sp_task() sets BNXT_STATE_IN_SP_TASK before it calls bnxt_reset().
> bnxt_rtnl_lock_sp() clears that bit only after bnxt_ulp_stop() has
> returned, and bnxt_rtnl_unlock_sp() sets it again before bnxt_ulp_start()
> runs. So both new ULP calls run with IN_SP_TASK set.
>
> Both ULP callbacks take rtnl_lock():
>
> bnxt_ulp_stop()
> bnxt_re_suspend()
> bnxt_re_update_en_info_rdev()
> rtnl_lock()
>
> bnxt_ulp_start()
> bnxt_re_resume()
> bnxt_re_add_device()
> bnxt_re_update_en_info_rdev()
> rtnl_lock()
> bnxt_re_ib_init()->ib_register_device()->...->enum_all_gids_of_dev_cb()
> rtnl_lock()
>
> ndo_stop, meanwhile, holds rtnl and the netdev instance lock and waits for
> IN_SP_TASK to clear, with no timeout:
>
> __bnxt_close_nic() {
> clear_bit(BNXT_STATE_OPEN, &bp->state);
> smp_mb__after_atomic();
> while (bnxt_drv_busy(bp))
> msleep(20);
> ...
> }
>
> Suppose "ip link set dev X down" runs just after a TX timeout has scheduled
> BNXT_RESET_TASK_SP_EVENT. sp_task can block on rtnl inside bnxt_ulp_stop()
> (or bnxt_ulp_start()), while bnxt_close() spins on bnxt_drv_busy() holding
> rtnl. The comment above bnxt_lock_sp() warns about this exact case.
>
> Before this patch, only the rare RESTART_ULP and firmware reset events
> called into the ULP with IN_SP_TASK set. The frequent reset path did not.
>
> Should the ULP calls happen only while IN_SP_TASK is clear?
Yea, I think this is real.
Not sure if Michael or the other Broadcom folks have a suggestion here? Maybe
the minimal fix is to clear IN_SP_TASK before bnxt_ulp_stop() and call
bnxt_ulp_start() only after unlock.
The RDMA teardown on every TX timeout and restart races below would still need
answers, though.
Are this and your questions in the main thread a reason for a v7?