On Wed, 2018-08-15 at 13:35 +1000, Benjamin Herrenschmidt wrote: > What's really needed is a per device mutex covering all those operations > on a given device. (This would also allow to get rid of those games with > atomics). > > Any comments ? Note: I'm experienting with a per-pci_dev mutex to protect the device state. If it works out, I suggest we add it, then progressively move things one by one under the protection of the mutex. Any objection to the approach ? If it fixes my problem, I'll send preliminary patches that cover the basic enable/disable and bus master settings to start with. We should try to get them into stable as this is breaking real world stuff for us. I suspect large x86 systems get lucky because their BIOSes do all the enables. It would be possible to reproduce the races there by hot-pluging a large external drawer using a cable card with a switch Cheers, Ben.