Commit da33e87
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 b46064a ("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 <[email protected]>
Fixes: bcb81ac ("iommu: Get DT/ACPI parsing into the proper probe path")
Signed-off-by: Robin Murphy <[email protected]>
Link: https://lore.kernel.org/r/88d54c1b48fed8279aa47d30f3d75173685bb26a.1745516488.git.robin.murphy@arm.com
Signed-off-by: Joerg Roedel <[email protected]>1 parent 6f73401 commit da33e87
2 files changed
+20
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
280 | 282 | | |
281 | 283 | | |
282 | 284 | | |
| |||
2846 | 2848 | | |
2847 | 2849 | | |
2848 | 2850 | | |
2849 | | - | |
| 2851 | + | |
2850 | 2852 | | |
2851 | | - | |
2852 | | - | |
| 2853 | + | |
2853 | 2854 | | |
2854 | 2855 | | |
2855 | 2856 | | |
2856 | 2857 | | |
2857 | | - | |
| 2858 | + | |
2858 | 2859 | | |
2859 | 2860 | | |
2860 | 2861 | | |
2861 | | - | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
2862 | 2870 | | |
2863 | 2871 | | |
2864 | 2872 | | |
2865 | 2873 | | |
2866 | | - | |
| 2874 | + | |
2867 | 2875 | | |
2868 | 2876 | | |
2869 | | - | |
| 2877 | + | |
2870 | 2878 | | |
| 2879 | + | |
| 2880 | + | |
2871 | 2881 | | |
2872 | 2882 | | |
2873 | | - | |
| 2883 | + | |
2874 | 2884 | | |
2875 | 2885 | | |
2876 | 2886 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
| 749 | + | |
749 | 750 | | |
750 | 751 | | |
751 | 752 | | |
| |||
754 | 755 | | |
755 | 756 | | |
756 | 757 | | |
| 758 | + | |
757 | 759 | | |
758 | 760 | | |
759 | 761 | | |
| |||
0 commit comments