Re: [GIT PULL] PM updates for 2.6.33

Dmitry Torokhov
2009-12-07T06:15:49Z

On Sun, Dec 06, 2009 at 09:31:12PM -0800, Arjan van de Ven wrote:
> On Sun, 6 Dec 2009 18:27:07 -0800
> Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
>
> > On Sun, Dec 06, 2009 at 05:18:56PM -0800, Arjan van de Ven wrote:
> > > On Sun, 6 Dec 2009 14:54:48 -0800
> > > Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> > >
> > > > Yes, that's your PS/2 mouse (rather touchpad) and the delay comes
> > > > from device reset (needed by some keyboard controllers - I
> > > > remember HP -or it and keyboard will be dead at resume).
> > > >
> > >
> > > btw could we do this reset in an async function call (as long as we
> > > wait for it to complete before we pull the plug finally) ?
> >
> > It has to complete before we start shutting down i8042, so there are
> > dependencies involved...
>
> async function calls have 2 methods for synchronization:
>
> * inside an async function, you can wait for all "earlier" async
> functions to complete (async_synchronize_cookie)
> * outside an async function, you can wait for all scheduled async
> functions to complete (async_synchronize_full)
>
> so there's two options to use the async code to cut down this time:
>
> 1) Make both the mouse, keyboard AND the i8042 suspend functions async,
> and in the i8042 function the code first synchronizes on all previous
> async work
> 2) only make the mouse and keyboard suspend async, and just wait for all
> async work in i8042 suspend
>
> I strongly prefer number 1, in terms of getting the best suspend speed.
> It means that all other suspend code can run in parallel to the whole
> serio/i8042 suspend.
> Option two is simpler, but the delay is in the normal, synchronous path,
> so other suspend code will not run in parallel.
>
> The good news is that neither is hard for someone familiar with the
> code...
>

And the bad thing is that violates multiple layers in the kernel. Atkbd
driver does not have to be using i8042; neither does psmouse. Althtough
they do in 99% of the cases there are other controllers providing the
i8042-style ports. Just grep for SERIO_8042 in drivers/input/serio.

I do not want to hard-code the i8042-psmouse-atkbd dependency.

--
Dmitry