Hi,
I'm trying to create a kernel thread from interrupt context. I
installed an irq and I call the kthread_create() function from within
the interrupt handler. I obtain a quite long error message and a
kernel panic (thmx_gadget is the name of my module and hw_cmd_exec the
name of my handler):
[ 33.368835] BUG: scheduling while atomic: swapper/0/0x00010003
[ 33.374694] Modules linked in: thmx_gadget
[ 33.378845]
[ 33.380340] Pid: 0, comm: swapper
[ 33.384857] CPU: 0 Tainted: G W (2.6.32 #0)
[ 33.390136] PC is at omap3_enter_idle+0x108/0x140
[ 33.394897] LR is at omap3_enter_idle+0xfc/0x140
[ 33.399566] pc : [<c004c4d0>] lr : [<c004c4c4>] psr: 60000053
[ 33.399566] sp : c0615f78 ip : 3b9ac9ff fp : 00000000
[ 33.411132] r10: 0000001f r9 : 411fc083 r8 : c066099c
[ 33.416412] r7 : c0660998 r6 : c06608b8 r5 : 00000003 r4 : 00000003
[ 33.422973] r3 : 00000000 r2 : 0359fa20 r1 : 00000000 r0 : 0359fa20
[ 33.429565] Flags: nZCv IRQs on FIQs off Mode SVC_32 ISA ARM
Segment kernel
[ 33.437011] Control: 10c5387d Table: 8fb4c019 DAC: 00000017
[ 33.442810] bad: scheduling from the idle thread!
[ 33.447601] [<c0040c40>] (unwind_backtrace+0x0/0xdc) from
[<c0066b30>] (dequeue_task_idle+0x3)
[ 33.456817] [<c0066b30>] (dequeue_task_idle+0x3c/0x50) from
[<c005f138>] (dequeue_task+0x12c/)
[ 33.465942] [<c005f138>] (dequeue_task+0x12c/0x140) from
[<c005f1d4>] (deactivate_task+0x3c/0)
[ 33.474914] [<c005f1d4>] (deactivate_task+0x3c/0x4c) from
[<c047965c>] (schedule+0x154/0x534)
[ 33.483520] [<c047965c>] (schedule+0x154/0x534) from [<c047a064>]
(schedule_timeout+0x1c/0x2f)
[ 33.492309] [<c047a064>] (schedule_timeout+0x1c/0x2f8) from
[<c0479ee8>] (wait_for_common+0xf)
[ 33.501617] [<c0479ee8>] (wait_for_common+0xf0/0x1a4) from
[<c008824c>] (kthread_create+0x80/)
[ 33.510650] [<c008824c>] (kthread_create+0x80/0xe8) from
[<bf0006bc>] (hw_cmd_exec+0x10/0x2c )
[ 33.520538] [<bf0006bc>] (hw_cmd_exec+0x10/0x2c [thmx_gadget]) from
[<c00a3b54>] (handle_IRQ_)
[ 33.530609] [<c00a3b54>] (handle_IRQ_event+0xac/0x1ec) from
[<c00a5a0c>] (handle_edge_irq+0x1)
[ 33.540008] [<c00a5a0c>] (handle_edge_irq+0x140/0x1a4) from
[<c00547c8>] (gpio_irq_handler+0x)
[ 33.549499] [<c00547c8>] (gpio_irq_handler+0x120/0x154) from
[<c003b074>] (asm_do_IRQ+0x74/0x)
[ 33.558380] [<c003b074>] (asm_do_IRQ+0x74/0x98) from [<c003bb44>]
(__irq_svc+0x44/0xa8)
[ 33.566436] Exception stack(0xc0615f30 to 0xc0615f78)
[ 33.571533] 5f20: 0359fa20
00000000 0359fa20 00000000
[ 33.579803] 5f40: 00000003 00000003 c06608b8 c0660998 c066099c
411fc083 0000001f 00000000
[ 33.588043] 5f60: 3b9ac9ff c0615f78 c004c4c4 c004c4d0 60000053 ffffffff
[ 33.594726] [<c003bb44>] (__irq_svc+0x44/0xa8) from [<c004c4d0>]
(omap3_enter_idle+0x108/0x14)
[ 33.603515] [<c004c4d0>] (omap3_enter_idle+0x108/0x140) from
[<c03796e0>] (cpuidle_idle_call+)
[ 33.613067] [<c03796e0>] (cpuidle_idle_call+0xa4/0x184) from
[<c003cfa4>] (cpu_idle+0x58/0xb8)
[ 33.621765] [<c003cfa4>] (cpu_idle+0x58/0xb8) from [<c0008984>]
(start_kernel+0x26c/0x2d8)
[ 33.630096] [<c0008984>] (start_kernel+0x26c/0x2d8) from
[<80008034>] (0x80008034)
[ 33.641998] Unable to handle kernel NULL pointer dereference at
virtual address 00000000
[ 33.650146] pgd = c0004000
[ 33.652862] [00000000] *pgd=00000000
[ 33.656463] Internal error: Oops: 80000007 [#1] PREEMPT
[ 33.661712] last sysfs file: /sys/kernel/uevent_seqnum
[ 33.666870] Modules linked in: thmx_gadget
[ 33.671020] CPU: 0 Tainted: G W (2.6.32 #0)
[ 33.676269] PC is at 0x0
[ 33.678833] LR is at enqueue_task+0x5c/0x6c
[ 33.683013] pc : [<00000000>] lr : [<c005effc>] psr: 60000093
[ 33.683044] sp : cfb39f10 ip : 00000001 fp : cfb39f24
[ 33.694580] r10: c0616ff8 r9 : 00000000 r8 : 00000001
[ 33.699829] r7 : c0624cd0 r6 : 00000000 r5 : 00000000 r4 : c0616ff8
[ 33.706390] r3 : c047e3d0 r2 : 00000001 r1 : c0616ff8 r0 : c0624cd0
[ 33.712951] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM
Segment kernel
[ 33.720367] Control: 10c5387d Table: 8f244019 DAC: 00000017
[ 33.726165] Process kthreadd (pid: 751, stack limit = 0xcfb382f0)
[ 33.732269] Stack: (0xcfb39f10 to 0xcfb3a000)
[ 33.736663] 9f00: cfb38000
c0624cd0 cfb39f3c cfb39f28
[ 33.744873] 9f20: c005f188 c005efac c0066ae8 00000001 cfb39f7c
cfb39f40 c006a290 c005f158
[ 33.753112] 9f40: cf93afdc 00000000 00000001 20000093 00000011
c0615e2c c0615e78 00000001
[ 33.761322] 9f60: 00000001 c0615e84 00000003 00000000 cfb39fac
cfb39f80 c005f614 c006a1b0
[ 33.769561] 9f80: 00000000 c0615e80 00000013 cfb072c0 bf0000e4
00000000 00000000 00000000
[ 33.777770] 9fa0: cfb39fcc cfb39fb0 c006697c c005f5e8 00000000
c0615e74 cfb39fd4 c0615e74
[ 33.786010] 9fc0: 00000000 cfb39fd0 c0087f34 c006693c 00000000
00000000 cfb39fd8 cfb39fd8
[ 33.794219] 9fe0: 00000000 00000000 00000000 00000000 00000000
c003c9dc 00ffd708 02f3ed10
[ 33.802459] Code: bad PC value
[ 33.805603] ---[ end trace 04f340690f2a18c2 ]---
[ 33.810241] note: kthreadd[751] exited with preempt_count 3
[ 33.818542] Unable to handle kernel NULL pointer dereference at
virtual address 00000000
[ 33.826751] pgd = c0004000
[ 33.829498] [00000000] *pgd=00000000
[ 33.833099] Internal error: Oops: 817 [#2] PREEMPT
[ 33.837890] last sysfs file: /sys/kernel/uevent_seqnum
[ 33.843078] Modules linked in: thmx_gadget
[ 33.847198] CPU: 0 Tainted: G D W (2.6.32 #0)
[ 33.852478] PC is at __sched_setscheduler+0x44/0x378
[ 33.857452] LR is at kthread_create+0xbc/0xe8
[ 33.861846] pc : [<c0069d20>] lr : [<c0088288>] psr: 20000013
[ 33.861846] sp : c0615e30 ip : c0615e70 fp : c0615e6c
[ 33.873382] r10: 00000000 r9 : c0615e94 r8 : c0614000
[ 33.878631] r7 : c0614000 r6 : cfb07280 r5 : 00000000 r4 : cf93adc0
[ 33.885192] r3 : 00000000 r2 : c047e394 r1 : 00000000 r0 : 00010000
[ 33.891754] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM
Segment kernel
[ 33.899108] Control: 10c5387d Table: 8fbdc019 DAC: 00000017
[ 33.904876] Process swapper (pid: 0, stack limit = 0xc06142f0)
[ 33.910736] Stack: (0xc0615e30 to 0xc0616000)
[ 33.915130] 5e20: 00000000
c047e394 00000000 00000000
[ 33.923339] 5e40: 00000000 c0615e94 00000000 cfb07280 c0614000
000000a7 00000000 00000000
[ 33.931579] 5e60: c065bee0 c0615e70 c0088288 c0069ce8 000000a7
bf0000e4 cfb072c0 cf93adc0
[ 33.939788] 5e80: 00000000 c0615e84 c0615e84 c0615e8c c0615e8c
00000000 00000000 c0614000
[ 33.948028] 5ea0: c062ab68 bf0006bc bf001f65 00000000 00000000
c00a3b54 02cb4178 c0614000
[ 33.956237] 5ec0: c062ab68 000000a7 cfb07280 c0683958 c0628048
0000001d fa310018 c00a5a0c
[ 33.964477] 5ee0: 000000a7 c0623a24 00000001 00000001 00000000
c00547c8 00000002 0000001d
[ 33.972686] 5f00: 00000000 c06608b8 00000002 00000001 c0614000
0000001f 00000000 c003b074
[ 33.980926] 5f20: 00000000 ffffffff fa200000 c003bb44 0359fa20
00000000 0359fa20 00000000
[ 33.989135] 5f40: 00000003 00000003 c06608b8 c0660998 c066099c
411fc083 0000001f 00000000
[ 33.997375] 5f60: 3b9ac9ff c0615f78 c004c4c4 c004c4d0 60000053
ffffffff 00000000 0359fa20
[ 34.005584] 5f80: 4d03795c 26b97761 4d03795c 235f7d41 c061ab10
c0617fe0 c061a920 c06b409c
[ 34.013824] 5fa0: 8002ef48 c03796e0 c065fecc c0614000 c0617fe0
c0617e84 c065fecc c003cfa4
[ 34.022033] 5fc0: 00000000 c06a70a0 c065fe90 c0031010 c0617e78
c0008984 c0008498 00000000
[ 34.030273] 5fe0: 00000000 c0031010 10c53c7d c065ff20 c0031414
80008034 00000000 00000000
[ 34.038513] [<c0069d20>] (__sched_setscheduler+0x44/0x378) from
[<c0088288>] (kthread_create+)
[ 34.047973] [<c0088288>] (kthread_create+0xbc/0xe8) from
[<bf0006bc>] (hw_cmd_exec+0x10/0x2c )
[ 34.057769] [<bf0006bc>] (hw_cmd_exec+0x10/0x2c [thmx_gadget]) from
[<c00a3b54>] (handle_IRQ_)
[ 34.067840] [<c00a3b54>] (handle_IRQ_event+0xac/0x1ec) from
[<c00a5a0c>] (handle_edge_irq+0x1)
[ 34.077209] [<c00a5a0c>] (handle_edge_irq+0x140/0x1a4) from
[<c00547c8>] (gpio_irq_handler+0x)
[ 34.086669] [<c00547c8>] (gpio_irq_handler+0x120/0x154) from
[<c003b074>] (asm_do_IRQ+0x74/0x)
[ 34.095520] [<c003b074>] (asm_do_IRQ+0x74/0x98) from [<c003bb44>]
(__irq_svc+0x44/0xa8)
[ 34.103546] Exception stack(0xc0615f30 to 0xc0615f78)
[ 34.108642] 5f20: 0359fa20
00000000 0359fa20 00000000
[ 34.116851] 5f40: 00000003 00000003 c06608b8 c0660998 c066099c
411fc083 0000001f 00000000
[ 34.125061] 5f60: 3b9ac9ff c0615f78 c004c4c4 c004c4d0 60000053 ffffffff
[ 34.131744] [<c003bb44>] (__irq_svc+0x44/0xa8) from [<c004c4d0>]
(omap3_enter_idle+0x108/0x14)
[ 34.140502] [<c004c4d0>] (omap3_enter_idle+0x108/0x140) from
[<c03796e0>] (cpuidle_idle_call+)
[ 34.150024] [<c03796e0>] (cpuidle_idle_call+0xa4/0x184) from
[<c003cfa4>] (cpu_idle+0x58/0xb8)
[ 34.158691] [<c003cfa4>] (cpu_idle+0x58/0xb8) from [<c0008984>]
(start_kernel+0x26c/0x2d8)
[ 34.167022] [<c0008984>] (start_kernel+0x26c/0x2d8) from
[<80008034>] (0x80008034)
[ 34.174621] Code: e3500000 e50b2038 0a000002 e3a03000 (e5833000)
[ 34.180786] ---[ end trace 04f340690f2a18c3 ]---
[ 34.185424] Kernel panic - not syncing: Fatal exception in interrupt
It seems to be something related to the cpu_idle configuration i used
for my kernel config. In fact I used a customized version of the
configuration found at
http://www.angstrom-distribution.org/demo/beagleboard/config-2.6.32-r90+gitra6bad4464f985fdd3bed72e1b82dcbfc004d7869-beagleboard.multi-config-cpuidle.config
Any idea could be very appreciate. Thank you,
Daniele