Subject: Re: intlock
To: None <fvdl@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: port-amd64
Date: 02/23/2004 21:50:16
> > while x86_intlock() currently uses the previous spl (if_ppl) to
> > determine if the kernel lock is needed or not,
> > what really matters there is the interrupt handler's own IPL_.
> > 
> > i'd like to check the attached diff if no one objects.
> > (it's a little ugly but i don't think it's a problem because
> > the kernel lock should go away eventually anyway :-)
> 
> It's true that the ipl at the time of the interruption is checked.
> However, that works out fine, because if you get as far as calling
> the handler, it means that the handler has registered at a level
> > the current spl. So, the test is the same, you're just moving
> it to a different place.
> 
> What's the advantage of doing that?

consider an interrupt which was registered as IPL_SERIAL occurs when
the current ipl is IPL_NONE.
in this case, currently, kernel lock will be acquired unnecessarily.

> If you want to get rid of this hack in a proper way, it would be
> to store an "mpsafe" attribute in the handler structure, always
> call a stub function, and have that take the lock depending
> on the flag.
>
> Of course, for that, all intr_establish functions need an extra
> flag passed in, and all device drivers must be changed to use it..

i agree that it's cleaner.

YAMAMOTO Takashi