Re: BUG with 0.7.27-11, with KGDB

From: hui
Date: Wed Nov 17 2004 - 04:21:32 EST


On Wed, Nov 17, 2004 at 12:26:20AM -0800, Bill Huey wrote:
> On Wed, Nov 17, 2004 at 01:29:33PM +0530, Amit Shah wrote:
> > Initializing Cryptographic API
> > kgdb <20030915.1651.33> : port =3f8, IRQ=4, divisor =1
> > BUG: scheduling while atomic: swapper/0x00000001/1
> > caller is schedule+0x3f/0x13c
> > [<c01041f4>] dump_stack+0x23/0x27 (20)
> > [<c02ce307>] __sched_text_start+0xc97/0xce7 (116)
> > [<c02ce396>] schedule+0x3f/0x13c (36)
> > [<c02ce60a>] wait_for_completion+0x95/0x137 (96)
> > [<c0138cd8>] kthread_create+0x22a/0x22c (368)
> > [<c0145a30>] start_irq_thread+0x4f/0x83 (32)
> > [<c01453ec>] setup_irq+0x55/0x140 (36)
> > [<c0145655>] request_irq+0x90/0x107 (44)
> > [<c01e1bc1>] kgdb_enable_ints_now+0xa5/0xb0 (28)
> > [<c03bfb89>] kgdb_enable_ints+0x2c/0x63 (16)
> > [<c03a8a23>] do_initcalls+0x31/0xc6 (32)
> > [<c01003bb>] init+0x87/0x19a (28)
> > [<c0101329>] kernel_thread_helper+0x5/0xb (1047322644)
>
> Woops, it means that KGDB needs a direct irq and not an irq-thread.
> Let me see if I can work up something tonight before I head to bed.

It could be horribly wrong for a number of reasons (wait for Ingo
for a proper irq code fix and additional support), but try this:

[attachment]

It should be a good hint as to how to fix this problem.

bill

diff -rwu linux.voluntary.virgin/kernel/irq/manage.c linux.voluntary/kernel/irq/manage.c
--- linux.voluntary.virgin/kernel/irq/manage.c 2004-11-16 16:39:24.000000000 -0800
+++ linux.voluntary/kernel/irq/manage.c 2004-11-17 00:39:46.000000000 -0800
@@ -362,6 +363,11 @@
}
#endif

+ if (irqflags & SA_NODELAYFORCED) {
+ irqflags &= ~SA_NODELAYFORCED;
+ irqflags |= SA_NODELAY;
+ }
+
action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
if (!action)
return -ENOMEM;
--- linux.voluntary.virgin/arch/i386/lib/kgdb_serial.c 2004-11-16 16:39:24.000000000 -0800
+++ linux.voluntary/arch/i386/lib/kgdb_serial.c 2004-11-17 00:40:04.000000000 -0800
@@ -435,7 +435,7 @@
#endif
ints_disabled = request_irq(gdb_async_info->state->irq,
gdb_interrupt,
- IRQ_T(gdb_async_info),
+ IRQ_T(gdb_async_info) | SA_NODELAYFORCED,
"KGDB-stub", NULL);
intprintk(("KGDB: request_irq returned %d\n", ints_disabled));
}

--- linux.voluntary.virgin/include/linux/irq.h 2004-11-16 16:39:24.000000000 -0800
+++ linux.voluntary/include/linux/irq.h 2004-11-17 00:27:29.000000000 -0800
@@ -42,6 +42,7 @@
*/
#ifndef SA_NODELAY
# define SA_NODELAY 0x01000000
+# define SA_NODELAYFORCED 0x02000000
#endif

/*