From owner-freebsd-arch@FreeBSD.ORG Fri Sep 26 20:21:23 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EB5C5475 for ; Fri, 26 Sep 2014 20:21:23 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8185FB1 for ; Fri, 26 Sep 2014 20:21:23 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.9/8.14.9) with ESMTP id s8QKLNVn066060 for ; Fri, 26 Sep 2014 20:21:23 GMT (envelope-from bdrewery@freefall.freebsd.org) Received: (from bdrewery@localhost) by freefall.freebsd.org (8.14.9/8.14.9/Submit) id s8QKLNEa066059 for freebsd-arch@freebsd.org; Fri, 26 Sep 2014 20:21:23 GMT (envelope-from bdrewery) Received: (qmail 46032 invoked from network); 26 Sep 2014 15:21:21 -0500 Received: from unknown (HELO ?10.10.0.24?) (freebsd@shatow.net@10.10.0.24) by sweb.xzibition.com with ESMTPA; 26 Sep 2014 15:21:21 -0500 Message-ID: <5425CAB6.2010102@FreeBSD.org> Date: Fri, 26 Sep 2014 15:21:10 -0500 From: Bryan Drewery Organization: FreeBSD User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: freebsd-arch@freebsd.org Subject: Re: KASSERT_WARN for asserting malloc(M_WAITOK) not in a non-sleepable thread References: <54236CD6.4050807@FreeBSD.org> <5424392D.9030201@FreeBSD.org> <1411668571.66615.247.camel@revolution.hippie.lan> In-Reply-To: OpenPGP: id=6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vT9xP5a5iEOx7EPSkSIr1W7RpGlk8StJp" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Sep 2014 20:21:24 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vT9xP5a5iEOx7EPSkSIr1W7RpGlk8StJp Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 9/25/2014 1:22 PM, Justin Hibbits wrote: > On Thu, Sep 25, 2014 at 11:16 AM, Davide Italiano = wrote: >> On Thu, Sep 25, 2014 at 11:09 AM, Ian Lepore wrote: >>> On Thu, 2014-09-25 at 10:51 -0700, Davide Italiano wrote: >>>> On Thu, Sep 25, 2014 at 9:14 AM, Adrian Chadd w= rote: >>>>> 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 a= dd >>>>> in this rather than printf()s or device_printf()'s with various kno= bs >>>>> 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= =2E >>>> 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 insa= ne >>> 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 possibl= e >>> anomalous condition as either fatal or not worth mentioning is insane= =2E >>> >>> 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 wi= th >>> that spelling and how you would prefer it to be spelled. >>> >>> -- Ian >>> >>> >> >> 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. >> >> Thanks, >> >> -- >> Davide >=20 > 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). >=20 > - Justin 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. --=20 Regards, Bryan Drewery --vT9xP5a5iEOx7EPSkSIr1W7RpGlk8StJp 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) iQEcBAEBAgAGBQJUJcq2AAoJEDXXcbtuRpfPBU8H/344+rDMXLWkcAl3Q0kMJVeT aJHga3z4XBAac6tg2GpobTH0todkZIuzqG9OCXq31T/K8JoSd05byQRCi0AfO714 DnyB3lnU2tTbgWxzuBlo4A3on4RLJK4ysDfARf6Y69l7tlPH0a44/xRqDweAHkNG jWCcbnuO1je+09xDYNbgqH+eknhyMdmzjWHJVSoV2mNwneYB7u1+l3Q3svCJ0vFP i2xdX+5P9zD2s4+B/koJKfJgZCWU+MOaHCYMlmBcNjq2iVYIRsPNq12Fg3sdMQ+7 Yp2nHzWdnV0ljQeEXyNMViSssm3Ccf5ClSTIC+dLpUcJ5Rlg/+wNoQTLw2pBvA0= =IEkA -----END PGP SIGNATURE----- --vT9xP5a5iEOx7EPSkSIr1W7RpGlk8StJp--