KASSERT_WARN for asserting malloc(M_WAITOK) not in a non-sleepable thread

Justin Hibbits jhibbits at freebsd.org
Sat Sep 27 14:53:29 UTC 2014


On Sep 27, 2014 2:01 AM, "Andriy Gapon" <avg at freebsd.org> wrote:
>
> On 26/09/2014 23:21, Bryan Drewery wrote:
> > On 9/25/2014 1:22 PM, Justin Hibbits wrote:
> >> I like my bikeshed a nice royal blue.  At a previous job we used
> >> ASSERT and VERIFY macros.  VERIFY was comparable to this (warn if
> >> condition not met, don't panic), so how about KVERIFY() (I'll also
> >> support KWARN, but I think KVERIFY() conveys a better message by
> >> name).
> >
> > I will commit it as KVERIFY tonight based on the majority consensus.
> > Even at work right now we are tracking down an odd bug where this could
> > be useful to have temporarily.
> >
>
> Not sure if the following bit of information will influence your
decision, but
> anyway.  In the Solaris source code ASSERT is used like our KASSERT where
DEBUG
> macro controls its definition like our INVARIANTS do.  But VERIFY is used
like
> KASSERT that is never compiled out.  So, my personal preference would be
to use
> KWARN for something that only warns.
>

That sounds like pretty good precedent.  I fully support it or Davide's
DEBUG_WARN suggestion, and agree it makes more sense than KVERIFY from this
context.

-Justin


More information about the freebsd-arch mailing list