From owner-svn-src-head@freebsd.org Sun Nov 5 19:37:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 419E9E4F260 for ; Sun, 5 Nov 2017 19:37:59 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (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 1562E66E58 for ; Sun, 5 Nov 2017 19:37:58 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: cbf10548-c260-11e7-b1c3-712f93d8ba90 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id cbf10548-c260-11e7-b1c3-712f93d8ba90; Sun, 05 Nov 2017 19:37:45 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id vA5Jbo9H010819; Sun, 5 Nov 2017 12:37:50 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1509910670.99235.70.camel@freebsd.org> Subject: Re: svn commit: r325386 - head/sys/kern From: Ian Lepore To: cem@freebsd.org, Andriy Gapon Cc: Konstantin Belousov , Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Sun, 05 Nov 2017 12:37:50 -0700 In-Reply-To: References: <201711041049.vA4AnZUE096709@repo.freebsd.org> <20171105130607.GA2566@kib.kiev.ua> <20171105173032.GE2566@kib.kiev.ua> <20171105190214.GG2566@kib.kiev.ua> <20f694b3-c60c-1b6d-76a1-2ef14cbdd698@FreeBSD.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Nov 2017 19:37:59 -0000 On Sun, 2017-11-05 at 11:24 -0800, Conrad Meyer wrote: > On Sun, Nov 5, 2017 at 11:13 AM, Andriy Gapon wrote: > > > > I guess (only guess) that Conrad is saying that it would be useful to have a > > macro like KASSERT but which would be always active regardless of INVARIANTS. > > E.g. in illumos they have ASSERT and VERIFY. > Yes, exactly.  There are numerous places in the kernel where we have > essentially an unrolled version of that idea, with if + panic. > > Best, > Conrad > IMO, the only reason ASSERT-style macros exist is to hide the conditional-on-build-type part of the operation.  That is, to avoid having #ifdef INVARIANTS scattered everywhere. Creating a macro to generate always-on error detection and reporting code just because there exists a macro to do so conditionally seems to turn the world on its head.  Sure, there is a lot of 'if (condition) panic("msg")' in the source.  There is also a lot of stuff like 'if (error != 0) return (ENXIO)", so should we have a macro for that too?  Where does it end? Since I suspect my opinion will be a minority of 1-ish, I'd like to follow up with a suggestion that the new macro at least get a name that includes the word 'panic', such as PANIC_IF().  Something that can be found in the source with: grep -i panic.*message.I.saw -- Ian