Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src



   Date: Thu, 04 Jul 2013 08:51:09 +0100
   From: Nick Hudson <skrll%netbsd.org@localhost>

   On 06/23/13 03:35, Taylor R Campbell wrote:
   > +   * rndsink_request takes a spin lock at IPL_VM, so we can be no
   > +   * higher than that.
   > +   */
   > +  KASSERT(ipl <= IPL_VM);

   This isn't always the case as some platforms have a different ordering 
   for IPL levels.

Blargh!

   How about

   KASSERT(ipl != IPL_SCHED && ipl != IPL_HIGH)

   although this was suggsted as well

   KASSERT(IPL_SCHED > IPL_VM ? ipl <= IPL_VM : ipl >= IPL_VM);

I would prefer not to bake relations between different IPLs into
subr_cprng.c, but as a temporary measure, go ahead either way.

Perhaps we could add an MD predicate for the purpose of kasserts like
this:

KASSERT(ipl_atmost(ipl, IPL_VM));

/* machine A */
#define IPL_NONE        0
#define IPL_VM          3
#define IPL_SCHED       4
#define IPL_HIGH        6
static inline bool
ipl_atmost(int x, int y)
{
        return (x <= y);
}

/* machine B */
#define IPL_NONE        7
#define IPL_VM          5
#define IPL_SCHED       3
#define IPL_HIGH        0
static inline bool
ipl_atmost(int x, int y)
{
        return (x >= y);
}

/* machine C */
#define IPL_NONE        0xff
#define IPL_VM          0xd6
#define IPL_SCHED       0xc4
#define IPL_HIGH        0x00
static inline bool
ipl_atmost(int x, int y)
{
        return ((x & y) == y);
}


Home | Main Index | Thread Index | Old Index