Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] Calling `pci_disable_sriov()` in the PF's `shutdown` path forces the 
teardown of already-shut-down VFs, triggering a `dev_WARN_ONCE` stack trace 
that can cause a kernel panic on shutdown.
--

--- Patch [1]: [PATCH net-next v3] net: mana: Add handler for sriov configure 
---
commit 4f33a45546e7a470eda04866cd0e6294bcfd526c
Author: Haiyang Zhang <[email protected]>

net: mana: Add handler for sriov configure

This patch adds an SR-IOV configuration handler to the mana driver, allowing
it to request or disable VFs. It also adds SR-IOV disable calls to the
device remove and shutdown paths.

> diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c 
> b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> index e8b7ffb47eb98..dff66a2a4f598 100644
> --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
[ ... ]
> @@ -2488,6 +2490,8 @@ static void mana_gd_shutdown(struct pci_dev *pdev)
>  
>       dev_info(&pdev->dev, "Shutdown was called\n");
>  
> +     pci_disable_sriov(pdev);
> +

[Severity: High]
Will this trigger a kernel warning during system shutdown when VFs are active?

During system shutdown, the driver core calls device_shutdown() iterating in
reverse creation order. First, it calls mana_gd_shutdown() on the VFs, which
partially tears down the VF and disables the PCI device:

mana_gd_shutdown()
    ...
    pci_disable_device(pdev); 

Next, device_shutdown() calls mana_gd_shutdown() on the PF. Calling
pci_disable_sriov() here destroys the VF PCI devices and unregisters them
from the bus, which synchronously forces a call to the VF's remove callback:

mana_gd_remove()
    ...
    pci_disable_device(pdev); 

Since pci_disable_device() is called unconditionally at the end of both
mana_gd_shutdown() and mana_gd_remove(), this second call detects that the
device is already disabled and fires a warning. On production systems with
panic_on_warn=1, this converts a normal shutdown into a kernel panic.

>       mana_rdma_remove(&gc->mana_ib);
>       mana_remove(&gc->mana, true);
[ ... ]

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to