Re: suspend2 merge (was Re: [Suspend2-devel] Re: CFS and suspend2: hang in atomic copy)

Linus Torvalds
2007-04-26T16:11:27Z

On Thu, 26 Apr 2007, Mark Lord wrote:
> Linus Torvalds wrote:
> >
> > See? Two *totally* different cases. They have *nothing* in common. Not the
> > call sequence, not the logic, not *anything*.
>
> Except that both methods cannot rely upon hot-pluggable devices
> still being present on resume/restore. It is exceptionally common
> to unplug all USB/firewire cables, mouse, keyboard, docking cables etc..
> after a machine is in S2R state.

Right, and that has nothing to do with suspend/resume. You'd better be
able to handle unexpected hotplugs _regardless_.

For example, it's quite common that people just "remove" the
pcmcia/cardbus card while the driver is active. And in fact, when that
happens, it's also quite common that the hardware raises the irq for that
(active) driver (in fact, it's more than common: since the "card removal"
interrupt for the Cardbus controller is generally always the same as the
"card interrupt" interrupt for the low-level card driver, you can pretty
much *guarantee* that you get that interrupt).

So the end result is that the interrupt handler and all normal IO routines
for a hotpluggable piece of hardware baically _have_ to be able to
gracefully handle the "oops, the hw simply isn't there any more" case!

The resume code isn't any different at all. It should run perfectly
normally, but for hotpluggable devices, it has to follow all the same
rules: handle the "oops, the hw is gone" case gracefully. No different,
and it's totally unrelated to suspend/resume: it's a *generic* issue.

In fact, suspend/resume is better off than a lot of the other code is,
simply because it's easier to test that case and know you hit that
particular sequence! It's much harder to verify that the "send packet"
case is safe, because how are you going to know to remove the card at the
right point to trigger it?

Linus