🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22075

Re: [PATCH net-next v1 2/2] mlxbf_gige: disable MAC after kernel panic

#22075
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 20:44
204 lines
15476 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 2

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] The new MAC quiesce never runs on the kdump path, so after a
  panic the pause-frame storm the commit message describes can still…
- [Medium] The commit message says the notifier "disables MAC RX and
  clears the RX FIFO".
- [Low] The commit fixes a production failure: after a panic, the
  BlueField internal switch stops traffic to the OOB host and DPU-BMC.
- [Low] mlxbf_gige_on_panic() clears MLXBF_GIGE_CONTROL_PORT_EN (in
  mlxbf_gige_disable_port()) and only then calls mlxbf_gige_clean_port().

--

mlxbf_gige: disable MAC after kernel panic

This commit registers a panic notifier at INT_MAX priority from
mlxbf_gige_probe(). On panic, the notifier disables RX DMA, the port and
interrupts, then soft-resets the port with mlxbf_gige_clean_port(). The
goal is to stop the MAC from filling the RX FIFO and sending pause frames
to the internal BlueField switch.

> Register a panic notifier at highest priority that disables MAC RX and
> clears the RX FIFO to ensure that the MAC can no longer receive packets
> or send pause frames.
>
> Signed-off-by: Chris Babroski <cbabroski@nvidia.com>

[Severity: Low]
Should this carry a Fixes: tag, and possibly Cc: stable?

The commit message describes a user-visible failure: after a panic, the
internal switch stops traffic to the OOB host and DPU-BMC. The missing
panic-time quiesce goes back to when the driver was added:

Fixes: f92e1869d74e ("Add Mellanox BlueField Gigabit Ethernet driver")

> diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
> index d1f8a72cae537..76da711083453 100644
> --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
> +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c

[ ... ]

> @@ -127,6 +128,27 @@ static int mlxbf_gige_clean_port(struct mlxbf_gige *priv)
>  	return err;
>  }
>  
> +static void mlxbf_gige_disable_port(struct mlxbf_gige *priv)
> +{
> +	u64 control;
> +
> +	/* Disable RX DMA */
> +	control = readq(priv->base + MLXBF_GIGE_RX_DMA);
> +	control &= ~MLXBF_GIGE_RX_DMA_EN;
> +	writeq(control, priv->base + MLXBF_GIGE_RX_DMA);
> +
> +	/* Disable port */
> +	control = readq(priv->base + MLXBF_GIGE_CONTROL);
> +	control &= ~MLXBF_GIGE_CONTROL_PORT_EN;
> +	writeq(control, priv->base + MLXBF_GIGE_CONTROL);
> +
> +	/* Disable interrupts */
> +	writeq(0, priv->base + MLXBF_GIGE_INT_EN);

[Severity: Medium]
The commit message says the notifier "disables MAC RX and clears the RX
FIFO". This code goes further. It clears MLXBF_GIGE_CONTROL_PORT_EN for
the whole port and zeroes MLXBF_GIGE_INT_EN, and then
mlxbf_gige_on_panic() soft-resets the port with mlxbf_gige_clean_port().

Can this break netconsole on this interface during a panic?

netconsole registers as an atomic-unsafe nbcon console:

drivers/net/netconsole.c:
	con->flags = CON_ENABLED | CON_NBCON | CON_NBCON_ATOMIC_UNSAFE | flags;

During a panic, these consoles only print from nbcon_atomic_flush_unsafe().
vpanic() calls that long after the notifier chain:

kernel/panic.c:vpanic() {
    ...
	atomic_notifier_call_chain(&panic_notifier_list, 0, buf);
    ...
	console_flush_on_panic(CONSOLE_FLUSH_PENDING);
	nbcon_atomic_flush_unsafe();
    ...
}

At INT_MAX priority, this notifier runs first in the chain. Suppose a
netconsole target is bound to the mlxbf_gige OOB port. The pending panic
output (the "Kernel panic - not syncing" line, the backtrace, the
panic_print output) then goes out through netpoll ->
mlxbf_gige_start_xmit() on a port that is already disabled and reset.

Wouldn't that output be lost without any warning? This assumes that
clearing PORT_EN and doing the soft reset also stop TX. The commit message
relies on the same assumption when it says the MAC can no longer send
pause frames.

The commit message also doesn't cover the TX side, the netconsole
interaction, or why INT_MAX priority is needed. Could it be updated to
explain these?

[ ... ]

> @@ -382,6 +404,17 @@ static struct mlxbf_gige_link_cfg mlxbf_gige_link_cfgs[] = {
>  	}
>  };
>  
> +static int mlxbf_gige_on_panic(struct notifier_block *nb,
> +			       unsigned long action, void *data)
> +{
> +	struct mlxbf_gige *priv;
> +
> +	priv = container_of(nb, struct mlxbf_gige, panic_nb);
> +	mlxbf_gige_disable_port(priv);
> +	mlxbf_gige_clean_port(priv);
> +	return NOTIFY_DONE;
> +}

[Severity: Low]
Does the hardware support doing these steps in this order?
mlxbf_gige_disable_port() clears PORT_EN before mlxbf_gige_clean_port()
runs. Until now the driver has always called clean_port with the port
enabled. For example, in mlxbf_gige_open():

	control = readq(priv->base + MLXBF_GIGE_CONTROL);
	control |= MLXBF_GIGE_CONTROL_PORT_EN;
	writeq(control, priv->base + MLXBF_GIGE_CONTROL);

	mlxbf_gige_cache_stats(priv);
	err = mlxbf_gige_clean_port(priv);

mlxbf_gige_stop() also calls mlxbf_gige_clean_port() with PORT_EN still
set.

The CLEAN_PORT_EN soft reset may need the port enabled to flush the RX
FIFO and raise MLXBF_GIGE_STATUS_READY. If so, readq_poll_timeout_atomic()
in mlxbf_gige_clean_port() would spin for 100ms and then return
-ETIMEDOUT.

Because the return value is ignored here, the RX FIFO could stay full
with nothing reported. Would it make sense to clean the port before
clearing PORT_EN, or at least log the timeout?

[ ... ]

> @@ -446,6 +479,10 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
>  	/* Write initial MAC address to hardware */
>  	mlxbf_gige_initial_mac(priv);
>  
> +	priv->panic_nb.priority = INT_MAX;
> +	priv->panic_nb.notifier_call = mlxbf_gige_on_panic;
> +	atomic_notifier_chain_register(&panic_notifier_list, &priv->panic_nb);

[Severity: Medium]
Does this handle the kdump case? Suppose a crash kernel is loaded and
crash_kexec_post_notifiers is left at its default. vpanic() then hands
control to the crash kernel before the panic notifier chain runs:

kernel/panic.c:vpanic() {
    ...
	if (!_crash_kexec_post_notifiers)
		__crash_kexec(NULL);
    ...
	atomic_notifier_call_chain(&panic_notifier_list, 0, buf);
    ...
}

In that case mlxbf_gige_on_panic() never runs. PORT_EN, RX_DMA_EN and
the broadcast, local MAC and multicast RX filters all stay enabled. The
RX WQ and CQ still point at the panicked kernel's buffers.

Once those WQEs are used up, wouldn't the RX FIFO fill again and bring
back the pause frame storm the commit message describes?

The crash kernel's mlxbf_gige_probe() only partly helps:

	for (i = 0; i <= MLXBF_GIGE_MAX_FILTER_IDX; i++)
		mlxbf_gige_disable_mac_rx_filter(priv, i);
	mlxbf_gige_disable_multicast_rx(priv);
	mlxbf_gige_disable_promisc(priv);

Probe never clears RX_DMA_EN or PORT_EN and never calls
mlxbf_gige_clean_port(). A FIFO that is already full only gets drained if
the crash kernel opens the interface, or at the reboot after the dump. If
the crash kernel doesn't load this driver at all, nothing quiesces the
port.

Should probe also fully quiesce and clean the port?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795206150.git.cbabroski%40nvidia.com
Technical Details
Message-ID: <179555306172.3135.17558460540880182095@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.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-370744-linux-kernel-netdev=dewy.ru
References: <8fa3f8fcbdc45e58b815261d6c2c1decd884f5d1.1795206150.git.cbabroski@nvidia.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.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-370744-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v1 2/2] mlxbf_gige: disable MAC after kernel panic
Date: Tue, 24 Nov 2026 20:44:21 +0000
Organization: Usenet Network
Message-ID: <179555306172.3135.17558460540880182095@kernel.org>
References: <8fa3f8fcbdc45e58b815261d6c2c1decd884f5d1.1795206150.git.cbabroski@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="34554"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:VUmv8lNrG9GvaKbYi3xkq2qbIbA= sha256:xM4SA3u7PVK24T9pFu0jlEybnaALcWyPY4FEWXv85LA=
	sha1:gMAvzKp6F74Fz1q2o0sP6/qpjyM= sha256:JLqcAire3oRCbumFZgasi/eX0c9TWnvUOqBpx4N4KPU=
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 1F33E125E2F; Tue, 24 Nov 2026 23:44:39 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 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] 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 fZVksayacKIM;
	Tue, 24 Nov 2026 23:44:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-370744-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id C64BE125E29; Tue, 24 Nov 2026 23:44:26 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id B4B7637449; Tue, 24 Nov 2026 20:44:24 +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=1795553063;
	b=TDCjbSVogaGb3W8RDjTAXsCzwTP6fs6UZPLwGyiV7cuhg4JbI3/Io7p3QCVnZaU7OdeS
	 hSVRI/COob3UZEOv7oXF/ZGfNQtrUWZRiaTTzSm5TTv5z7cKWoxw7sjzQnNd/uqbB3Skw
	 zi1Pw9s4Ii7LR5D2n4bcpvwLqyYt5YHBUX5FWoeiUVnDfWEw7kNWsyWD8Ceeau557zM8s
	 HdwACNFSfXnHJWReWh5A7ybApjL/EX0Cu+ygcEBEl5Kk/ioOEtAQupFPnQ2WqFpRGeCnu
	 MKUOiOr1bDc9FoG/95c6rXYaPufNOPoiJKURa/Y5JORRK86K1u5ctWn1pVRr3ehr4Cw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795553063;
	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=L6k6T4UCg/mlQgXOscfGpTUcZC4AOa82L9wFRM0YO2M=;
	b=wHmN1oWlUQML6q5Otd2GAr68DwpteAXvDFHoH80XzkkGj546ujdL/v4eWxkKQe/1bzYg
	 CzJwdFV4Ph8eLJr+VmDJ1I3akQaPbfCL258uaMhbNBs/wJYqRbgImkr1NbsAraui93k+p
	 y7OMYTMvj+8lTIyQ1IMR0yeVcj9yKrFXRbARuT/wPcM5/R+mVYmSVb6KpnfZV3qUB2zUb
	 uifFobDB4P+TYHCGBSegdosO9a9Kqy47MTr8RmVKQqYPkCuvqbFjvytqzJwcpTF28Guw/
	 1mVGEqSdWLqQUgh2ugy0D9DQmVBuUX0bhPuMAOE3bj0g9bOUDGmi+iVUgzl3/hjkQrw==
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=HDw3RxwD;
	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 BAD45606A33F;
	Tue, 24 Nov 2026 20:44:23 +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=HDw3RxwD
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=1795553062;
	b=tXUKSpvnt9wqRcrT2vcNT0wePFDQSEkxCiaJkojBiPBh45+38p1Ita5k6lfn3AwGb95v
	 L0V3JMb+pSAwj0F7MpYqpt+4ixUmnVS4YKt2I8/BAqvPvkrQNcGmeJCf0lp2vMneJDPM0
	 Az7+hA8yRq4NyfHfHk64cadgyFXtaETI6j0zi0ToA3ZKePKlz1gA4PNCMhO0RBoJRWCre
	 9LXJ7Atu3XjcUo7yOvJ2aGvoHvctC+8HIiqCcnXDo+XnfNuT9PftTkMNmDH3K+gcfKYlF
	 FiB+V0Y+crH+AnR6tl20q28/gLtfh8ND/eAhGZi/lNX9RPPgT3hgictRIdIgCXS2DlQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795553062;
	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=L6k6T4UCg/mlQgXOscfGpTUcZC4AOa82L9wFRM0YO2M=;
	b=yuA79mbvYckUyPq6epJpJ0BtNYhkwbpOPEodEQqkFleQcTqReYxwVoUgUAPO4PZUmVW2
	 ixuJ4AJ5prCn0isqeaCl52mN06pvlfMAlro5EpIETaJq4AjtgmzMYw7UZnY2F+bi8/R9B
	 yu7x/FWeon5pD2dhQy0Fq7YyCEc8tZq6wDaDsu6tg2jBvD+pzyji9cW4QO9wAISO+QJTe
	 9J/GlLCgotPUm2a/k1c0ypMhIDOnhB6B67HIzRd5s55QnlNKD6e3RLW5tjn+Q9XTM0Qy4
	 SD3xQk55FMQjcboPP9VwapTk4twve/ZloB7OA42zkz8r3hcQdZ/ihMUTqVWW0hbqGbg==
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=HDw3RxwD;
	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 DD91D606A32D;
	Tue, 24 Nov 2026 20:44:22 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D11E1F000C0;
	Tue, 24 Nov 2026 20:44:22 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795553062;
	bh=L6k6T4UCg/mlQgXOscfGpTUcZC4AOa82L9wFRM0YO2M=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=HDw3RxwDotH+4/n10s0jGDb55Ljb+32sG2LjWP2CrBqVJ3UD8VhxZXZqzhd0c84bw
	 03H5WqZktXTKXTdhzjZr19zrvcpLWiH6hf90LEU6lo+OtH6lRNOg4ASUw8QqDMsuGE
	 FNeIxmuwK5ipCCqX3gmyIz/B2wGeosYVdytpd2VsO0mscfblDGvaI6412LPq9Uhat7
	 gQNH2OZ4SPD3l4fN0G9l/4EG8eAsqF1KgfUy0ar0wEt/+VCjuz0CzXxopj6lYB7BaI
	 kQbKV0WHIf8eDhCXpsj9ig0689nugrxB694CXjeu7XjZlYHblebfaOg1L6IRgyjxw3
	 bR5ZHQTeA6GTQ==
X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
 andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, davthompson@nvidia.com
X-In-Reply-To: <8fa3f8fcbdc45e58b815261d6c2c1decd884f5d1.1795206150.git.cbabroski@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