From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796503636; b=sd8d3NpPimDFPYXKCp5PeE9d0pvjq2ryRO2wEmUGZUrweB4NpzpbwoFuSkIfmcK/6HyU Yd9wOWjGJ/4BcibLemAt3xnKO3zuQDzYQzUmOAJLJsmWvrN7Df6HijWi9Klo/Z+RL8kSB OkWMLMj7ZrGBByd3Jzmz94x5CKkKtcsy4EYTsbAFCbgGQRXCyNpxcDTr7Xb+RAEs+iiNo UspMhkfSJWOmBfWFoIaN0XFgheyC8h3AUTt78t11sV5tYcNS7ALQeWkPspALpqXJWrEi/ qwNyfjao6OthJlQpOGSLM+0i2Z3lxt7QNHX8iHahhJiO+KSt23vjPuZOEaouvLSLqPQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796503636; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=XH63igpK+l2N7LHZ6lM1IJCg3O4ql2U9tk+QK/tUcBw=; b=mi+JVqReiys+hIal4Om0jt+6moHyoU544wIyF9jc0Jn2Urr1CVoVpPT1GF1oUoxwd0rw 5KXSnrYA7dAsVfurzczALnCvlv/a6th8bfnN80+6IYnHFteECpWc2XQzGQQF52ZBkJTyd pJ/M7wJfVBzAO54uWgNEVRVcb9234NWBG7WA/dIPHGGIYpHIAI1Os5cwKFGa+rYr1Oxaz xR4VUfAS29UB6+WPyk7wEql0TBRLcEZ43+VJd4FPOqI8nJWqzajPVq8FrcV8OgvSga55i GFYfoJZdYdHy2Tw6hNVtIZyyB8YJM341zeB2PXSYLXpsBB4qvoGPzYwsSr5wGXn5R3w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jSWSJogO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35AD8606A334; Sat, 5 Dec 2026 20:47:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jSWSJogO Received: by smtp.kernel.org (Postfix) with ESMTPSA id C44931F0092B; Sat, 5 Dec 2026 20:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796503635; bh=XH63igpK+l2N7LHZ6lM1IJCg3O4ql2U9tk+QK/tUcBw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=jSWSJogOw0jnj3Lirm+XKTsLykj63/3RXBJCrnt381UT/ZYYkmazsPQHKmxPIz/AG AlNaEyKdFMpYBDAtdkgW66iyuqk7pE8AwshS/TcECoJPn7sECealR3qhqxmC7/uS1L Pxf5IpTzzCim37e9MmHFmpI/syJbZksEcjztAXWdvbc4pI4Nt7/CLgb6DpxduEqd/v KmvH6uCKUUgay9WbbbGjRa5kQp1Hy/BgmNDAOovCsXwOuN8wuQMX2l2NnS6CL0vlBP ChgIISl6ORB/Y7WtK5yJRh25KR6sjpIrNGBL4fJToCbyXxMYctjjinYQon2YLFoous jXOm/QgtdmzNw== Subject: Re: [PATCH net v2 4/6] idpf: keep the mailbox up while tearing down vports on shutdown 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 Date: Sat, 05 Dec 2026 20:47:14 +0000 Message-ID: <179650363435.3148.5986441091831968573@kernel.org> In-Reply-To: <20261204194642.3048406-5-anthony.l.nguyen@intel.com> References: <20261204194642.3048406-5-anthony.l.nguyen@intel.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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