x86/irq: Let interrupt handlers set kvm_cpu_l1tf_flush_l1d
authorNicolai Stange <nstange@suse.de>
Sun, 29 Jul 2018 11:06:04 +0000 (13:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Aug 2018 16:12:58 +0000 (18:12 +0200)
commit ffcba43ff66c7dab34ec700debd491d2a4d319b4 upstream

The last missing piece to having vmx_l1d_flush() take interrupts after
VMEXIT into account is to set the kvm_cpu_l1tf_flush_l1d per-cpu flag on
irq entry.

Issue calls to kvm_set_cpu_l1tf_flush_l1d() from entering_irq(),
ipi_entering_ack_irq(), smp_reschedule_interrupt() and
uv_bau_message_interrupt().

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Nicolai Stange <nstange@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/apic.h
arch/x86/kernel/smp.c
arch/x86/platform/uv/tlb_uv.c

index 77ffd3b7894f5807f8cd5752317f0ee84a413472..a1ed92aae12a6652210e392347cc54bc0b34f29a 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/fixmap.h>
 #include <asm/mpspec.h>
 #include <asm/msr.h>
+#include <asm/hardirq.h>
 
 #define ARCH_APICTIMER_STOPS_ON_C3     1
 
@@ -626,6 +627,7 @@ extern void irq_exit(void);
 static inline void entering_irq(void)
 {
        irq_enter();
+       kvm_set_cpu_l1tf_flush_l1d();
 }
 
 static inline void entering_ack_irq(void)
@@ -638,6 +640,7 @@ static inline void ipi_entering_ack_irq(void)
 {
        irq_enter();
        ack_APIC_irq();
+       kvm_set_cpu_l1tf_flush_l1d();
 }
 
 static inline void exiting_irq(void)
index 5c574dff4c1a00990c6e6d8e5d993cc2777c6c6f..04adc8d60aed82178caf3a099d66b497a6c11bcf 100644 (file)
@@ -261,6 +261,7 @@ __visible void __irq_entry smp_reschedule_interrupt(struct pt_regs *regs)
 {
        ack_APIC_irq();
        inc_irq_stat(irq_resched_count);
+       kvm_set_cpu_l1tf_flush_l1d();
 
        if (trace_resched_ipi_enabled()) {
                /*
index 0b530c53de1f8bc4edf2d4deac6b60620de4c491..34f9a9ce62360cb20d4f1354410a2df8c9a988a6 100644 (file)
@@ -1285,6 +1285,7 @@ void uv_bau_message_interrupt(struct pt_regs *regs)
        struct msg_desc msgdesc;
 
        ack_APIC_irq();
+       kvm_set_cpu_l1tf_flush_l1d();
        time_start = get_cycles();
 
        bcp = &per_cpu(bau_control, smp_processor_id());