On Wed, Jul 9, 2014 at 8:18 AM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > On Wed, 9 Jul 2014, Rafael J. Wysocki wrote: > >> On Tuesday, July 08, 2014 02:47:03 PM Bjorn Helgaas wrote: >> > [+cc linux-pm] >> > >> > On Tue, Jul 8, 2014 at 9:39 AM, Igor Bezukh <Igor@xxxxxxxxxxxxx> wrote: >> > > Hi, >> > > >> > > >> > > We are testing Intel Gigabit adapter driver (igb) under Fedora 20, kernel 3.14.4 for the following use-case: >> > > >> > > (*) Adapter is connected to the PCIE slot >> > > (*) We put the system under suspend by running pm-suspend from user-space >> > > (*) Remove the adapter from the PCIE slot >> > > (*) Wake up the system >> > > >> > > Currenlty, we got kernel panics and the system got stuck. >> > > >> > > My question is - does the PCI subsystem logic calls the driver remove function when driver resume function returns with error code? >> > > >> > > Or should I implement the call to igb_remove from igb_resume in the Intel driver? >> ... >> The driver's system resume callbacks need to be able to cope with >> missing devices. Based on this, it sounds like igb_resume() should call igb_remove() when it figures out the device is missing. That might be the best we can do right now, but it doesn't sound like a general-purpose solution. Detecting device removal sounds like a core function, not a driver function. It doesn't seem like drivers should have to implement ->resume just to deal with this case. Calling ->remove from ->resume is a little strange and may expose locking issues or races. I suspect that most ->remove methods are not prepared to deal with missing devices (they may want to stop DMA, disable interrupts, etc.) > In the USB stack, the subsystem core resume code checks to see if a > device has been unplugged before the driver's ->resume callback is > invoked. If a device is gone, the driver callback is skipped. Thus > drivers don't have to worry about trying to resume a device that has > been unplugged. I assume that you do want to call the driver's ->remove method to free any per-device state. Do USB drivers just have to be smart enough to do that without touching the device? Bjorn -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html