【问题标题】:How to tell the difference between soft lockup in kernel and softlockup in userspace?如何区分内核中的软锁定和用户空间中的软锁定?
【发布时间】:2014-12-28 02:34:46
【问题描述】:

我有以下锁定。这是否表明 slic_test pid 5207 是违规者,还是仅表明因为内核中的当前宏仍指向使系统调用进入我的驱动程序的用户空间进程?此外 - irq event stamp 0 ... irq event stamp 究竟代表什么?不能是开机以来的中断次数……88798秒后肯定不止0次……

系统是单处理器,禁用了 CONFIG_SMP。

[88798.449628] BUG: soft lockup - CPU#0 stuck for 61s! [slic_test:5207]
[88798.449628] Modules linked in: slic_xxxx leds_xxxx vortex86_spi dm_mirror dm_log dm_multipath dm_mod ohci_hcd ehci_hcd r6040 vortex86_wdt vortex86_gpio [last un]
[88798.449628] irq event stamp: 0
[88798.449628] hardirqs last  enabled at (0): [<00000000>] 0x0
[88798.449628] hardirqs last disabled at (0): [<c0115563>] copy_process+0x233/0x1090
[88798.449628] softirqs last  enabled at (0): [<c0115563>] copy_process+0x233/0x1090
[88798.449628] softirqs last disabled at (0): [<00000000>] 0x0
[88798.449628]
[88798.449628] Pid: 5207, comm: slic_test Not tainted (2.6.27.62 #11)
[88798.449628] EIP: 0060:[<c011b6b5>] EFLAGS: 00000246 CPU: 0
[88798.449628] EIP is at __do_softirq+0x45/0xb0
[88798.449628] EAX: 00000000 EBX: 00000082 ECX: 00000001 EDX: dfac5080
[88798.449628] ESI: c0696120 EDI: 0000000a EBP: df3bdf8c ESP: df3bdf80
[88798.449628]  DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
[88798.449628] CR0: 8005003b CR2: b7622780 CR3: 1f3c8000 CR4: 00000000
[88798.449628] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[88798.449628] DR6: ffff0ff0 DR7: 00000400
[88798.449628]  [<c011b766>] do_softirq+0x46/0x50
[88798.449628]  [<c011bad5>] irq_exit+0x45/0x50
[88798.449628]  [<c01057ba>] do_IRQ+0x4a/0x90
[88798.449628]  [<c0103e68>] common_interrupt+0x28/0x30
[88798.449628]  =======================

【问题讨论】:

  • 当进程只执行内核上下文而不是用户上下文时会发生软锁定。软锁定是一个错误,它会导致内核在内核模式下循环一段不合理的时间,从而阻止其他进程运行。

标签: linux linux-kernel kernel driver linux-device-driver


【解决方案1】:

呼叫跟踪的存在/不存在表明软锁定的来源。

[88798.449628]  [<c011b766>] do_softirq+0x46/0x50
[88798.449628]  [<c011bad5>] irq_exit+0x45/0x50
[88798.449628]  [<c01057ba>] do_IRQ+0x4a/0x90
[88798.449628]  [<c0103e68>] common_interrupt+0x28/0x30
  • Linux 内核导致上述 call-trace 描述的上述软锁定。

  • 如果用户空间进程导致软锁定,则会记录一行通过其 pid 标识该进程的行,然后是各种 CPU 寄存器的内容,无需调用 -任何形式的痕迹。

【讨论】:

    【解决方案2】:

    [88798.449628] Pid: 5207, comm: slic_test 未污染 (2.6.27.62 #11)

    未污染意味着内核发生了问题。

    “污染”标志是内核表示它不是内核错误的方式(内核源代码是开放且“纯的”。“污染”来自非 GPL 模块等。

    http://www.opensourceforu.com/2011/01/understanding-a-kernel-oops/

    【讨论】:

    • "Not tainted"/"Tainted" 与这个问题没有任何关系。它仅指示是否加载了非 GPL 模块。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多