From owner-freebsd-current@FreeBSD.ORG Fri Dec 13 23:16:31 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 984C86A9 for ; Fri, 13 Dec 2013 23:16:31 +0000 (UTC) Received: from mrout1-b.corp.bf1.yahoo.com (mrout1-b.corp.bf1.yahoo.com [98.139.253.104]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 490C51877 for ; Fri, 13 Dec 2013 23:16:31 +0000 (UTC) Received: from [127.0.0.1] (rideseveral.corp.yahoo.com [10.73.160.231]) by mrout1-b.corp.bf1.yahoo.com (8.14.4/8.14.4/y.out) with ESMTP id rBDN5phV098320; Fri, 13 Dec 2013 15:05:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yahoo-inc.com; s=cobra; t=1386975953; bh=6bMq0pe0HAtd/B93zQltNIOcXmsNCxJSm2lVtj2pbbc=; h=Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date: Message-ID:Mime-Version:Content-Transfer-Encoding; b=LJqAnGL0edeA0D2Z5BOPzaKO5Og3raQNODkeOY9e/fFuvmASoKDHn/gbeviavQ85W /RB9CH4LyNa3BciaTnjjObL3vkITdiNRqjUGza7uxOqK0ZYkPiIoRY7+xjqVcoCGxa TV/RUNeojmSLtohw7UQ5qYK0xM6M7CzDzaQ9BSZE= Subject: Re: kasserts behind invariants From: Sean Bruno To: Alfred Perlstein In-Reply-To: <52AB8DA1.3000007@mu.org> References: <1386971425.37172.9.camel@powernoodle.corp.yahoo.com> <52AB8DA1.3000007@mu.org> Content-Type: text/plain; charset="us-ascii" Date: Fri, 13 Dec 2013 15:05:51 -0800 Message-ID: <1386975951.37172.13.camel@powernoodle.corp.yahoo.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Milter-Version: master.31+4-gbc07cd5+ X-CLX-ID: 975951001 Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 23:16:31 -0000 On Fri, 2013-12-13 at 14:43 -0800, Alfred Perlstein wrote: > On 12/13/13 1:50 PM, Sean Bruno wrote: > > I guess this may have been argued before, but I don't see why we would > > want to hide specific things like: sys/kern/subr_lock.c > > > > /* Check for double-init and zero object. */ > > KASSERT(!lock_initalized(lock), ("lock \"%s\" %p already initialized", > > name, lock)); > > > > If I hadn't completely missed the fact that I had INVARIANTS activated, > > I'd never have found out why this vendor driver was being so completely > > stupid and crashing my machine. > > > > If I find things like this that I want old KASSERT behavior on (panic if > > true) and I don't want to run INVARIANTS, is that possible? > > I don't understand the question, do you want to move it from INVARIANTS > to under just a plain if(condition)? > > -Alfred > > _______ In this specific instance, it would have been much better to simply panic if(condition) than silently allowing the vendor driver to do something stupid like initialize a mutex twice. sean