Date: Thu, 25 Sep 2014 13:23:27 -0500 From: Bryan Drewery <bdrewery@FreeBSD.org> To: Davide Italiano <davide@freebsd.org>, Ian Lepore <ian@freebsd.org> Cc: Adrian Chadd <adrian@freebsd.org>, "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>, Bryan Drewery <bdrewery@freebsd.org> Subject: Re: KASSERT_WARN for asserting malloc(M_WAITOK) not in a non-sleepable thread Message-ID: <54245D9F.6080502@FreeBSD.org> In-Reply-To: <CACYV=-HDVxhQ=CDK7HWuK2t-rsFkW2gKD45NDjC86jQ2wq6v9A@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> <CACYV=-GMpMxEAs-X7umMdYX2Awf3G0La1cUGsXeH9MoX34CdxQ@mail.gmail.com> <1411668571.66615.247.camel@revolution.hippie.lan> <CACYV=-HDVxhQ=CDK7HWuK2t-rsFkW2gKD45NDjC86jQ2wq6v9A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --7lsX8KOIoNVoRLafMnHXkHJ3d1BQrVab7 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 9/25/2014 1:16 PM, Davide Italiano wrote: > On Thu, Sep 25, 2014 at 11:09 AM, Ian Lepore <ian@freebsd.org> wrote: >> On Thu, 2014-09-25 at 10:51 -0700, Davide Italiano wrote: >>> On Thu, Sep 25, 2014 at 9:14 AM, Adrian Chadd <adrian@freebsd.org> wr= ote: >>>> 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 ad= d >>>> in this rather than printf()s or device_printf()'s with various knob= s >>>> 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.) >>>> >>>> >>> >>> If you put a KASSERT() inside your code -- probably you should be >>> careful enough to put that iff you're sure that it should be always >>> verified. No exceptions. >>> People tend to be very lazy (including me). I don't expect everybody >>> diligently upgrading KASSERT_WARN to KASSERT. So KASSERT_WARN start >>> becoming more and more widespread, and people realize all of these >>> need to be upgraded to KASSERT or removed. This generally happens >>> after years. Yet. Another. Crusade. >>> There's a lot of work in the kernel to remove old/wrong/naive KPI >>> from the kernel. jhb@ is looking at timeout()-> callout() conversion.= >>> I'm personally looking at dev_clone() removal. There are a lot of >>> other examples. >>> Adding KASSERT_WARN is a step backward, not a step forward, IMHO. >>> That said, if you want to pollute the kernel, fine. I expressed my >>> opinion, and I'm personally not happy about this, but I never stated >>> I'm gonna stop you from doing that. >>> >>> Thanks, >>> >>> -- >> >> IMO, this entire argument is ridiculous. Some conditions are so insan= e >> that you've got to stop immediately rather than make things worse. >> Other conditions indicate problems, but the code can recover or >> otherwise continue to operate safely. Trying to define every possible= >> anomalous condition as either fatal or not worth mentioning is insane.= >> >> Everyone is free to write code such as >> >> #ifdef INVARIANTS >> if (some_condition) >> printf("whatever warning\n"); >> #endif >> >> So let's be clear here: the objections are to spelling that code >> sequence KASSERT_WARN. If you object, please explain what's wrong wit= h >> that spelling and how you would prefer it to be spelled. >> >> -- Ian >> >> >=20 > Take the assert out of the name. Call it DEBUG_WARN, or something else > if you like. > assert as a pretty *clear* and specific semantic, no need to mess > around with it. >=20 > Thanks, >=20 I like the suggested KWARN from earlier. --=20 Regards, Bryan Drewery --7lsX8KOIoNVoRLafMnHXkHJ3d1BQrVab7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) iQEcBAEBAgAGBQJUJF2fAAoJEDXXcbtuRpfPSSkIAMdd1y+gs7P3zer01dSe6IGo wYFFEJGCTZNf7pWiJK4HWYGKWqPeBLKDmA8ZUbrArETD2poBMlg/Y/4C9vmZcsx/ BXdC7yA4ovdg8au082DLBoxnXqo4/zMLB8dqJWiKISFyIQ985+vEL78tGp1jQVau JN0hEcwgQE3ZoKIfjV/C0uFaritmhMHx+cKhkp3/Gy1CNe29QsjbHAQ+Io1OWdcP 6jpI4Ea8HqabQ9gGChZM59eduDk/4m5glORW/61V7gPSjIz9AxlHfdp9JWWOkgd2 Tyh26HxK3VcWawktPb499atR4Rbk3TRHsbKezQlCsyaFP+JuJ62pTsboK71bWKw= =hJAf -----END PGP SIGNATURE----- --7lsX8KOIoNVoRLafMnHXkHJ3d1BQrVab7--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54245D9F.6080502>