Re: [linux-pm] Resume hangs [was: mmotm 2010-12-02-16-34 uploaded]

From: Alan Stern
Date: Wed Mar 30 2011 - 17:20:08 EST


On Wed, 30 Mar 2011, Rafael J. Wysocki wrote:

> > Rafael, this does seem to be a general problem. Suppose a new device
> > gets connected while the system is suspended. How is the driver's
> > probe method supposed to cope if it gets called while userspace is
> > still frozen but it needs to load some firmware?
> >
> > Is the answer that probing should always be delayed until after tasks
> > are thawed? There must be lots of subsystems which would have trouble
> > doing that, although we ought to be able to implement delayed probing
> > from within the driver core easily enough.
>
> I don't know how to solve that.
>
> First off, the prepare routines of drivers that need to load firmware during
> resume probably should preload the firmware for the devices present during the
> suspend.

That's okay for drivers that are bound to a device before the suspend
starts. But we also need to handle new devices added while the system
was asleep.

> Second, I don't generally think drivers should probe for devices during resume.
> I guess the delayed probing would be the cleanest appoach here.

Here's the difficulty. Normally the USB subsystem does use delayed
probing -- in fact, probing is done in a freezable thread. However
this is a special case. Not all USB drivers support suspend/resume;
those that don't get unbound during suspend and then rebound during
resume. The rebinding occurs in the "complete" phase of the resume,
before tasks are thawed.

I suppose the rebinding could be delayed. It would be better to fix
the USB DVB drivers, though, by adding PM support. But there's a bunch
of them in drivers/media/dvb/dvb-usb, and AFAICS they would all need to
be fixed. And I have no idea of what changes they would need.

Do you have any better suggestions?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/