🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27503

Re: [PATCH net v2 4/6] idpf: keep the mailbox up while tearing down vports on shutdown

#27503
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 20:47
219 lines
16635 bytes
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
Technical Details
Message-ID: <179650363435.3148.5986441091831968573@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378125-linux-kernel-netdev=dewy.ru
References: <20261204194642.3048406-5-anthony.l.nguyen@intel.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378125-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179650363435.3148.5986441091831968573@kernel.org>
References: <20261204194642.3048406-5-anthony.l.nguyen@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3117350"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:iebQvYTu1MdvV014B224FtpXtkE= sha256:YCCUZt9ooTWtYn6qty8MZ6szBJt4g3aZ7IZglqGyYjo=
	sha1:aemoaamURCOwqB48nrfI1ZjTyzs= sha256:ST20nJlVSbzm3Wc0tbV7g5EgSc1tHH18XVXleFR5b5A=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id AD645117EAD; Sat,  5 Dec 2026 23:47:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.539
X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id rqduL_72mkuZ;
	Sat,  5 Dec 2026 23:47:44 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378125-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 3A46A117EA0; Sat,  5 Dec 2026 23:47:36 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id C1B3A3129A; Sat,  5 Dec 2026 20:47:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796503642;
	b=MWLoy+VN3q5RyWyN9cY6ZO6GB9oaQ1ieZXpFVGLA8WkFzNtC1qAM2SWlUq5fDq+mvVrQ
	 F1/bJ9ocuABerhoaRFqsgCrLs/4cLNSNQMJJTm2ikAGNU7wKjC4Nl4KIeurM3ekR/rpXf
	 gBdpqYTfK8QTQ0DS5BNCHwJxlmNAaC9xCplk+BCOO9VGThq44bryPmGoDzjLufK3dgr2N
	 My24wUINkCKl6gP8f5PlLouJwdSHY1WwXLzAIkvXKLJeoUwPx8Wc5u6cBZ5qqQtRbjkcH
	 x3SFFyVMotNAO9Xc4SQmGbZJrT4WKPzjqNMJGvez17I57x6TbcUY+NNNos8s/k+FWlw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796503642;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=XH63igpK+l2N7LHZ6lM1IJCg3O4ql2U9tk+QK/tUcBw=;
	b=PJVXzKqRsUWZX+wk6ECxW4kSkFJitqDKWtAF6bktMBcG/4uq/Hv2YPKqkD+T4ZnNyohU
	 EeVlkZAYRmHkcXuIfvPxQ/G3bODpLXLC9CqlW3LDvoN1pDTnEBpi9uG4SdvKQy4vj4Qha
	 Em3f+St2gr1XQjoNhqdPXIBkesbPmlgUO5AnGQTGyf0fQXlNSOR2xG9t0S55GK9STh7xj
	 WlldJTnsQWX3ptOqpwWB7sqNKDNI6TpXe2TLEbJ/One5nZTt3ASF3trlhNdOjZyw2r3Qj
	 qHxwnNSnQXOU5nqZc0NZYkBLND6Dw/gCdHofBiYh2jMJwHdyxIiS6jdNrRktl9Vp8Xg==
X-ARC-Authentication-Results: i=2; 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=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B113606A330;
	Sat,  5 Dec 2026 20:47:22 +0000 (UTC)
X-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
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-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==
X-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==
X-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
X-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)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C44931F0092B;
	Sat,  5 Dec 2026 20:47:14 +0000 (UTC)
X-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==
X-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
X-In-Reply-To: <20261204194642.3048406-5-anthony.l.nguyen@intel.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list