Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Sep 2014 10:12:11 -0700
From:      Navdeep Parhar <np@FreeBSD.org>
To:        Adrian Chadd <adrian@freebsd.org>,  Bryan Drewery <bdrewery@freebsd.org>
Cc:        "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Subject:   Re: KASSERT_WARN for asserting malloc(M_WAITOK) not in a non-sleepable thread
Message-ID:  <54244CEB.2010204@FreeBSD.org>
In-Reply-To: <CAJ-Vmok5Xaa6aZvfL1GoW8C==dY47P=vKAEZhu16JhHjV%2BTk9g@mail.gmail.com>
References:  <54236CD6.4050807@FreeBSD.org> <CACYV=-Eg69AQ72DOGppPSL7whJVCdcNg-auhBZ771iG7DfPdAw@mail.gmail.com> <5424392D.9030201@FreeBSD.org> <CAJ-Vmok5Xaa6aZvfL1GoW8C==dY47P=vKAEZhu16JhHjV%2BTk9g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 09/25/14 09:14, Adrian Chadd wrote:
> Hi,
>
> Please bring in KASSERT_WARN().
>
> I'm grown up enough to use KASSERT_WARN() along with handling the
> invariant check myself in code. Having KASSERT_WARN() means I can add
> in this rather than printf()s or device_printf()'s with various knobs
> to remove it.
>
> (This is absolutely _not_ the "should KASSERT() optionally just log"
> argument. I'm not going to get into that a second time.)

Yeah, let's avoid a repeat.  You could call it KWARN (no form of 
"assert" anywhere in its name) to sidestep any discussion on whether 
invariants and assertions are ironclad or not.  It's easier/shorter to 
type in as well.

Regards,
Navdeep

>
>
> -a
>
>
> On 25 September 2014 08:47, Bryan Drewery <bdrewery@freebsd.org> wrote:
>> On 9/24/2014 9:56 PM, Davide Italiano wrote:
>>> On Wed, Sep 24, 2014 at 6:16 PM, Bryan Drewery <bdrewery@freebsd.org> wrote:
>>>> Hi,
>>>>
>>>> I've placed 2 reviews out in relation to
>>>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193696:
>>>>
>>>> Add KASSERT_WARN which will work just like KASSERT except that no panic
>>>> will occur.  My own expectation would be that any use of it would
>>>> eventually be promoted to a full KASSERT.  It would only be used where
>>>> the impact is not known yet on all hardware/devices.  We don't want to
>>>> go adding a KASSERT and break boot for a whole class of systems.
>>>>
>>>>    https://reviews.freebsd.org/D829 - KASSERT_WARN
>>>>
>>>
>>> FYI, I'm not excited about the idea. If you introduce an assert you
>>> want some invariant to not be violated. If it's violated, there's
>>> something clearly going wrong and you need to stop and think about it.
>>> I guess that in most cases is just better fail early, rather than keep
>>> going with the system in a semi-functional state.  Also, please note
>>> that once a KPI is introduced in the kernel, everybody may start
>>> abusing it.
>>> A previous attempt (in my opinion wrong) was made to have KASSERT to
>>> log rather than panic. It actually didn't lead to any benefit,
>>> apparently. FWIW, at least your approach is more fine grained.
>>>
>>> --
>>> Davide
>>
>> I would be comfortable adding it in as a full KASSERT (and not bringing
>> in KASSERT_WARN) if other people test the patch in
>> https://reviews.freebsd.org/D830 and change them to KASSERT. If the
>> fallout is not too bad then we can commit the real assert.
>>
>> --
>> Regards,
>> Bryan Drewery
>>
> _______________________________________________
> freebsd-arch@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54244CEB.2010204>