From owner-freebsd-arch@FreeBSD.ORG Thu Sep 25 02:56:19 2014 Return-Path: Delivered-To: arch@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 AFF1B3FE; Thu, 25 Sep 2014 02:56:19 +0000 (UTC) Received: from mail-la0-x230.google.com (mail-la0-x230.google.com [IPv6:2a00:1450:4010:c03::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F028122; Thu, 25 Sep 2014 02:56:18 +0000 (UTC) Received: by mail-la0-f48.google.com with SMTP id q1so105690lam.7 for ; Wed, 24 Sep 2014 19:56:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=oyu5FGtdWv/WXbVJMks+dXE7Hd0bMVBXO7D6NzRGmh8=; b=Zf0GkRXyzV2x+VddHE0d4qR5XKWwEpvT8CO3rg/lLsMzTsQ2/qLgO5X+Z17qV4TMaR pQnB1irKRmrE7Rv3vfDUJRX0xWnhJ9JkXn4hWx7i4dZ/szSkUqGc2ru5AqlV60BWhvHG A93IcH1Srikhdfd9gNKV2WxiFqifmzcfROaOMT9DHRPYRGhzTQ1zH1MvE9FI/sIuLFcz Dr+N39kYrWLj2V+x/049EuIUcTJmJyTxrUw3NqoZ/l/WeSPJxOpwxbm4aZsMk2C/iB0d UC3FJGDQHakPMbdwmjNsufnVK8FKAEm2CDBC0eX79uAtKWfTTGn7+4882AdsIO3nBM/a MEYw== MIME-Version: 1.0 X-Received: by 10.112.35.201 with SMTP id k9mr6320288lbj.88.1411613776810; Wed, 24 Sep 2014 19:56:16 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.25.207.74 with HTTP; Wed, 24 Sep 2014 19:56:16 -0700 (PDT) In-Reply-To: <54236CD6.4050807@FreeBSD.org> References: <54236CD6.4050807@FreeBSD.org> Date: Wed, 24 Sep 2014 19:56:16 -0700 X-Google-Sender-Auth: XNRTeAkyGp4BP1WTxPfoltlMd4A Message-ID: Subject: Re: KASSERT_WARN for asserting malloc(M_WAITOK) not in a non-sleepable thread From: Davide Italiano To: Bryan Drewery Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-arch@freebsd.org" 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: Thu, 25 Sep 2014 02:56:19 -0000 On Wed, Sep 24, 2014 at 6:16 PM, Bryan Drewery 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