Re: apm emulation driver broken ?

From: Rafael J. Wysocki
Date: Sun Nov 18 2007 - 17:05:28 EST


On Sunday, 18 of November 2007, Franck Bui-Huu wrote:
> Rafael J. Wysocki wrote:
> > On Saturday, 17 of November 2007, Franck Bui-Huu wrote:
> >> ok so now we agreed on this point, can we assert that a user
> >> land thread waiting for an event in an UNINTERRUPTIBLE state
> >> will prevent a suspend to happen ?
> >
> > Yes.
> >
>
> So this driver seems really broken and actually I'm wondering if
> it's used by anyone...

Well, it doesn't seem so.

> See the call to wait_even() made by apm_ioctl(). If any processes
> run this, it will prevent the system to suspend...

True, but does it actually happen in practice?

> And no, I don't know why call wait_event() is called.

I hope somebody knows. :-)

At this point the second branch of the "if (as->suspend_state == SUSPEND_READ)"
can be fixed by replacing wait_event_interruptible() with
wait_event_freezable(), but the fix for the first branch depends on whether or
not the wait_event() is really necessary.

If it can be replaced with an interruptible sleep, we can use
wait_event_freezable() in this case too. Otherwise, the only woking fix would
be to reintroduce the PF_NOFREEZE in there.

Honestly, I'm leaning towards replacing wait_event() in apm_ioctl() with
wait_event_freezable() and seeing what happens ...

Greetings,
Rafael
-
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/