Subject: Re: splraiseipl()
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Andrew Doran <ad@netbsd.org>
List: tech-kern
Date: 09/20/2006 00:39:08
On Tue, Sep 19, 2006 at 10:25:25PM +0900, YAMAMOTO Takashi wrote:

> > how about having another opaque type as the following?
> > 
> > - make sure that each IPL_xxx has different values, so that they can
> >   be converted to SPL_xxx when necessary.
> > - move a possibly slow part of splraiseipl (eg. IPL_xxx -> SPL_xxx conversion)
> >   into another function, makeiplcookie(), so that it isn't executed
> >   frequently.
> > 
> > 	/*
> > 	 * ipl_t: IPL_BIO, IPL_NET, ....
> > 	 *
> > 	 * MD type.  maybe int for all ports.
> > 	 */
> > 	typedef int ipl_t;
> > 
> > 	/*
> > 	 * ipl_cookie_t:
> > 	 *
> > 	 * MD type.
> > 	 *
> > 	 * for some ports, it can be the same as ipl_t.
> > 	 * for other ports, it can be SPL_xxx, PSL_xxx, etc.
> > 	 */
> > 	typedef xxx ipl_cookie_t;

One thought: with the newlock primatives, MI code should eventually only
know about the symbolic constants (e.g. IPL_HIGH), and the SPL should be
raised and lowered through mutex_enter()/mutex_exit().

How those are packed within the mutex structure and how they are initialized
is machine dependent. For the most part we shouldn't need to deal with the
converted values in MI code.

Thanks,
Andrew