![如果 preempt_enable() 在 nmi 内会发生什么?](https://linux22.com/image/210344/%E5%A6%82%E6%9E%9C%20preempt_enable()%20%E5%9C%A8%20nmi%20%E5%86%85%E4%BC%9A%E5%8F%91%E7%94%9F%E4%BB%80%E4%B9%88%EF%BC%9F.png)
preempt_enable()
之前nmi_exit()
,这是一个好的代码吗?
if ((m.cs & 3) == 3) {
/* If this triggers there is no way to recover. Die hard. */
BUG_ON(!on_thread_stack() || !user_mode(regs));
local_irq_enable();
preempt_enable();
current->task_struct_rh->mce_ripv = !!(m.mcgstatus & MCG_STATUS_RIPV);
current->task_struct_rh->mce_whole_page = whole_page(&m);
if (kill_it || do_memory_failure(&m))
force_sig(SIGBUS, current);
preempt_disable();
local_irq_disable();
} else {
if (!fixup_exception(regs, X86_TRAP_MC))
mce_panic("Failed kernel mode recovery", &m, NULL);
}
out_ist:
nmi_exit();
}
根据我的理解,如果 ,内核无法抢占preempt_count > 0
,在这种情况下,它位于 NMI 内部,因此preempt_count > 0
。
它正在发送 SIGBUS:
force_sig(SIGBUS, current);
似乎没有必要做local_irq_enable
和preempt_enable
?