Subject: Re: power hook and spl level
To: Lennart Augustsson <lennart@mail.augustsson.net>
From: TAKEMURA Shin <takemura@netbsd.org>
List: tech-kern
Date: 09/10/2000 11:12:41
----- Original Message ----- 
From: "Lennart Augustsson" <lennart@mail.augustsson.net>
To: "Jun-ichiro itojun Hagino" <itojun@iijlab.net>
Cc: <tech-kern@netbsd.org>
Sent: Wednesday, September 06, 2000 11:27 AM
Subject: Re: power hook and spl level


> Jun-ichiro itojun Hagino wrote:
> 
> >         do you guys think this is necessary for netbsd too?
> >         or it is drivers that need to be corrected?
> 
> Our power hooks run at splhigh() (in current), so it should not
> be needed.

Well, could I call tsleep in power hook?

Some driver might want to
  - notify user process of the power event
  - wait until the device transfer into some state
  - interact with other kernel thread

I propose introducing new power events which are
processed in lower level like below:

        dopowerhooks(PWR_SOFTSUSPEND);
        apm_spl = splhigh();
        dopowerhooks(PWR_SUSPEND);
        /* suspned... */
        dopowerhooks(PWR_RESUME);
        splx(apm_spl);

        dopowerhooks(PWR_SOFTRESUME);

I want to notify some user process which maps graphic
frame buffer before suspending.

Takemura