Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755393AbZD3Vsr (ORCPT ); Thu, 30 Apr 2009 17:48:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759287AbZD3Vs1 (ORCPT ); Thu, 30 Apr 2009 17:48:27 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:37431 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754423AbZD3Vs0 (ORCPT ); Thu, 30 Apr 2009 17:48:26 -0400 Date: Thu, 30 Apr 2009 14:45:26 -0700 From: Andrew Morton To: Nikanth Karthikesan Cc: mingo@elte.hu, jens.axboe@oracle.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Detect and warn on atomic_inc/atomic_dec wrapping around Message-Id: <20090430144526.10b3039a.akpm@linux-foundation.org> In-Reply-To: <200904301939.51022.knikanth@novell.com> References: <200904291221.40361.knikanth@novell.com> <200904301921.44615.knikanth@novell.com> <20090430140559.GA14696@elte.hu> <200904301939.51022.knikanth@novell.com> X-Mailer: Sylpheed version 2.2.4 (GTK+ 2.8.20; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2118 Lines: 64 On Thu, 30 Apr 2009 19:39:50 +0530 Nikanth Karthikesan wrote: > If I had a dollar for each wordwrapped patch I get sent... > Detect and warn on atomic_inc/atomic_dec overflow. > > Add a debug option to detect and warn when the 32-bit atomic_t overflows > during atomic_inc and atomic_dec. > OK. I'll beef the changelog up a bit - this one is wimpy. The question is: do we put this in mainline? I guess we might as well give it a shot. It may well find bugs and it might also trigger false positives. We can then fix the bugs and decide whether the false positives warrant reverting it again, all very easy. > +#include checkpatch says WARNING: Use #include instead of #215: FILE: include/asm-generic/atomic.h:11: +#include Was this an oversight, or did you try using linux/bug.h and discovered some problem? > index 812c282..773c1a4 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -17,6 +17,17 @@ config ENABLE_WARN_DEPRECATED > Disable this to suppress the "warning: 'foo' is deprecated > (declared at kernel/power/somefile.c:1234)" messages. > > +config HAVE_ARCH_DEBUG_ATOMIC > + bool > + > +config ENABLE_WARN_ATOMIC_INC_WRAP > + bool "Enable warning on atomic_inc()/atomic_dec() wrap" > + depends on HAVE_ARCH_DEBUG_ATOMIC > + default y > + help > + Enable printing a warning when atomic_inc() or atomic_dec() > + operation wraps around the 32-bit value. > + Yes, I agree with `default y' for now. But we might want to turn it off again later. Adding that WARN to every atomic_inc/atomic_dec site must do terrible things to the kernel text footprint. Of course, if we make if `default y' for a while and then switch it to `default n', the `y' state will linger for a very long time in all the kernel developers' .configs. Good! Very sneaky. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/