From: netdev-bot+sashiko@kernel.org
To: anthony.l.nguyen@intel.com
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@kernel.org, andrew+netdev@lunn.ch, willemb@google.com,
netdev@vger.kernel.org, tianxun.ng@bytedance.com,
oss.patchbox@gmail.com, luckilystar08@gmail.com,
emil.s.tantilov@intel.com, richardcochran@gmail.com,
milena.olech@intel.com, konstantin.ilichev@intel.com,
stable@vger.kernel.org, Samuel.salin@intel.com
Subject: Re: [PATCH net v2 4/6] idpf: keep the mailbox up while tearing down vports on shutdown
Date: Sat, 05 Dec 2026 20:47:14 +0000 [thread overview]
Message-ID: <179650363435.3148.5986441091831968573@kernel.org> (raw)
In-Reply-To: <20261204194642.3048406-5-anthony.l.nguyen@intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 (1) · 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).
- [Medium] On shutdown, one slow mailbox reply makes the driver give up
on the rest of the device teardown, which can bring back the bug this…
- [Medium] When the control plane stops answering, shutdown can now hang
for up to 60 s per PF.
Pre-existing issues:
- [Medium] idpf_mac_filter_async_handler() (idpf_virtchnl.c:3892) indexes
adapter->vport_config[] with the vport_id the device assigned…
--
idpf: keep the mailbox up while tearing down vports on shutdown
This commit sets IDPF_REMOVE_IN_PROG at the start of idpf_shutdown(). With
the flag set, idpf_vc_core_deinit() keeps the virtchnl transaction manager
up while the vports are destroyed, so the device is told the vports and
queues are gone before a warm reboot. It also caps each teardown
transaction at 500 ms through a new adapter->vc_xn_timeout_ms, and fails
later synchronous ones at once after the first shortened one times out.
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c
> index 129bccaa6baa8..21be83dc82b1b 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_main.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_main.c
> @@ -194,8 +194,18 @@ static void idpf_shutdown(struct pci_dev *pdev)
> {
> struct idpf_adapter *adapter = pci_get_drvdata(pdev);
>
> + /* As in idpf_remove(): keep the event task from being requeued, and
> + * destroy the vports while the mailbox is still up.
> + */
> + set_bit(IDPF_REMOVE_IN_PROG, adapter->flags);
> cancel_delayed_work_sync(&adapter->serv_task);
> cancel_delayed_work_sync(&adapter->vc_event_task);
[Severity: Medium]
Can this make a reboot wait up to 60 s per PF when the control plane has
stopped answering?
With IDPF_REMOVE_IN_PROG set here, idpf_vc_core_deinit() takes the
remove_in_prog branch. That branch runs libie_ctlq_xn_shutdown() only
after idpf_deinit_task(). idpf_shutdown() does not cancel stats_task, and
idpf_deinit_task() waits for it while the transaction manager is still up:
idpf_shutdown()
idpf_vc_core_deinit()
idpf_deinit_task()
cancel_delayed_work_sync(&adapter->stats_task);
Suppose idpf_statistics_task() is already blocked in libie_ctlq_xn_send()
on a GET_STATS that read vc_xn_timeout_ms before the WRITE_ONCE() below.
It then waits in wait_for_completion_timeout() for the full
IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC.
Before this patch, shutdown took the !remove_in_prog branch, so
libie_ctlq_xn_shutdown() ran first. That completes every waiting
transaction, and the stats task returned at once.
If the control plane is unresponsive, the stats task is blocked for most
of each cycle (a 60 s wait plus the 10 s requeue). So it is likely to be
in flight when shutdown starts. idpf_remove() already behaved this way.
The commit message says "A request it already has waiting ... keeps its
own timeouts". Is that meant to apply to shutdown too, given the stated
goal that "an unresponsive control plane does not hold up a reboot for
long"?
> +
> + /* Bound the teardown transactions started from here on, so that an
> + * unresponsive control plane costs a single timeout. A reset or a
> + * transaction that is already running keeps its own timeouts.
> + */
> + WRITE_ONCE(adapter->vc_xn_timeout_ms, IDPF_VC_XN_SHUTDOWN_TIMEOUT_MSEC);
> idpf_vc_core_deinit(adapter);
> idpf_deinit_dflt_mbx(adapter);
[Severity: Medium]
This is a pre-existing issue, not one introduced by this patch. Because
the transaction manager now stays up during the shutdown teardown, async
MAC filter error replies can be handled in a new window.
idpf_vport_dealloc() also calls idpf_del_all_mac_filters() on shutdown
now. In idpf_mac_filter_async_handler(), vport_config is indexed by the
vport_id the device assigned, not by the driver's slot index:
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c:idpf_mac_filter_async_handler() {
...
vport = idpf_vid_to_vport(adapter, le32_to_cpu(ma_list->vport_id));
if (!vport)
goto invalid_payload;
vport_config = adapter->vport_config[le32_to_cpu(ma_list->vport_id)];
...
}
idpf_vid_to_vport() maps vport_id to a slot through adapter->vport_ids[].
Other users of the same list index by slot, for example
idpf_del_all_mac_filters():
vport_config = vport->adapter->vport_config[vport->idx];
What happens if the device assigns a vport_id that differs from the slot
index? The handler could work on the wrong mac_filter_list or hit a NULL
vport_config. If vport_id >= max_vports, it could also read past the end
of vport_config[] and then call list_del() through that pointer.
Should this use vport->idx instead?
[ ... ]
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> index 854eb1f1ada4c..e7a8ccbc35857 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
[ ... ]
> int idpf_send_mb_msg(struct idpf_adapter *adapter,
> struct libie_ctlq_xn_send_params *xn_params,
> void *send_buf, size_t send_buf_size)
> {
> + u32 timeout_ms = READ_ONCE(adapter->vc_xn_timeout_ms);
> struct libie_ctlq_msg ctlq_msg = {};
> + int err = 0;
>
> - if (idpf_is_reset_detected(adapter)) {
> + if (idpf_is_reset_detected(adapter))
> + err = -EBUSY;
> + else if (!timeout_ms)
> + err = -ETIMEDOUT;
> +
> + if (err) {
> if (!libie_cp_can_send_onstack(send_buf_size))
> kfree(send_buf);
>
> - return -EBUSY;
> + return err;
> }
[ ... ]
> @@ -219,10 +231,15 @@ int idpf_send_mb_msg(struct idpf_adapter *adapter,
> xn_params->xnm = adapter->xnm;
> xn_params->ctlq = xn_params->ctlq ? xn_params->ctlq : adapter->asq;
> xn_params->rel_tx_buf = kfree;
> + xn_params->timeout_ms = min_t(u64, xn_params->timeout_ms, timeout_ms);
>
> idpf_mb_clean(xn_params->ctlq, false);
>
> - return libie_ctlq_xn_send(xn_params);
> + err = libie_ctlq_xn_send(xn_params);
> + if (err == -ETIMEDOUT && timeout_ms < IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC)
> + WRITE_ONCE(adapter->vc_xn_timeout_ms, 0);
[Severity: Medium]
Can one slow reply from a control plane that is still alive cancel the
rest of the shutdown teardown?
idpf_shutdown() sets vc_xn_timeout_ms to IDPF_VC_XN_SHUTDOWN_TIMEOUT_MSEC
(500). The first -ETIMEDOUT under that cap sets it to 0. After that,
every idpf_send_mb_msg() call fails the !timeout_ms check above and
returns -ETIMEDOUT without putting anything on the ASQ. This happens even
though idpf_is_reset_detected() still sees a live ARQ.
DISABLE_VPORT is the first message sent from idpf_vport_stop(). If it
takes longer than 500 ms, the rest of the teardown goes like this:
idpf_shutdown()
idpf_vc_core_deinit()
idpf_deinit_task()
idpf_vport_dealloc()
idpf_vport_stop()
idpf_send_disable_vport_msg() <- times out, cap set to 0
idpf_send_disable_queues_msg() <- not sent
idpf_send_map_unmap_queue_vector_msg() <- not sent
...
idpf_vport_queues_rel() <- rings freed
idpf_vport_rel()
idpf_send_destroy_vport_msg() <- not sent
Every later vport is affected the same way. DEALLOC_VECTORS from
idpf_intr_rel() is not sent either.
idpf_vport_stop() ignores those return values. It frees the Tx, Rx and
completion rings while the device may still have the queues enabled.
Wouldn't that leave the device in the state the commit message
describes, writing SW_MARKER completions into the next kernel's memory
after a warm reboot?
The commit message measured about 300 ms for DEALLOC_VECTORS on an idle
control plane. That is 60% of the 500 ms budget, while the normal
timeout is 60 s.
Would a larger shutdown budget help here? Another option would be to set
the cap to 0 only once the device also looks dead. Either would avoid
dropping the teardown messages when the control plane is only slow.
> +
> + return err;
> }
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204194642.3048406-1-anthony.l.nguyen%40intel.com
prev parent reply other threads:[~2026-12-05 20:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261204194642.3048406-1-anthony.l.nguyen@intel.com>
2026-12-04 19:46 ` [PATCH net v2 2/6] idpf: ignore Tx timestamp replies once removal has started Tony Nguyen
2026-12-05 20:47 ` netdev-bot+sashiko
2026-12-04 19:46 ` [PATCH net v2 3/6] idpf: ignore link events " Tony Nguyen
2026-12-05 20:47 ` netdev-bot+sashiko
2026-12-04 19:46 ` [PATCH net v2 4/6] idpf: keep the mailbox up while tearing down vports on shutdown Tony Nguyen
2026-12-05 20:47 ` netdev-bot+sashiko [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=179650363435.3148.5986441091831968573@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=Samuel.salin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=emil.s.tantilov@intel.com \
--cc=konstantin.ilichev@intel.com \
--cc=kuba@kernel.org \
--cc=luckilystar08@gmail.com \
--cc=milena.olech@intel.com \
--cc=netdev@vger.kernel.org \
--cc=oss.patchbox@gmail.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=stable@vger.kernel.org \
--cc=tianxun.ng@bytedance.com \
--cc=willemb@google.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