Re: [linux-pm] [RFC][PATCH -mm 1/5] PM: Make freeze_processes SMP-safe

Rafael J. Wysocki
2006-12-03T11:17:46Z

On Saturday, 2 December 2006 16:39, Alan Stern wrote:
> On Sat, 2 Dec 2006, Pavel Machek wrote:
>
> > Hi!
> >
> > > > We send fake signals to them, so they enter get_signal_to_deliver() and they
> > > > call try_to_freeze() from there.
> > >
> > > Well then, see, you're doing exactly what you said should never happen --
> > > you are freezing a user thread while it might be holding a lock that the
> > > unfreezable usb-storage thread needs.
> >
> >
> > I do not think it is okay to call get_signal_to_deliver with *any*
> > lock held... Or do you have example when that is broken?
>
> Is get_signal_to_deliver() ever called at any time other than when the CPU
> is about to switch back into user mode?

No, I don't think so. There's a check in do_signal() that only allows it to
call get_signal_to_deliver() in user mode.

> If not then there shouldn't be any problem. The routines I was talking
> about earlier hold the USB device locks while running in kernel mode, but
> they release them before returning to user mode.

Then everything is correct, I think.

Greetings,
Rafael

--
You never change things by fighting the existing reality.
R. Buckminster Fuller