On Thu, Jul 30, 2020 at 11:56:10AM +0200, Lukas Wunner wrote: > On Thu, Jul 30, 2020 at 08:53:26AM +0200, Greg Kroah-Hartman wrote: > > On Wed, Jul 08, 2020 at 03:27:02PM +0200, Lukas Wunner wrote: > > > kill_device() is currently serialized with driver probing by way of the > > > device_lock(). We're about to serialize it with device_add() as well > > > to prevent addition of children below a device which is going away. > > > > Why? Who does this? Shouldn't the bus that is trying to do this know > > this is happening? > > AFAICS, at least spi and i2c are affected. > > I first thought that pci is affected as well but it seems the global > pci_lock_rescan_remove() performs the required serialization. > > I've yet to take a closer look at acpi and usb. Any bus which > creates a device hierarchy with dynamic addition & removal needs > to make sure no new children are added after removal of the parent > has begun. > > > > So, why are you pushing this down into the driver core, can't this be > > done in whatever crazy bus wants to do this, like is done here? > > I guess it can. Let me try to perform the locking at the bus level then. I thought the bus code itself had this type of serialization already...