BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniel Machon" <daniel.machon@microchip.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v8 10/15] net: lan966x: add shutdown callback to stop the FDMA on reboot
Date: Fri, 25 Sep 2026 19:59:10 +0000	[thread overview]
Message-ID: <20260925195910.A70581F0089D@smtp.kernel.org> (raw)
In-Reply-To: <20260924-lan966x-pci-fdma-v8-10-201c7b707d8b@microchip.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: lan966x: missing stats_work cancellation in shutdown causes reboot hang
--

commit 2e6f47e0410ffe79c3ff982d925010362cdb3723
Author: Daniel Machon <daniel.machon@microchip.com>
net: lan966x: add shutdown callback to stop the FDMA on reboot

This commit adds a shutdown callback to properly quiesce the lan966x PCIe
endpoint during a host reboot. It stops FDMA channels, disables interrupts,
and unmaps ATU windows to prevent the hardware from continuing to assert
INTx or access host memory across restarts.

> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> index 259d81e759076..024ce9f9916c7 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
[ ... ]
> @@ -1324,9 +1324,65 @@ static void lan966x_remove(struct platform_device *pdev)
[ ... ]
> +static void lan966x_shutdown(struct platform_device *pdev)
> +{
> +	struct lan966x *lan966x = platform_get_drvdata(pdev);
> +
> +	/* As a PCIe endpoint the switch is not reset by the host reboot, so it
> +	 * has to be quiesced here:
> +	 *
> +	 *   Free the irqs and mask the sources: no source can assert INTx.
> +	 *   Disable NAPI: the teardown must not race a poll.
> +	 *   Stop and detach the netdevs: drains xmit, closes ndo_open and MTU.
> +	 *   Stop the FDMA channels: waits for the engine to go idle.
> +	 *   Unmap the ATU windows: revokes the engine's access to host memory.
> +	 */
> +	if (!lan966x_is_pci(lan966x))
> +		return;
> +

[Severity: High]
Does this code leave the stats_work delayed work running after the PCIe
endpoint is disabled?

When the system reboots, the new lan966x_shutdown() callback is executed to
quiesce the hardware. The PCI core subsequently disables the endpoint, but if
the stats_work background task fires and calls lan966x_stats_update(), it
will read from the disabled hardware via MMIO.

Accessing memory-mapped PCI registers after the PCI link or memory space has
been disabled typically results in a completion timeout or Unsupported
Request. This escalates to a PCIe AER fault or SError (NMI), panicking the
kernel and hanging the reboot process.

Unlike lan966x_remove(), which explicitly calls
cancel_delayed_work_sync(&lan966x->stats_work), lan966x_shutdown() appears
to omit this cancellation. Could the delayed work fire during reboot after
this shutdown path executes?

> +	if (lan966x->xtr_irq > 0)
> +		devm_free_irq(lan966x->dev, lan966x->xtr_irq, lan966x);
> +	if (lan966x->ana_irq > 0)
> +		devm_free_irq(lan966x->dev, lan966x->ana_irq, lan966x);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260924-lan966x-pci-fdma-v8-0-201c7b707d8b@microchip.com?part=10

  reply	other threads:[~2026-09-25 19:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 19:56 [PATCH net-next v8 00/15] net: lan966x: add support for PCIe FDMA Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 01/15] MAINTAINERS: add FDMA library to Sparx5 SoC entry Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 02/15] net: microchip: fdma: rename contiguous dataptr helpers Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 03/15] net: microchip: fdma: add PCIe ATU support Daniel Machon
2026-09-25 20:52   ` netdev-bot+sashiko
2026-09-24 19:56 ` [PATCH net-next v8 04/15] net: microchip: fdma: use little-endian types for descriptor fields Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 05/15] net: lan966x: add FDMA LLP register write helper Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 06/15] net: lan966x: export FDMA helpers for reuse Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 07/15] net: lan966x: use a dedicated device for DMA operations Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 08/15] net: lan966x: add FDMA ops dispatch for PCIe support Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 09/15] net: lan966x: clear FDMA interrupt stickies after switch reset Daniel Machon
2026-09-25 20:52   ` netdev-bot+sashiko
2026-09-24 19:56 ` [PATCH net-next v8 10/15] net: lan966x: add shutdown callback to stop the FDMA on reboot Daniel Machon
2026-09-25 19:59   ` sashiko-bot [this message]
2026-09-25 20:52   ` netdev-bot+sashiko
2026-09-24 19:56 ` [PATCH net-next v8 11/15] net: lan966x: add PCIe FDMA support Daniel Machon
2026-09-25 19:59   ` sashiko-bot
2026-09-25 20:52   ` netdev-bot+sashiko
2026-09-24 19:57 ` [PATCH net-next v8 12/15] net: lan966x: add PCIe FDMA MTU change support Daniel Machon
2026-09-25 20:52   ` netdev-bot+sashiko
2026-09-24 19:57 ` [PATCH net-next v8 13/15] net: lan966x: add PCIe FDMA XDP support Daniel Machon
2026-09-25 19:59   ` sashiko-bot
2026-09-25 20:52   ` netdev-bot+sashiko
2026-09-28 11:02     ` Daniel Machon
2026-09-24 19:57 ` [PATCH net-next v8 14/15] misc: lan966x-pci: dts: extend cpu reg to cover PCIE DBI space Daniel Machon
2026-09-25 20:52   ` netdev-bot+sashiko
2026-09-24 19:57 ` [PATCH net-next v8 15/15] misc: lan966x-pci: dts: add fdma interrupt to overlay Daniel Machon
2026-09-25 20:52   ` netdev-bot+sashiko

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=20260925195910.A70581F0089D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel.machon@microchip.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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