mbox series

[0/5] i386/hvf: x2apic support and some small fixes

Message ID 20241105155800.5461-1-phil@philjordan.eu (mailing list archive)
Headers show
Series i386/hvf: x2apic support and some small fixes | expand

Message

Phil Dennis-Jordan Nov. 5, 2024, 3:57 p.m. UTC
This is a loose collection of patches against the x86 hvf accel. They
can be applied/pulled independently from one another.

Patch 1 is a repost of a patch I've submitted a bunch of times already.
It wires up and enables x2APIC mode in conjunction with HVF - the
software APIC implementation in QEMU gained the feature earlier this
year but hvf wasn't included.
The change typically improves performance with modern SMP guest OSes by
a 2-digit percentage. (Exact values depend on workload.)

Patch 2 fixes cases of undefined behaviour recently introduced by commit
7cac7aa which made changes to HVF CPUID XSAVE functionality.

Patch 3 fixes a minor one-off memory leak during hvf startup.

Patch 4 ever so slightly improves APIC correctness under hvf: when
setting the APICBASE MSR, if the APIC deems the new value invalid,
we raise an exception (as per spec) rather than silently doing
nothing. This fixes a failing kvm-unit-tests test case.

Patch 5 removes some unnecessary duplication and type-rechecking in
HVF's inner loop. (No need to cast the cpu state pointer to X86CPU
within, the hvf_vcp_exec function already does that once at the top.)

Some of this work has been sponsored by Sauce Labs Inc.

Phil Dennis-Jordan (5):
  i386/hvf: Integrates x2APIC support with hvf accel
  i386/hvf: Fix for UB in handling CPUID function 0xD
  i386/hvf: Fixes startup memory leak (vmcs caps)
  i386/hvf: Raise exception on error setting APICBASE
  i386/hvf: Removes duplicate/shadowed variables in hvf_vcpu_exec

 target/i386/hvf/hvf.c       |  7 +++----
 target/i386/hvf/x86_cpuid.c |  6 +++---
 target/i386/hvf/x86_emu.c   | 42 +++++++++++++++++++++++++++++++++++--
 3 files changed, 46 insertions(+), 9 deletions(-)