linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Can BUG() also be used "safely" in interrupts?
@ 2002-05-17  7:01 Ingo Oeser
  2002-05-17 14:27 ` Tommy Reynolds
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Oeser @ 2002-05-17  7:01 UTC (permalink / raw)
  To: linux-kernel

Hi there,

I have a routine to be used in an ISR or BH, where I like to use
BUG(), to flag real bugs the caller produces, if he uses it with
wrong arguments (namely: check for asserted interrupts according
to a mask and flag an BUG(), if the mask is bogus).

So can BUG() be used in an ISR or BH?

Thanks & Regards

Ingo Oeser
-- 
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can BUG() also be used "safely" in interrupts?
  2002-05-17  7:01 Can BUG() also be used "safely" in interrupts? Ingo Oeser
@ 2002-05-17 14:27 ` Tommy Reynolds
  2002-05-18 18:58   ` Ingo Oeser
  0 siblings, 1 reply; 3+ messages in thread
From: Tommy Reynolds @ 2002-05-17 14:27 UTC (permalink / raw)
  To: Ingo Oeser; +Cc: linux-kernel

Uttered "Ingo Oeser" <ingo.oeser@informatik.tu-chemnitz.de>, spoke thus:

>  I have a routine to be used in an ISR or BH, where I like to use
>  BUG(), to flag real bugs the caller produces, if he uses it with
>  wrong arguments (namely: check for asserted interrupts according
>  to a mask and flag an BUG(), if the mask is bogus).
> 
>  So can BUG() be used in an ISR or BH?

BUG() is overkill here, since it breaks all existing spin locks trying to get
the error message printed by the kernel.  Instead, why not just:

	printk( KERN_WARN "spurious interrupt from my device\n" );

like everyone else does?  Keep in mind that if you are sharing an interrupt
vector, each and every interrupt handler gets called for each and every
interrupt, so having the device driver check that the device to which it is
attached is really generating an interrupt is simple good form.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can BUG() also be used "safely" in interrupts?
  2002-05-17 14:27 ` Tommy Reynolds
@ 2002-05-18 18:58   ` Ingo Oeser
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Oeser @ 2002-05-18 18:58 UTC (permalink / raw)
  To: Tommy Reynolds; +Cc: linux-kernel

On Fri, May 17, 2002 at 09:27:40AM -0500, Tommy Reynolds wrote:
> BUG() is overkill here, since it breaks all existing spin locks trying to get
> the error message printed by the kernel.  Instead, why not just:
> 
> 	printk( KERN_WARN "spurious interrupt from my device\n" );
> 
> like everyone else does? 

That's what I do now.

> Keep in mind that if you are sharing an interrupt vector, each
> and every interrupt handler gets called for each and every
> interrupt, so having the device driver check that the device to
> which it is attached is really generating an interrupt is
> simple good form.

This is already being done. But I do REALLY paranoid checking of
each and every parameter of every function that is not declared 'static'.

But in this case the caller of the function or the hardware is
doing really strange things and it should be fixed ASAP and this
is the best way to catch the caller ;-)

Regards

Ingo Oeser
-- 
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-05-18 19:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-17  7:01 Can BUG() also be used "safely" in interrupts? Ingo Oeser
2002-05-17 14:27 ` Tommy Reynolds
2002-05-18 18:58   ` Ingo Oeser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).