🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27157

Re: [PATCH net-next V4 5/5] net/mlx5: nodnic: Add health monitoring

#27157
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 21:45
137 lines
13286 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 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 a fatal condition the new health monitor marks the device
  as unhealthy, but the only thing that ever acts on that mark is the…

--

net/mlx5: nodnic: Add health monitoring

This adds a timer that polls the firmware health buffer in the
initialization segment every two seconds. It detects fatal device
conditions, health counter stalls and syndrome changes, logs them with
their severity, and marks the device as being in an internal error
state. Probe starts the polling and remove stops it.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/nodnic/en_cfg.c b/drivers/net/ethernet/mellanox/mlx5/nodnic/en_cfg.c
> index 8eebd86e7a747..a45f651ed9ac2 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/nodnic/en_cfg.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/nodnic/en_cfg.c
> @@ -919,6 +919,12 @@ static int mlx5_nodnic_open_locked(struct net_device *netdev)
>  	struct mlx5_nodnic_core_dev *dev = priv->core_dev;
>  	int err;
>  
> +	if (READ_ONCE(dev->state) == NODNIC_DEVICE_STATE_INTERNAL_ERROR) {
> +		netdev_err(netdev,
> +			   "Cannot open: device is in a fatal error state\n");
> +		return -EIO;
> +	}
> +
>  	err = mlx5_nodnic_init_uar_map(dev);
>  	if (err)
>  		return err;
> diff --git a/drivers/net/ethernet/mellanox/mlx5/nodnic/health.c b/drivers/net/ethernet/mellanox/mlx5/nodnic/health.c
> new file mode 100644
> index 0000000000000..a2038eea9717f
> --- /dev/null
> +++ b/drivers/net/ethernet/mellanox/mlx5/nodnic/health.c

[ ... ]

> +static void mlx5_nodnic_poll_health(struct timer_list *t)
> +{
> +	struct mlx5_nodnic_priv *priv = timer_container_of(priv, t,
> +							   health.timer);
> +	struct mlx5_nodnic_core_dev *dev = priv->core_dev;
> +	struct mlx5_nodnic_health *health = &priv->health;
> +	struct health_buffer __iomem *h = health->health;
> +	u32 fatal_error, count;
> +	u8 prev_synd;
> +
> +	if (READ_ONCE(dev->state) == NODNIC_DEVICE_STATE_INTERNAL_ERROR)
> +		return;
> +
> +	fatal_error = mlx5_nodnic_health_check_fatal_sensors(dev);
> +
> +	if (fatal_error && !health->fatal_error) {
> +		mlx5_nodnic_core_err(dev, "fatal error detected: %s (%u)\n",
> +				     mlx5_nodnic_fatal_error_str(fatal_error),
> +				     fatal_error);
> +		priv->health.fatal_error = fatal_error;
> +		WRITE_ONCE(dev->state, NODNIC_DEVICE_STATE_INTERNAL_ERROR);
> +		if (fatal_error != MLX5_NODNIC_SENSOR_PCI_COMM_ERR &&
> +		    fatal_error != MLX5_NODNIC_SENSOR_PCI_ERR)
> +			mlx5_nodnic_print_health_info(dev);
> +		return;
> +	}

[Severity: Medium]
Is setting the state flag enough when the netdev is already open? Any of
the five fatal sensors (PCI error, PCI comm error, NIC disabled, NIC SW
reset, FW RFR) takes this branch. It logs, sets dev->state to
NODNIC_DEVICE_STATE_INTERNAL_ERROR, and returns without re-arming the
timer.

This branch calls none of netif_carrier_off(), netif_device_detach(),
napi_disable() or mlx5_nodnic_deactivate_queues(). Carrier stays up, NAPI
keeps re-arming the CQ, and ndo_start_xmit keeps ringing UAR doorbells on
a device that is reset, disabled or unreachable.

In the nodnic directory, dev->state is written in only two places:
mlx5_nodnic_probe_one() sets it to UP and this branch sets it to
INTERNAL_ERROR. It is read in only two places: the early return at the
top of mlx5_nodnic_poll_health() and the new check in
mlx5_nodnic_open_locked().

Nothing resets the state to UP, and the timer is not re-armed after this
branch. The pci_driver also has no err_handler or
reset_prepare/reset_done hooks.

Given that, can a single transient trigger make every later open fail
with -EIO until the driver is unbound and rebound? One example would be
sensor_pci_not_working() reading fw_ver == 0xffffffff once.

The close and remove paths also ignore the new state. These calls still
run VSC handshakes against a device already known to be dead:

mlx5_nodnic_close_locked()->mlx5_nodnic_deactivate_queues()
mlx5_nodnic_dev_cleanup()->mlx5_nodnic_write_nic_interface()
mlx5_nodnic_dev_cleanup()->mlx5_nodnic_wait_fw_init()

The waits are bounded by MLX5_NODNIC_FW_INIT_TIMEOUT_MS, and this
teardown behaviour predates the patch. Should these paths skip the
handshake once INTERNAL_ERROR is set?

For comparison, mlx5 core pairs these same sensors with
mlx5_enter_error_state() and health recovery work.

The commit message says:

  "Report health errors together with their severity and mark the
  device as unhealthy on fatal conditions."

Could it state that the only visible effect of the mark is a permanent
-EIO from ndo_open? The new mlx5_nodnic_printk() and mlx5_nodnic_log()
helpers in nodnic.h are not mentioned in the commit message either.

> +
> +	count = ioread32be(health->health_counter);
> +	if (count == health->prev_counter)
> +		++health->miss_counter;
> +	else
> +		health->miss_counter = 0;

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203205721.4090361-1-tariqt%40nvidia.com
Technical Details
Message-ID: <179642074964.3146.12790578096162085018@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377663-linux-kernel-netdev=dewy.ru
References: <20261203205721.4090361-6-tariqt@nvidia.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377663-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next V4 5/5] net/mlx5: nodnic: Add health monitoring
Date: Fri, 04 Dec 2026 21:45:49 +0000
Organization: Usenet Network
Message-ID: <179642074964.3146.12790578096162085018@kernel.org>
References: <20261203205721.4090361-6-tariqt@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2879022"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:II7pHi0BimmOHueA9vJiBk0X8IE= sha256:jZgkRQBS33LZP/QUnHWi7EIm5xoRliKzTzriBxHh1f0=
	sha1:j8nN6PeLRxABsQQI8QgR0b/Ofvc= sha256:o7U3s6pOgL8Tj2//1zQ8aqxih86fY793IsMWcc/3hHM=
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 DAA69117D01; Sat,  5 Dec 2026 00:46:07 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.641
X-Spam-Status: No, score=-3.641 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.142, 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 Z60c-zjWdDno;
	Sat,  5 Dec 2026 00:46:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-377663-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id CB426117CFC; Sat,  5 Dec 2026 00:45:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 0FA7F604229; Fri,  4 Dec 2026 21:45:56 +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=1796420752;
	b=DkLHE7Uneu5VexTKrSgYOKSjxH5PbGny8uDTypKTYj50qjVv6kcaxXFsqzRQyyxWlGhx
	 gF/leRHFnuKFNxwVldw5eytQIbNZ9bGp0junwVrYoHTe3HZdWAYOkmHaojCP1Rs4cWQ+S
	 1p1zZ5onq85fI3GfKXawsl5cHKbYvDBP5pgqs2Dq4BIPTQ1NSh0MoImOt0Rn2/UP0L31l
	 NeS5mdKVthvOj/zBjTlQ7aA6TDrS7WJQ8S0zcdVQaa460f2OWp0XXkFfa72kJ5PMubPO4
	 Nq0vyqkV1bySM93RtbHijQC808zpWUkvR+I+h01ZCQ8vbr7f8w7QVDvdF8DZ8SHhaCA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796420752;
	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=33xIygk9KQLetcvO2sjPVcAmenQjw6dQs8LpLDyez9o=;
	b=mwCbU5iGoOqpS13LyIjcf8p9Y2Td5pAPqwtjKOBr9jyao8oF1sXGRwSmZwAFThJ5j3Xi
	 PyJEMtnWEqUgMNM4K9iIpwCbesBIiEI2uEszUlbDup/HGNpnEQF6gw9xtb6/y2bFICQKc
	 ebaJ32b/yT5BsFRYuzStdpkI5OhbcfBDI5ZEvmb8OQwL3O9TtvQ2H/3na2ET5XuLWjYN7
	 gi5o3oqiSq9Ob7W+1X92x3D1P0sM7Nt+WCVdLaH4FyOTQzDMAopMwdVIsLlMfcBkij3uO
	 cP5szYOoHClDx9qGqgiB8WtFD9HCkJ/iDK/h7ql+EO+b6tf38BRr2UljPyMFGETRdFw==
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=YDqjGHwO;
	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 EC7E4606A68C;
	Fri,  4 Dec 2026 21:45:51 +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=YDqjGHwO
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=1796420751;
	b=Jb3SsXtZp6TEdvN9Eu9yqCYb/EyeSYPStBkZr/B4mGDQyyQlJ3t6jvsS795To2F8h0br
	 mmItO/TN463jjGrERTtzt1f0tSy6V9DxxOxIorlHKD12OwI0UaVbak+gSsbR/QCiM53UQ
	 xWa7Lmr6XtzxrG/TmysuGQ5WgoNIDFIh2KK5gmztk8FTlh+f0EtWznqLDwwxGmqcTrrkf
	 bQO7xMEm9R6gpW1covP8z3X4CsyQpz+KERFQiQWEpLBgcK9eqI22yDhY4lTXhICZfQv6T
	 VN4593nlVmfKbVeQynEJn3x782mKurS7Om6Fe3e8HpO/hymNv7VVRjpoomMwVMLTv1Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796420751;
	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=33xIygk9KQLetcvO2sjPVcAmenQjw6dQs8LpLDyez9o=;
	b=DQUTBZWK6BBr9ttlYl41jVpVMN17iwlq6SBSNT8COgkr+UgIQhfmSRnaTTPeH6nHcMgB
	 /yho0aR23I7IkEEyuHo6mGLvMn3OXxFNw+QPLycGpXFtNGZ0Z+dOnrUvgAyydrY9CjL4/
	 RSRoLxg6rovoSqyCB9/PJp7xfC9pTmWiJ8Q/0i9cBNdyhYO60epnBnyqJLb/nHLePxU/j
	 C5DNARvBL70/b7iV1MkavntOXqnDaVeqHtNnnCS5CmQYzKTPCF5lmplaw8mFQpOlt2BYD
	 nuOeIrBsfIaaCxKXsASYmckcTn5b04vyFkAeTe8bBiDx5DGBF08aGS0UMoNQZWaLUjw==
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=YDqjGHwO;
	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 1999D606A6A3;
	Fri,  4 Dec 2026 21:45:50 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19C0D1F00A17;
	Fri,  4 Dec 2026 21:45:50 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796420750;
	bh=33xIygk9KQLetcvO2sjPVcAmenQjw6dQs8LpLDyez9o=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=YDqjGHwO9iwaz1Bms9OfBPdDzZWDeVCKflA4w6mX7xYM2TUr09KjLdi/vhI6Aqfoo
	 OAysQ1hkwkyMHrsG9X9r3FUqf4//vk6SrQbqqEsAiiio4QnNPSMhlpQ8xqKt5BLz3P
	 ARCkVnq+dSw2JtURnhG/pd1fL8cIfm3uef+jcLTbt/vMHV0aqgPBuGP92VrhdZgZuM
	 38OfkMB9zGZy0jMXnJp/uNPWeZJ4RFzxr1XxH/X7IGo3PQW+dQPQKrSacpZkxbk0M+
	 +RxE1bmOGALBKJOtzr6hkZhzf+cZOLkVkzt54/V/SvutItg6eEMrgB9DBFfpDQGn1f
	 RZzeSNHrGCJBg==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com,
 willemb@google.com, cjubran@nvidia.com, gal@nvidia.com,
 linux-kernel@vger.kernel.org, shshitrit@nvidia.com
X-In-Reply-To: <20261203205721.4090361-6-tariqt@nvidia.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