linux-stable/arch/x86/kvm
Sean Christopherson d7a08882a0 KVM: x86: Unconditionally enable irqs in guest context
On VMX, KVM currently does not re-enable irqs until after it has exited
the guest context.  As a result, a tick that fires in the window between
VM-Exit and guest_exit_irqoff() will be accounted as system time.  While
said window is relatively small, it's large enough to be problematic in
some configurations, e.g. if VM-Exits are consistently occurring a hair
earlier than the tick irq.

Intentionally toggle irqs back off so that guest_exit_irqoff() can be
used in lieu of guest_exit() in order to avoid the save/restore of flags
in guest_exit().  On my Haswell system, "nop; cli; sti" is ~6 cycles,
versus ~28 cycles for "pushf; pop <reg>; cli; push <reg>; popf".

Fixes: f2485b3e0c ("KVM: x86: use guest_exit_irqoff")
Reported-by: Wei Yang <w90p710@gmail.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-11 15:10:22 +02:00
..
vmx KVM nVMX: Check Host Segment Registers and Descriptor Tables on vmentry of nested guests 2019-07-05 14:01:51 +02:00
cpuid.c KVM: cpuid: remove has_leaf_count from struct kvm_cpuid_param 2019-07-05 13:48:45 +02:00
cpuid.h KVM/x86: Update the reverse_cpuid list to include CPUID_7_EDX 2018-02-03 23:06:51 +01:00
debugfs.c KVM: LAPIC: Expose per-vCPU timer_advance_ns to userspace 2019-05-24 21:27:09 +02:00
emulate.c KVM: x86: Use DR_TRAP_BITS instead of hard-coded 15 2019-06-18 11:43:42 +02:00
hyperv.c * ARM: support for SVE and Pointer Authentication in guests, PMU improvements 2019-05-17 10:33:30 -07:00
hyperv.h x86/kvm/hyper-v: Introduce KVM_GET_SUPPORTED_HV_CPUID 2018-12-14 17:59:54 +01:00
i8254.c kvm: x86: Add memcg accounting to KVM allocations 2019-02-20 22:48:30 +01:00
i8254.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
i8259.c kvm: x86: Add memcg accounting to KVM allocations 2019-02-20 22:48:30 +01:00
ioapic.c kvm: x86: Add memcg accounting to KVM allocations 2019-02-20 22:48:30 +01:00
ioapic.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
irq.c kvm: Check irqchip mode before assign irqfd 2019-05-24 21:27:12 +02:00
irq.h kvm: x86: Fix -Wmissing-prototypes warnings 2019-07-10 16:35:58 +02:00
irq_comm.c kvm: x86: check kvm_apic_sw_enabled() is enough 2019-06-18 11:43:46 +02:00
Kconfig kvm: x86: add host poll control msrs 2019-06-18 11:43:46 +02:00
kvm_cache_regs.h KVM: x86: use direct accessors for RIP and RSP 2019-04-30 22:07:26 +02:00
lapic.c KVM: LAPIC: Retry tune per-vCPU timer_advance_ns if adaptive tuning goes insane 2019-07-05 21:54:25 +02:00
lapic.h kvm: x86: use same convention to name kvm_lapic_{set,clear}_vector() 2019-06-18 11:43:47 +02:00
Makefile KVM: x86: fix TRACE_INCLUDE_PATH and remove -I. header search paths 2019-01-25 19:12:37 +01:00
mmu.c KVM: x86: add tracepoints around __direct_map and FNAME(fetch) 2019-07-05 13:48:48 +02:00
mmu.h kvm: mmu: Fix overflow on kvm mmu page limit calculation 2019-04-16 15:37:30 +02:00
mmu_audit.c x86/kvm/mmu: make vcpu->mmu a pointer to the current MMU 2018-10-17 00:30:02 +02:00
mmutrace.h KVM: x86: add tracepoints around __direct_map and FNAME(fetch) 2019-07-05 13:48:48 +02:00
mtrr.c KVM: x86: optimize check for valid PAT value 2019-04-16 15:39:02 +02:00
page_track.c kvm: x86: Add memcg accounting to KVM allocations 2019-02-20 22:48:30 +01:00
paging_tmpl.h KVM: x86: add tracepoints around __direct_map and FNAME(fetch) 2019-07-05 13:48:48 +02:00
pmu.c KVM: x86: PMU Event Filter 2019-07-11 15:08:28 +02:00
pmu.h KVM: x86: PMU Event Filter 2019-07-11 15:08:28 +02:00
pmu_amd.c KVM: x86/pmu: mask the result of rdpmc according to the width of the counters 2019-05-24 21:27:13 +02:00
svm.c KVM: x86: Unconditionally enable irqs in guest context 2019-07-11 15:10:22 +02:00
trace.h KVM: LAPIC: remove the trailing newline used in the fmt parameter of TP_printk 2019-07-03 16:14:39 +02:00
tss.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
x86.c KVM: x86: Unconditionally enable irqs in guest context 2019-07-11 15:10:22 +02:00
x86.h KVM: x86: introduce is_pae_paging 2019-06-18 11:47:38 +02:00