如果ISR在Linux中挂起会发生什么?

时间:2017-06-03 16:46:38

标签: linux linux-kernel

如果ISR由于某种原因而挂起,例如等待自旋锁,或永无止境的循环,Linux如何从中恢复?

1 个答案:

答案 0 :(得分:1)

如果我们因某种原因陷入ISR,那么很难从这个状态中取出系统。在相等的时间间隔之后,您将获得内核堆栈跟踪,但是不可能说系统将从此状态恢复。即使在最坏的情况下,我们也可能需要重启。

内核跟踪与此类似:

[ 1872.084006] CPU: 0 PID: 5585 Comm: insmod Tainted: G OEL 4.4.0-78-generic #99~14.04.2-Ubuntu [ 1872.084006] Hardware name: LENOVO 2847DJU/2847DJU, BIOS 6JET85WW (1.43 ) 12/24/2010 [ 1872.084006] task: ffff880117d94e00 ti: ffff88004a654000 task.ti: ffff88004a654000 [ 1872.084006] RIP: 0010:[<ffffffffc0008019>] [<ffffffffc0008019>] sample_init+0x19/0x1000 [sample] [ 1872.084006] RSP: 0018:ffff88004a657cc0 EFLAGS: 00000292 [ 1872.084006] RAX: 0000000000000020 RBX: ffffffff81e13080 RCX: 0000000000000006 [ 1872.084006] RDX: 0000000000000000 RSI: 0000000000000246 RDI: ffff88013fc0dd90 [ 1872.084006] RBP: ffff88004a657cc0 R08: 000000000000000a R09: 0000000000000000 [ 1872.084006] R10: 0000000000000000 R11: 000000000000047c R12: ffff88003a50ffe0 [ 1872.084006] R13: 0000000000000000 R14: ffffffffc0008000 R15: ffff88004a657eb0 [ 1872.084006] FS: 00007f53c147b740(0000) GS:ffff88013fc00000(0000) knlGS:0000000000000000 [ 1872.084006] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1872.084006] CR2: ffffffffc0007fee CR3: 000000004a530000 CR4: 00000000000406f0 [ 1872.084006] Stack: [ 1872.084006] ffff88004a657d38 ffffffff8100213d ffff88004a657eb0 ffff88004a657d10 [ 1872.084006] 0000000000000246 0000000000000002 ffffffff811deafd ffff88013b401c00 [ 1872.084006] ffffffff81183ca4 0000000000000018 00000000f91cc401 ffffffffc06f3000 [ 1872.084006] Call Trace: [ 1872.084006] [<ffffffff8100213d>] do_one_initcall+0xcd/0x1f0 [ 1872.084006] [<ffffffff811deafd>] ? kmem_cache_alloc_trace+0x1ad/0x220 [ 1872.084006] [<ffffffff81183ca4>] ? do_init_module+0x27/0x1d2 [ 1872.084006] [<ffffffff81183cdd>] do_init_module+0x60/0x1d2 [ 1872.084006] [<ffffffff81104134>] load_module+0x1424/0x1b10 [ 1872.084006] [<ffffffff81100920>] ? __symbol_put+0x40/0x40 [ 1872.084006] [<ffffffff81206be1>] ? kernel_read+0x41/0x60 [ 1872.084006] [<ffffffff811049ee>] SYSC_finit_module+0x7e/0xa0 [ 1872.084006] [<ffffffff81104a2e>] SyS_finit_module+0xe/0x10 [ 1872.084006] [<ffffffff8180b776>] entry_SYSCALL_64_fastpath+0x16/0x75 [ 1872.084006] Code: <eb> fe 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 1884.688004] INFO: rcu_sched self-detected stall on CPU [ 1884.688004] 0-...: (105006 ticks this GP) idle=41d/140000000000001/0 softirq=64742/64742 fqs=104241 [ 1884.688004] (t=105006 jiffies g=35345 c=35344 q=27697) [ 1884.688004] Task dump for CPU 0: [ 1884.688004] insmod R running task 0 5585 1990 0x0000000c [ 1884.688004] ffffffff81e55040 ffff88013fc03db8 ffffffff810ab14f 0000000000000000 [ 1884.688004] ffffffff81e55040 ffff88013fc03dd0 ffffffff810ad8b9 0000000000000001 [ 1884.688004] ffff88013fc03e00 ffffffff810dff6a ffff88013fc17b80 ffffffff81e55040 [ 1884.688004] Call Trace: [ 1884.688004] <IRQ> [<ffffffff810ab14f>] sched_show_task+0xaf/0x110 [ 1884.688004] [<ffffffff810ad8b9>] dump_cpu_task+0x39/0x40 [ 1884.688004] [<ffffffff810dff6a>] rcu_dump_cpu_stacks+0x8a/0xc0 [ 1884.688004] [<ffffffff810e3a93>] rcu_check_callbacks+0x4b3/0x7a0 [ 1884.688004] [<ffffffff810ae361>] ? account_system_time+0x81/0x110 [ 1884.688004] [<ffffffff810ae600>] ? account_process_tick+0x60/0x170 [ 1884.688004] [<ffffffff810f9200>] ? tick_sched_do_timer+0x30/0x30 [ 1884.688004] [<ffffffff810e9b79>] update_process_times+0x39/0x60 [ 1884.688004] [<ffffffff810f8c05>] tick_sched_handle.isra.15+0x25/0x60 [ 1884.688004] [<ffffffff810f923d>] tick_sched_timer+0x3d/0x70 [ 1884.688004] [<ffffffff810ea6d3>] __hrtimer_run_queues+0xf3/0x260 [ 1884.688004] [<ffffffff810eab78>] hrtimer_interrupt+0xa8/0x1a0 [ 1884.688004] [<ffffffffc0008000>] ? 0xffffffffc0008000 [ 1884.688004] [<ffffffff81050ec5>] local_apic_timer_interrupt+0x35/0x60 [ 1884.688004] [<ffffffff8180e21d>] smp_apic_timer_interrupt+0x3d/0x50 [ 1884.688004] [<ffffffff8180c4e2>] apic_timer_interrupt+0x82/0x90 [ 1884.688004] <EOI> [<ffffffffc0008000>] ? 0xffffffffc0008000 [ 1884.688004] [<ffffffffc0008019>] ? sample_init+0x19/0x1000 [sample] [ 1884.688004] [<ffffffff8100213d>] do_one_initcall+0xcd/0x1f0 [ 1884.688004] [<ffffffff811deafd>] ? kmem_cache_alloc_trace+0x1ad/0x220 [ 1884.688004] [<ffffffff81183ca4>] ? do_init_module+0x27/0x1d2 [ 1884.688004] [<ffffffff81183cdd>] do_init_module+0x60/0x1d2 [ 1884.688004] [<ffffffff81104134>] load_module+0x1424/0x1b10 [ 1884.688004] [<ffffffff81100920>] ? __symbol_put+0x40/0x40 [ 1884.688004] [<ffffffff81206be1>] ? kernel_read+0x41/0x60 [ 1884.688004] [<ffffffff811049ee>] SYSC_finit_module+0x7e/0xa0 [ 1884.688004] [<ffffffff81104a2e>] SyS_finit_module+0xe/0x10 [ 1884.688004] [<ffffffff8180b776>] entry_SYSCALL_64_fastpath+0x16/0x75