From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755317Ab3BVIys (ORCPT ); Fri, 22 Feb 2013 03:54:48 -0500 Received: from mail-ee0-f49.google.com ([74.125.83.49]:42771 "EHLO mail-ee0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752020Ab3BVIym (ORCPT ); Fri, 22 Feb 2013 03:54:42 -0500 Date: Fri, 22 Feb 2013 09:54:38 +0100 From: Ingo Molnar To: Linus Torvalds Cc: Thomas Gleixner , Frederic Weisbecker , LKML , Peter Zijlstra , stable Subject: Re: [PATCH] nohz: Make tick_nohz_irq_exit() irq safe Message-ID: <20130222085438.GA29144@gmail.com> References: <1361373336-11337-1-git-send-email-fweisbec@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Linus Torvalds wrote: > On Thu, Feb 21, 2013 at 10:21 AM, Thomas Gleixner wrote: > > > > This was a draft patch. I made it a WARN_ON_ONCE() already. > > Ok, good. > > I really wish we could just get rid of BUG_ON(). It was a bad > idea, and it makes it easy for people to do the wrong thing. > Sadly, we have tons of them. So my old plan was to use a little bit of psychology. Firstly, we could just turn BUG_ON() into a WARN() variant that emits: BUG: ... while a WARN()ings emit: WARNING: ... and then we could introduce a new primitive: CRASH_ON(); which would be used in the (few) places that really, really cannot continue sanely and need to crash the box. This naming alone would inhibit its use through two channels: - Putting the word 'CRASH' into your code feels risky, dissonant and wrong (perfect code does not crash) and thus needs conscious frontal lobe effort to justify it - while BUG_ON() really feels more like a harmless assert to most kernel developers, which is in our muscle memory through years training. - CRASH_ON() takes one character more typing than WARN_ON(), and we know good kernel developers are fundamentally lazy. [ This is an arguably lazy plan that does not involve changing the 10,000+ BUG_ON() call sites and does not involve the re-training of thousands of mis-trained kernel developers who introduced over 900 new BUG_ON()s in the v3.7->v3.8 cycle alone (!). ] So while I don't think we can win the war against BUG_ON(), I think we can fight the lazy general's war: turn the enemy over to our side and declare victory? Thanks, Ingo