🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #9055

Re: [PATCH net v3 1/2] enic: retain admin-channel DMA until queues stop

#9055
From: netdev-bot+sashiko
Date: Fri, 30 Oct 2026 22:40
186 lines
15097 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 (1) · Medium: 1 · Low: 1

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] enic_remove() now holds rtnl_lock() across the V2 VF PF-
  unregister handshake and enic_admin_channel_close(), not just across…
- [Low] A failed VF re-registration in enic_admin_chan_reopen() can leave
  enic->vf_registered true after the channel has been closed.

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the patch
  touches the exact line: when enic_open() fails inside enic_reset() or…

--

enic: retain admin-channel DMA until queues stop

This patch tracks the admin channel as DOWN, LIVE or QUARANTINED. When the
admin WQ/RQ cannot be shown to have stopped, it keeps the admin DMA graph
instead of freeing it. The reset workers and the probe/remove paths are
changed so they refuse to reopen or free a quarantined channel, and removal
holds RTNL while it detaches the netdev and closes the channel.

> diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
> index 6b5824f45a14c..5a1621599c5f5 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_main.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_main.c

[ ... ]

> @@ -2287,7 +2309,8 @@ static void enic_reset(struct work_struct *work)
>  	enic_dev_set_ig_vlan_rewrite_mode(enic);
>  	enic_ext_cq(enic);
>  
> -	enic_open(enic->netdev);
> +	if (enic_open(enic->netdev))
> +		goto reset_out;

[Severity: High]
This is a pre-existing issue and not introduced by this patch, but this
line is being touched: what state is the netdev left in when enic_open()
fails here?

By this point enic_stop() has already called napi_disable() on every NAPI
and has called enic_free_intr(). enic_open() can then fail in
enic_request_intr(), page_pool_create(), the RQ fill or enic_dev_enable().
Its unwind disables the NAPIs it enabled and calls enic_free_intr() again.
__LINK_STATE_START and IFF_UP stay set the whole time.

enic_free_intr() also never clears msix[i].requested:

	case VNIC_DEV_INTR_MODE_MSIX:
		for (i = 0; i < enic->intr_count; i++)
			if (enic->msix[i].requested)
				free_irq(enic->msix_entry[i].vector,
					enic->msix[i].devid);

Any of these would then run enic_stop() again over the released
resources: a later ip link set down, the new dev_close() in the quarantine
branch of a later reset, or unregister_netdev() from enic_remove():

enic_stop()
    napi_disable(&enic->napi[i])    <- already disabled
    ...
    enic_free_intr(enic)            <- vectors already freed

Can the second napi_disable() loop forever in napi_disable_locked() while
RTNL is held? NAPIF_STATE_SCHED and NAPIF_STATE_NPSVC are still set from
the first disable. The repeated free_irq() calls would also WARN.

enic_tx_hang_reset() has the same sequence, with the same new
goto reset_out after a failed enic_open().

>  
>  	/* Re-establish the admin/MBOX channel after the data path is back up.
>  	 * It was fully torn down by enic_admin_channel_close() above;
> @@ -2296,12 +2319,17 @@ static void enic_reset(struct work_struct *work)
>  	 */
>  	if (enic_has_admin_chan(enic))
>  		enic_admin_chan_reopen(enic);
> +	if (enic_is_sriov_vf_v2(enic) &&
> +	    enic_admin_channel_is_quarantined(enic))
> +		dev_close(enic->netdev);

[Severity: Low]
Can vf_registered stay true after enic_admin_chan_reopen() closes the
channel because re-registration failed?

The commit message says:

  "Clear local VF registration after draining channel replies, including
  when recovery exits early."

The clears added to enic_reset() and enic_tx_hang_reset() run before the
reopen. The failure path inside enic_admin_chan_reopen() does not clear the
flag afterwards:

		err = enic_mbox_vf_register(enic);
		if (err) {
			netdev_err(...);
			enic_admin_channel_close(enic);
		}

enic_mbox_send_msg_id() publishes mbox_expected_reply and
mbox_expected_msg_num before it rings the doorbell. It then polls the WQ CQ
for up to 5 s while holding only mbox_lock. During that window,
admin_msg_work can accept a REGISTER_REPLY in enic_mbox_vf_handle_reply():

		case ENIC_MBOX_VF_REGISTER_REPLY:
			WRITE_ONCE(enic->vf_registered, true);

If the sender still sees no WQ completion, it returns -ETIMEDOUT. That
error comes back through enic_mbox_vf_register(), and the channel is closed
with vf_registered still set.

enic_remove() later sees vf_registered and calls enic_mbox_vf_unregister().
That call fails with -ENODEV because mbox_send_disabled is set, and remove
logs "Failed to unregister from PF".

Should vf_registered also be cleared after the enic_admin_channel_close()
calls in enic_admin_chan_reopen()?

[ ... ]

> @@ -3397,6 +3454,8 @@ static void enic_remove(struct pci_dev *pdev)
>  		disable_work_sync(&enic->reset);
>  		disable_work_sync(&enic->tx_hang_reset);
>  		disable_work_sync(&enic->change_mtu_work);
> +		rtnl_lock();
> +		netif_device_detach(netdev);
>  
>  		/* Close the admin channel and unregister from the PF before
>  		 * unregister_netdev() to prevent a late PF notification from
> @@ -3413,6 +3472,7 @@ static void enic_remove(struct pci_dev *pdev)
>  			}
>  			enic_admin_channel_close(enic);
>  		}
> +		rtnl_unlock();

[Severity: Medium]
Is RTNL held here for longer than it needs to be?

The new RTNL section covers the whole V2 VF unregister handshake and the
channel close:

enic_remove()
  rtnl_lock()
  enic_mbox_vf_unregister()
    enic_mbox_send_msg_id()           <- WQ CQ poll, up to 5 s
    enic_mbox_wait_reply(enic, 3000)  <- up to 3 s
  enic_admin_channel_close()
    enic_admin_qp_type_set(enic, QP_DISABLE)
    enic_admin_wq_disable()           <- 500 ms, retried on -ETIMEDOUT
    enic_admin_rq_disable()           <- 2 x 500 ms, retried on -ETIMEDOUT
  rtnl_unlock()

The new admin helpers poll with:

	return read_poll_timeout(ioread32, running, !running, 10, 500000,
				 false, &wq->ctrl->running);

These replace the earlier vnic_wq_disable()/vnic_rq_disable() polls of
about 10 ms.

This patch targets the case where the admin queues don't stop or the PF
doesn't respond. In that case, could removing the VF stall every RTNL user
for roughly 8 to 11 seconds? The same longer queue polls now also run under
RTNL and mbox_lock in enic_reset() and enic_tx_hang_reset().

The reset works are already disabled at this point. After rtnl_unlock(),
both enic_open() and the core check netif_device_present(). Would holding
RTNL only around netif_device_detach() be enough to keep a concurrent open
out?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261027-b4-enic-dma-vf-index-net-generic-first-v1-20261010-v3-0-ba237ed71241%40cisco.com
Technical Details
Message-ID: <179340002556.3131.229561522947370936@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353991-linux-kernel-netdev=dewy.ru
References: <20261027-b4-enic-dma-vf-index-net-generic-first-v1-20261010-v3-1-ba237ed71241@cisco.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353991-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 1/2] enic: retain admin-channel DMA until queues stop
Date: Fri, 30 Oct 2026 22:40:25 +0000
Organization: Usenet Network
Message-ID: <179340002556.3131.229561522947370936@kernel.org>
References: <20261027-b4-enic-dma-vf-index-net-generic-first-v1-20261010-v3-1-ba237ed71241@cisco.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2327364"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:VlEI1Yu3qj/wsRjR/r3JZgJVCGU= sha256:DebPJY/vISySflDV3yRayq3xV8CRYZD4os4cBNAcyWw=
	sha1:TigKacpXDvsf37HrbFUmItsiLSc= sha256:pAy3GImJxtq/dB1BA7BYon7oNM+hc7KgGueecqFcxeY=
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 8AA33125CA6; Sat, 31 Oct 2026 01:41:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 gSwH296HNh8A;
	Sat, 31 Oct 2026 01:41:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-353991-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 8B995125BBF; Sat, 31 Oct 2026 01:40:51 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 0A62B23F13; Fri, 30 Oct 2026 22:40:32 +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=1793400028;
	b=PrUZV6Hh2ce5Lw+D3Q8JmUYeG97W/LUjksE9XXeFwPuLDFAvwmVbMVlNStqfTq3lGE5a
	 zNs+LFIPMFgB20uSqKXvJ9p/HCyNQ5h4h2ZhX7fOMiBCULuTV4ECb+OXCZuQ/+ggcLZZr
	 nbXl7u9i5L/zY+UvNgAQYX02boWCkSgPbF8Auzc1yKA4klR8ExTIuQAFew3PqZ/8rQUW6
	 uuJvonz/afOW84HhteMmImJ042hx7Iv+ZPVP3pzYmgF9bV6Wu19ObeH83DLHDhAODZWAn
	 tOfOH6QOi4xCzplJpKX2bbGEkbefOGhisbHnxwbE3lgTEvJSYqbtMKo/7ITcNf07kAQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793400028;
	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=vAF4izMEDM2y5cyzFb6fR/2GWqvZbCnGFDII4gspu00=;
	b=bk22Y7UWiCZ6j/TeOxE0+m1hGk65G1OPzEinFCidx6k8WOQUdC2F9J+SArv9PUb1GINA
	 ssLOhYzmfQAmLvTDe+gw21kXqQm5Cy1HGknWAtjC3fksbMnjURrNzk1lG5aP6RK5+pihF
	 20gt3seA1ZIESRS3HMYeC+b9PYzYn30/P7iLhS6yV/mMi+3CL4qgm9cTw8GIejYL2dTWD
	 OaHBhaC26h9ZK6iZD9/spv4PA3tnSJsS+M9YgGXu2BDgEUSy+qyob9s9IFWk5JHEEddyk
	 1RH1nLFpgI8LD4YaaotZJ2vWmYegB+GuSNoTXA2pO8dMRIexKNqfQkij33JnZxRoO5A==
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=Az9jdJKK;
	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 F0AAB60A2605;
	Fri, 30 Oct 2026 22:40:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Az9jdJKK
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=1793400027;
	b=yrQt2IV+F9Qsy3Lxth4DUFIpI2plz90ftIswLNM9Jek0hAW6aPQqu8+R3XbFI944FM2S
	 wFw4gZqLQPTM/E+AJLJ4PMyjrz0pLQWD2ddPseTk2L1640afNFqLcF03g+zVg7RQT2ldk
	 62w8WfWefLsEl1C6Ig2aq/nLjdHP7mjQ+YhnZGpF0bPyoGbgg22NS7ml93HLW6Qd3N1e6
	 iqYGkz22ONpFhcHtvwiUcLtFQgboTAFphtKljzGex59365KeN96J4El2/MvUtZfBcyilp
	 IiR/GALeggVwSvWbLrqT985n0o8d2fksW9Hg4+mR2yOVCLPFvUCPN40n6znPPkNJaSQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793400027;
	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=vAF4izMEDM2y5cyzFb6fR/2GWqvZbCnGFDII4gspu00=;
	b=X9+wATU+80XpQ/mTGy8AU8bMUAff1XU94KMivONIAcTBfeDPZsWueqQ3nQ+LSSJOSoFd
	 wSNHuESPmpsVSirz6OvBzeiZGWEC9a930lfG/+5TZKWgdHXDQFhU6HuCl3Ff+D5IAbrl6
	 n1iXasgME/DGPKs07nRezfePyifvIfApY3WakEc8xt7xEkhQuaLD9wNaMJ7Odwdpn+gdd
	 pMTjI8wDMfaCeeIIyWHuKo13gRxU2ecg34vgnTG8W3FRx8Pn6uTWJnMBROcKpYPY7Q24O
	 ieadkRRIK7sjJW6t83RCDN6JZ9EHZ2fibwcPjePROJlDcp24qd8U5WCl4hcgmLm7WLA==
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=Az9jdJKK;
	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 CF3EC606A331
	for <netdev@vger.kernel.org>; Fri, 30 Oct 2026 22:40:26 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F00051F00A15;
	Fri, 30 Oct 2026 22:40:25 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793400026;
	bh=vAF4izMEDM2y5cyzFb6fR/2GWqvZbCnGFDII4gspu00=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Az9jdJKKucZFt6Xh76zleft4cbmOw97yy2cPBqV5XYocSeU80MKEcraR+uW73tZ2P
	 h2x3aDVf1DX1Z9lw0T41qjy3Qc4h121Wsqa7rvERCN8S6v85KfbrBTlqMaNK3p8VY0
	 3S9HB45/iAQPjGRIXgY9Ww+/EtAxUxeGLmRjwGi+iPNDgoTX6kSx6Fzfz7l5kURuTB
	 xMCGKE6cMTbYjXphZq+uwwkVZmDdoC9Xd30wvda1LzeaFigpCnDqxdk3sxUxyT7Y41
	 HlBTYef8RH74T6FaN+kUTDobonOJlfYVfPfpB2e4l44YGkFynjRRYTp8WAETn+PXk1
	 JSdD+gAo4xy8g==
X-Cc: netdev@vger.kernel.org, sebaddel@cisco.com, aradhana@cisco.com,
 rfaucett@cisco.com, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com
X-In-Reply-To: <20261027-b4-enic-dma-vf-index-net-generic-first-v1-20261010-v3-1-ba237ed71241@cisco.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