On Thu, 2011-11-03 at 22:22 +0800, Alan Stern wrote: > On Thu, 3 Nov 2011, Lin Ming wrote: > > > I realize that this is not the natural way to do ata port runtime pm. > > Hooking it to scsi host runtime pm is not good. It does not deal with > > the races with system suspend/resume of host controller. > > > > How about making ata port as the parent device of scsi host? > > Then, for example, the runtime suspend happens as below, > > > > disk suspend --> scsi target suspend --> scsi host suspend --> ata port > > suspend. > > > > Current device tree is: > > /sys/devices/pci0000:00/0000:00:1f.2/ > > |-- ata1 > > |-- host0 > > > > After the change, the tree will become as: > > /sys/devices/pci0000:00/0000:00:1f.2/ata1/ > > |-- host0 > > I don't know enough about the ATA subsystem to say much, except that > this looks more logical. > > > The tricky part is ata port(parent device) suspend need to schedule scsi > > EH which will resume scsi host(child device). Then the child device > > resume will in turn make parent device resume first. This is kind of > > recursive. > > > > We can fix this by adding a flag somewhere to tell scsi EH don't resume > > the host in ata port pm request handling case. > > > > What do you think? > > Yes, it is a problem. But it looks like the underlying issue is that > you're using the SCSI error handler to do something it was not intended > for. Can't you suspend and resume the ATA port without using the error > handler? The system suspend and resume of the ATA port uses the error handler. I think the runtime suspend and resume should use the error handler too. Tejun, Could you comment more on this? Thanks. > > Alan Stern > -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html