public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 'sleeping function called from invalid context' bug when mounting an IDE device
@ 2005-07-08 12:28 Vitaly Wool
  2005-07-08 13:43 ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Vitaly Wool @ 2005-07-08 12:28 UTC (permalink / raw)
  To: mingo; +Cc: linux-kernel

Hi Ingo,

I've come across the following problem during the debugging of IDE driver for
Philips PNX0105 ARM9 platform in RT mode (CONFIG_PREEMPT_RT).
When I mount/unmount a device, the following error is printed out to a terminal:
 
> # mount /dev/discs/disc0/part1 /mnt/
> BUG: sleeping function called from invalid context IRQ 27(655) at
> kernel/rt.c:1449in_atomic():0 [00000000], irqs_disabled():128
 
And gdb shows the following:
 
> (gdb) b kernel/sched.c:5430
> Breakpoint 1 at 0xc0034880: file kernel/sched.c, line 5430.
> (gdb) c
> Continuing.
> 
> Breakpoint 1, __might_sleep (file=0x56 <Address 0x56 out of bounds>,
> line=1449)
>	 at kernel/sched.c:5434
> 5434			     in_atomic(), preempt_count(),
> irqs_disabled());
> (gdb) bt
> #0  __might_sleep (file=0x56 <Address 0x56 out of bounds>, line=1449)
>	 at kernel/sched.c:5434
> #1  0xc004f700 in __spin_lock (lock=0xc01ee10c, eip=3222413300) at
> kernel/rt.c:1449
> #2  0xc004f778 in _spin_lock_irqsave (spin=0x56) at kernel/rt.c:1474
> #3  0xc0121ff4 in ide_intr (irq=27, dev_id=0x0, regs=0x0) at
> drivers/ide/ide-io.c:1416
> #4  0xc00201c0 in __do_irq (irq=27, action=0xc03f8df4, regs=0x0)
>	 at arch/arm/kernel/irq.c:530
> #5  0xc001fec0 in do_hardirq (desc=0xc021f2bc) at
> arch/arm/kernel/irq.c:394
> #6  0xc0020008 in do_irqd (__desc=0xc021f2bc) at
> arch/arm/kernel/irq.c:447
> #7  0xc004c310 in kthread (_create=0xc02abe20) at kernel/kthread.c:95
> #8  0xc0039af4 in exit_notify (tsk=0x0) at kernel/exit.c:785
> Previous frame inner to this frame (corrupt stack?)
> 
So, the problem is in the generic IDE code, namely, in ide_intr() taking ide_lock.

The suggested patch is the following:

Index: linux/drivers/ide/ide-probe.c
===================================================================
--- linux.orig/drivers/ide/ide-probe.c	2005-05-11 19:08:12.000000000 +0000
+++ linux/drivers/ide/ide-probe.c	2005-05-12 16:19:29.000000000 +0000
@@ -1050,16 +1050,13 @@
 	 * Allocate the irq, if not already obtained for another hwif
 	 */
 	if (!match || match->irq != hwif->irq) {
-		int sa = SA_INTERRUPT;
+		int sa = 0;
 #if defined(__mc68000__) || defined(CONFIG_APUS)
 		sa = SA_SHIRQ;
 #endif /* __mc68000__ || CONFIG_APUS */
 
 		if (IDE_CHIPSET_IS_PCI(hwif->chipset)) {
 			sa = SA_SHIRQ;
-#ifndef CONFIG_IDEPCI_SHARE_IRQ
-			sa |= SA_INTERRUPT;
-#endif /* CONFIG_IDEPCI_SHARE_IRQ */
 		}
 
 		if (hwif->io_ports[IDE_CONTROL_OFFSET])

Can you please comment on it?

Thanks,
   Vitaly

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

* Re: 'sleeping function called from invalid context' bug when mounting an IDE device
  2005-07-08 12:28 'sleeping function called from invalid context' bug when mounting an IDE device Vitaly Wool
@ 2005-07-08 13:43 ` Ingo Molnar
  2005-07-08 14:00   ` Daniel Walker
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2005-07-08 13:43 UTC (permalink / raw)
  To: Vitaly Wool; +Cc: linux-kernel


* Vitaly Wool <vwool@ru.mvista.com> wrote:

> Hi Ingo,
> 
> I've come across the following problem during the debugging of IDE 
> driver for Philips PNX0105 ARM9 platform in RT mode 
> (CONFIG_PREEMPT_RT). When I mount/unmount a device, the following 
> error is printed out to a terminal:

could you send me the full backtrace?

> So, the problem is in the generic IDE code, namely, in ide_intr() 
> taking ide_lock.

which version did you try, and does this happen with the latest patch 
too?

	Ingo

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

* Re: 'sleeping function called from invalid context' bug when mounting an IDE device
  2005-07-08 13:43 ` Ingo Molnar
@ 2005-07-08 14:00   ` Daniel Walker
  2005-07-08 14:02     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Walker @ 2005-07-08 14:00 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Vitaly Wool, linux-kernel

On Fri, 2005-07-08 at 15:43 +0200, Ingo Molnar wrote:
> * Vitaly Wool <vwool@ru.mvista.com> wrote:
> 
> > Hi Ingo,
> > 
> > I've come across the following problem during the debugging of IDE 
> > driver for Philips PNX0105 ARM9 platform in RT mode 
> > (CONFIG_PREEMPT_RT). When I mount/unmount a device, the following 
> > error is printed out to a terminal:
> 
> could you send me the full backtrace?
> 
> > So, the problem is in the generic IDE code, namely, in ide_intr() 
> > taking ide_lock.
> 
> which version did you try, and does this happen with the latest patch 
> too?

Interrupts should be enabled unconditionally for threaded interrupt
handlers. Or at least the generics work that way.

Daniel


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

* Re: 'sleeping function called from invalid context' bug when mounting an IDE device
  2005-07-08 14:00   ` Daniel Walker
@ 2005-07-08 14:02     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2005-07-08 14:02 UTC (permalink / raw)
  To: Daniel Walker; +Cc: Vitaly Wool, linux-kernel


* Daniel Walker <dwalker@mvista.com> wrote:

> > > So, the problem is in the generic IDE code, namely, in ide_intr() 
> > > taking ide_lock.
> > 
> > which version did you try, and does this happen with the latest patch 
> > too?
> 
> Interrupts should be enabled unconditionally for threaded interrupt 
> handlers. Or at least the generics work that way.

yes, that's why i'm asking about the version and the full backtrace.  
Threaded irq handlers run with irqs enabled:

        /*
         * Unconditionally enable interrupts for threaded
         * IRQ handlers:
         */
        if (!hardirq_count() || !(action->flags & SA_INTERRUPT))
                raw_local_irq_enable();

    Ingo

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

end of thread, other threads:[~2005-07-08 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-08 12:28 'sleeping function called from invalid context' bug when mounting an IDE device Vitaly Wool
2005-07-08 13:43 ` Ingo Molnar
2005-07-08 14:00   ` Daniel Walker
2005-07-08 14:02     ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox