diff options
author | Vitaly Kuznetsov <[email protected]> | 2019-04-03 19:03:09 +0200 |
---|---|---|
committer | Ingo Molnar <[email protected]> | 2019-04-16 12:28:23 +0200 |
commit | ba696429d290690db967e5f49463df4b2c1314a4 (patch) | |
tree | 2ab43dcb4eb5e5139d623dcc069735dea6479297 | |
parent | 618d919cae2fcaadc752f27ddac8b939da8b441a (diff) |
x86/hyper-v: Implement EOI assist
Hyper-V TLFS suggests an optimization to avoid imminent VMExit on EOI:
"The OS performs an EOI by atomically writing zero to the EOI Assist field
of the virtual VP assist page and checking whether the "No EOI required"
field was previously zero. If it was, the OS must write to the
HV_X64_APIC_EOI MSR thereby triggering an intercept into the hypervisor."
Implement the optimization in Linux.
Tested-by: Long Li <[email protected]>
Signed-off-by: Vitaly Kuznetsov <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Haiyang Zhang <[email protected]>
Cc: K. Y. Srinivasan <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Michael Kelley (EOSG) <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Sasha Levin <[email protected]>
Cc: Simon Xiao <[email protected]>
Cc: Stephen Hemminger <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
-rw-r--r-- | arch/x86/hyperv/hv_apic.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c index 8eb6fbee8e13..5c056b8aebef 100644 --- a/arch/x86/hyperv/hv_apic.c +++ b/arch/x86/hyperv/hv_apic.c @@ -86,6 +86,11 @@ static void hv_apic_write(u32 reg, u32 val) static void hv_apic_eoi_write(u32 reg, u32 val) { + struct hv_vp_assist_page *hvp = hv_vp_assist_page[smp_processor_id()]; + + if (hvp && (xchg(&hvp->apic_assist, 0) & 0x1)) + return; + wrmsr(HV_X64_MSR_EOI, val, 0); } |