Commit 3cbfa66
Mete Durlu
s390/pci: Serialize device addition and removal
JIRA: https://issues.redhat.com/browse/RHEL-94944
commit 774a1fa
Author: Niklas Schnelle <schnelle@linux.ibm.com>
Date: Thu May 22 14:13:15 2025 +0200
s390/pci: Serialize device addition and removal
Prior changes ensured that when zpci_release_device() is called and it
removed the zdev from the zpci_list this instance can not be found via
the zpci_list anymore even while allowing re-add of reserved devices.
This only accounts for the overall lifetime and zpci_list addition and
removal, it does not yet prevent concurrent add of a new instance for
the same underlying device. Such concurrent add would subsequently cause
issues such as attempted re-use of the same IOMMU sysfs directory and is
generally undesired.
Introduce a new zpci_add_remove_lock mutex to serialize adding a new
device with removal. Together this ensures that if a struct zpci_dev is
not found in the zpci_list it was either already removed and torn down,
or its removal and tear down is in progress with the
zpci_add_remove_lock held.
Cc: stable@vger.kernel.org
Fixes: a46044a ("s390/pci: fix zpci_zdev_put() on reserve")
Reviewed-by: Gerd Bayer <gbayer@linux.ibm.com>
Tested-by: Gerd Bayer <gbayer@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Mete Durlu <mdurlu@redhat.com>1 parent e579d6c commit 3cbfa66
1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| 77 | + | |
76 | 78 | | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| |||
838 | 841 | | |
839 | 842 | | |
840 | 843 | | |
| 844 | + | |
841 | 845 | | |
842 | 846 | | |
843 | 847 | | |
| |||
851 | 855 | | |
852 | 856 | | |
853 | 857 | | |
| 858 | + | |
854 | 859 | | |
855 | 860 | | |
856 | 861 | | |
857 | 862 | | |
858 | 863 | | |
859 | 864 | | |
| 865 | + | |
860 | 866 | | |
861 | 867 | | |
862 | 868 | | |
| |||
947 | 953 | | |
948 | 954 | | |
949 | 955 | | |
| 956 | + | |
950 | 957 | | |
951 | 958 | | |
952 | 959 | | |
| |||
0 commit comments