Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: tariqt@nvidia.com
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
Subject: Re: [PATCH net-next V4 5/5] net/mlx5: nodnic: Add health monitoring
Date: Fri, 04 Dec 2026 21:45:49 +0000	[thread overview]
Message-ID: <179642074964.3146.12790578096162085018@kernel.org> (raw)
In-Reply-To: <20261203205721.4090361-6-tariqt@nvidia.com>

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

      reply	other threads:[~2026-12-04 21:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 20:57 [PATCH net-next V4 0/5] net/mlx5: Introduce mlx5_nodnic, a driver for DRAM-less NVIDIA Mellanox NIC functions Tariq Toukan
2026-12-03 20:57 ` [PATCH net-next V4 1/5] net/mlx5: nodnic: Introduce the mlx5_nodnic driver Tariq Toukan
2026-12-04 21:45   ` netdev-bot+sashiko
2026-12-03 20:57 ` [PATCH net-next V4 2/5] net/mlx5: nodnic: Implement data path Tariq Toukan
2026-12-04 21:45   ` netdev-bot+sashiko
2026-12-03 20:57 ` [PATCH net-next V4 3/5] net/mlx5: nodnic: Add TX/RX statistics Tariq Toukan
2026-12-04 21:45   ` netdev-bot+sashiko
2026-12-03 20:57 ` [PATCH net-next V4 4/5] net/mlx5: nodnic: Add ethtool driver info Tariq Toukan
2026-12-03 20:57 ` [PATCH net-next V4 5/5] net/mlx5: nodnic: Add health monitoring Tariq Toukan
2026-12-04 21:45   ` 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=179642074964.3146.12790578096162085018@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=cjubran@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shshitrit@nvidia.com \
    --cc=tariqt@nvidia.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