diff options
| author | Robin Murphy <robin.murphy@arm.com> | 2025-04-24 20:41:28 +0300 |
|---|---|---|
| committer | Joerg Roedel <jroedel@suse.de> | 2025-04-28 14:31:18 +0300 |
| commit | da33e87bd2bfc63531cf7448a3cd7a3d42182f08 (patch) | |
| tree | fba7d653a9169acdd6331987704aafc38300b931 /include | |
| parent | 6f7340120a0aa8b2eb29c826a4434e8b5c4e11d3 (diff) | |
| download | linux-da33e87bd2bfc63531cf7448a3cd7a3d42182f08.tar.xz | |
iommu: Handle yet another race around registration
Next up on our list of race windows to close is another one during
iommu_device_register() - it's now OK again for multiple instances to
run their bus_iommu_probe() in parallel, but an iommu_probe_device() can
still also race against a running bus_iommu_probe(). As Johan has
managed to prove, this has now become a lot more visible on DT platforms
wth driver_async_probe where a client driver is attempting to probe in
parallel with its IOMMU driver - although commit b46064a18810 ("iommu:
Handle race with default domain setup") resolves this from the client
driver's point of view, this isn't before of_iommu_configure() has had
the chance to attempt to "replay" a probe that the bus walk hasn't even
tried yet, and so still cause the out-of-order group allocation
behaviour that we're trying to clean up (and now warning about).
The most reliable thing to do here is to explicitly keep track of the
"iommu_device_register() is still running" state, so we can then
special-case the ops lookup for the replay path (based on dev->iommu
again) to let that think it's still waiting for the IOMMU driver to
appear at all. This still leaves the longstanding theoretical case of
iommu_bus_notifier() being triggered during bus_iommu_probe(), but it's
not so simple to defer a notifier, and nobody's ever reported that being
a visible issue, so let's quietly kick that can down the road for now...
Reported-by: Johan Hovold <johan@kernel.org>
Fixes: bcb81ac6ae3c ("iommu: Get DT/ACPI parsing into the proper probe path")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/88d54c1b48fed8279aa47d30f3d75173685bb26a.1745516488.git.robin.murphy@arm.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/iommu.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 5b64d0242e66..bc5363e6b43e 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -746,6 +746,7 @@ struct iommu_domain_ops { * @dev: struct device for sysfs handling * @singleton_group: Used internally for drivers that have only one group * @max_pasids: number of supported PASIDs + * @ready: set once iommu_device_register() has completed successfully */ struct iommu_device { struct list_head list; @@ -754,6 +755,7 @@ struct iommu_device { struct device *dev; struct iommu_group *singleton_group; u32 max_pasids; + bool ready; }; /** |
