All of lore.kernel.org
 help / color / mirror / Atom feed
From: gang.chen@asianux.com (Chen Gang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] kernel/sched/core.c: need return NULL when BUG() is defined as empty.
Date: Thu, 23 May 2013 09:00:45 +0800	[thread overview]
Message-ID: <519D6A3D.5050003@asianux.com> (raw)
In-Reply-To: <20130522161935.GR18810@twins.programming.kicks-ass.net>

On 05/23/2013 12:19 AM, Peter Zijlstra wrote:
> On Wed, May 22, 2013 at 02:33:17PM +0100, Russell King - ARM Linux wrote:
>> > On Wed, May 22, 2013 at 11:11:56AM +0200, Peter Zijlstra wrote:
>>> > > On Mon, May 20, 2013 at 03:48:53PM +0800, Chen Gang wrote:
>>>> > > > 
>>>> > > > When neither CONFIG_BUG nor HAVE_ARCH_BUG is defined, need let function
>>>> > > > return failure value ('NULL') instead of random value.
>>> > > 
>>> > > What will such a kernel do? Happily continue running whenever we hit a
>>> > > BUG? that seems like a particularly bad idea. Should we not have a stub
>>> > > BUG() function like:
>>> > > 
>>> > > void BUG(void) __attribute__((noreturn))
>>> > > {
>>> > > 	local_irq_disable();
>>> > > 	while (1) ;
>>> > > }
>> > 
>> > Eww.  So you've a platform where you have things like panic_on_oops
>> > enabled, and you hit this bug... do we really want to just stop?
>> > Wouldn't replacing BUG() with panic("BUG"); be better ?
>> > 
>> > But, this begs the question - what is the point of being able to turn
>> > off BUG() ?  As BUG() on any sensible architecture is implemented by
>> > placing the minimum of code at the callsite (eg, one instruction if
>> > not using verbose) anything like the above is likely to be bigger.
>> > 
>> > So, I'd actually argue that rather than trying to "fix" this, get rid
>> > of CONFIG_BUG and make it always enabled everywhere - just like what
>> > has recently been done with hotplug.
> Works for me. 
> 

Thanks all, I should send the related patch for it.

Excuse me, I have to do another things, so I will finish it within this
week (2013-05-26)

Welcome any additional suggestions and completions.


Thanks.
-- 
Chen Gang

Asianux Corporation

WARNING: multiple messages have this Message-ID (diff)
From: Chen Gang <gang.chen@asianux.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] kernel/sched/core.c: need return NULL when BUG() is defined as empty.
Date: Thu, 23 May 2013 09:00:45 +0800	[thread overview]
Message-ID: <519D6A3D.5050003@asianux.com> (raw)
In-Reply-To: <20130522161935.GR18810@twins.programming.kicks-ass.net>

On 05/23/2013 12:19 AM, Peter Zijlstra wrote:
> On Wed, May 22, 2013 at 02:33:17PM +0100, Russell King - ARM Linux wrote:
>> > On Wed, May 22, 2013 at 11:11:56AM +0200, Peter Zijlstra wrote:
>>> > > On Mon, May 20, 2013 at 03:48:53PM +0800, Chen Gang wrote:
>>>> > > > 
>>>> > > > When neither CONFIG_BUG nor HAVE_ARCH_BUG is defined, need let function
>>>> > > > return failure value ('NULL') instead of random value.
>>> > > 
>>> > > What will such a kernel do? Happily continue running whenever we hit a
>>> > > BUG? that seems like a particularly bad idea. Should we not have a stub
>>> > > BUG() function like:
>>> > > 
>>> > > void BUG(void) __attribute__((noreturn))
>>> > > {
>>> > > 	local_irq_disable();
>>> > > 	while (1) ;
>>> > > }
>> > 
>> > Eww.  So you've a platform where you have things like panic_on_oops
>> > enabled, and you hit this bug... do we really want to just stop?
>> > Wouldn't replacing BUG() with panic("BUG"); be better ?
>> > 
>> > But, this begs the question - what is the point of being able to turn
>> > off BUG() ?  As BUG() on any sensible architecture is implemented by
>> > placing the minimum of code at the callsite (eg, one instruction if
>> > not using verbose) anything like the above is likely to be bigger.
>> > 
>> > So, I'd actually argue that rather than trying to "fix" this, get rid
>> > of CONFIG_BUG and make it always enabled everywhere - just like what
>> > has recently been done with hotplug.
> Works for me. 
> 

Thanks all, I should send the related patch for it.

Excuse me, I have to do another things, so I will finish it within this
week (2013-05-26)

Welcome any additional suggestions and completions.


Thanks.
-- 
Chen Gang

Asianux Corporation

  reply	other threads:[~2013-05-23  1:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20  7:48 [PATCH] kernel/sched/core.c: need return NULL when BUG() is defined as empty Chen Gang
2013-05-20  7:48 ` Chen Gang
2013-05-22  9:11 ` Peter Zijlstra
2013-05-22  9:11   ` Peter Zijlstra
2013-05-22  9:29   ` Chen Gang
2013-05-22  9:29     ` Chen Gang
2013-05-22 13:33   ` Russell King - ARM Linux
2013-05-22 13:33     ` Russell King - ARM Linux
2013-05-22 16:19     ` Peter Zijlstra
2013-05-22 16:19       ` Peter Zijlstra
2013-05-23  1:00       ` Chen Gang [this message]
2013-05-23  1:00         ` Chen Gang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=519D6A3D.5050003@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.