x86/hyper-v: implement EOI assist
Subsystems (3)
PATCH 1/1 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.
--- arch/x86/hyperv/hv_apic.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/hyperv/hv_apic.c +5 -0
@@ -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 ); }
Signature · 1 line
2.20.1
Quoted 8 lines · Vitaly Kuznetsov
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 theHV_X64_APIC_EOIMSR thereby triggering an intercept into the hypervisor."Implement the optimization in Linux.
Simon, Long,
did you get a chance to run some tests with this?
Signature · 1 line
Vitaly
Long Li
Tested-byQuoted 10 lines
Quoted 10 lines
Quoted 10 lines
Subject: Re: [PATCH] x86/hyper-v: implement EOI assist
Quoted 3 lines · Vitaly Kuznetsov
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 EOIrequired"
Quoted 2 lines
field was previously zero. If it was, the OS must write to the
HV_X64_APIC_EOIMSR thereby triggering an intercept into the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
hypervisor."
Quoted 3 lines
Implement the optimization in Linux.
Simon, Long,
did you get a chance to run some tests with this?
I have ran some tests on Azure L80s_v2.
With 10 NVMe disks on raid0 and formatted to EXT4, I'm getting 2.6m max IOPS with the patch, compared to 2.55m IOPS before.
The VM has been running stable. Thank you!
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
--
Vitaly
tip-bot for Vitaly Kuznetsov
merge bot[tip:x86/platform] x86/hyper-v: Implement EOI assist
In reply to Vitaly Kuznetsovx86/hyper-v: Implement EOI assist
Commit-ID: ba696429d290690db967e5f49463df4b2c1314a4 Gitweb: https://git.kernel.org/tip/ba696429d290690db967e5f49463df4b2c1314a4 Author: Vitaly Kuznetsov <[email protected]> AuthorDate: Wed, 3 Apr 2019 19:03:09 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 16 Apr 2019 12:28:23 +0200
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.
--- arch/x86/hyperv/hv_apic.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/hyperv/hv_apic.c +5 -0
@@ -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 ); }