Re: [PATCH] x86/apic: Fix suspicious RCU usage in smp_trace_call_function_interrupt

From: Wanpeng Li
Date: Thu Oct 13 2016 - 08:20:26 EST


2016-10-12 21:17 GMT+08:00 Thomas Gleixner <tglx@xxxxxxxxxxxxx>:
> On Wed, 12 Oct 2016, Wanpeng Li wrote:
>> irq_enter() which is called in scheduler_ipi() is too late to tell RCU
>> susbstems to end the extended quiescent state before ack_APIC_irq(),
>> any ideas?
>
> You can call irq_enter/exit() in __smp_reschedule_interrupt(). It can be
> called nested.

In smp_reschedule_interrupt()? Do you mean something like this?

diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 658777c..ac2ee87 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -259,8 +259,10 @@ static inline void __smp_reschedule_interrupt(void)

__visible void smp_reschedule_interrupt(struct pt_regs *regs)
{
+ irq_enter();
ack_APIC_irq();
__smp_reschedule_interrupt();
+ irq_exit();
/*
* KVM uses this interrupt to force a cpu out of guest mode
*/