Public bug reported:

Description:   s390/pci: Fix immediate re-add of PCI function after
remove

Symptom:       A PCI function may be reserved directly after being
               deconfigured. If it subsequently returns back in the standby
               state Linux may not be able to use the new instance generating
               a kernel warning about trying to create an already existing
               sysfs file for the IOMMU.

Problem:       The problem occurs because the new instance of the same
               underlying device is created before the prior instance is
               completely torn down. This happens because the lifetime of the
               PCI device representation in Linux is determined by reference
               counts. A driver, the network stack, or even user-space
               (including via vfio-pci) may be holding onto the device
               represenation even after the underlying device is gone.

Solution:      The solution to this is twofold. Firstly allow re-using the
               pre-existing struct zpci_dev and/or struct pci_dev for the newly
               re-added instance of the underlying device up until the point
               where the struct zpci_dev is fully removed. Secondly serialize
               the addition and removal of PCI functions such that re-adding
               a new instance, after the old one is already being removed, will
               wait for the removal to finish before adding the new instance.
               This fix also builds on prior upstream work of serializing state
               transitions for PCI devices e.g. from configured to standby.

Reproduction:  This problem was originally found with firmware which
               temporarily reserves NETH PCI functions to check for pending
               service when the last FID of a PCHID is deconfigured. When
               nothing is pending the PCI function is immediately returned in
               the standby state, thus triggering this issue quite reliably.

Upstream-ID:   0d48566d4b58946c8e1b0baac0347616060a81c9
               bcb5d6c769039c8358a2359e7c3ea5d97ce93108
               6ee600bfbe0f818ffb7748d99e9b0c89d0d9f02a
               c4a585e952ca403a370586d3f16e8331a7564901
               42420c50c68f3e95e90de2479464f420602229fc
               05a2538f2b48500cf4e8a0a0ce76623cc5bafcf1
               d76f9633296785343d45f85199f4138cb724b6d2
               47c397844869ad0e6738afb5879c7492f4691122
               4b1815a52d7eb03b3e0e6742c6728bc16a4b2d1d
               774a1fa880bc949d88b5ddec9494a13be733dfa8

** Affects: linux (Ubuntu)
     Importance: Undecided
     Assignee: Skipper Bug Screeners (skipper-screen-team)
         Status: New


** Tags: architecture-s39064 bugnameltc-213761 severity-high 
targetmilestone-inin---

** Tags added: architecture-s39064 bugnameltc-213761 severity-high
targetmilestone-inin---

** Changed in: ubuntu
     Assignee: (unassigned) => Skipper Bug Screeners (skipper-screen-team)

** Package changed: ubuntu => linux (Ubuntu)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2114174

Title:
  [UBUNTU 24.04] s390/pci: Fix immediate re-add of PCI function after
  remove

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2114174/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to