[GIT PULL] x86/kvm: Clean up KVM's guest/host async #PF ABI, for 6.9
From: Sean Christopherson
Date: Fri Feb 23 2024 - 16:17:20 EST
An early(ish) pull request for 6.9 (not 6.8!) to clean up KVM's async #PF
guest/host ABI. Due to a goof many years ago, the structure shared between
the guest and host was expanded to 68 bytes, not the intended 64 bytes (to
fit in a cache line).
Rather than document the goof, just drop the problematic 4 bytes from the
ABI as KVM-the-host never actually used them.
The following changes since commit 41bccc98fb7931d63d03f326a746ac4d429c1dd3:
Linux 6.8-rc2 (2024-01-28 17:01:12 -0800)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-asyncpf_abi-6.9
for you to fetch changes up to df01f0a1165c35e95b5f52c7ba25c19020352ff9:
KVM: x86: Improve documentation of MSR_KVM_ASYNC_PF_EN (2024-02-06 10:59:52 -0800)
----------------------------------------------------------------
Guest-side KVM async #PF ABI cleanup for 6.9
Delete kvm_vcpu_pv_apf_data.enabled to fix a goof in KVM's async #PF ABI where
the enabled field pushes the size of "struct kvm_vcpu_pv_apf_data" from 64 to
68 bytes, i.e. beyond a single cache line.
The enabled field is purely a guest-side flag that Linux-as-a-guest uses to
track whether or not the guest has enabled async #PF support. The actual flag
that is passed to the host, i.e. to KVM proper, is a single bit in a synthetic
MSR, MSR_KVM_ASYNC_PF_EN, i.e. is in a location completely unrelated to the
shared kvm_vcpu_pv_apf_data structure.
Simply drop the the field and use a dedicated guest-side per-CPU variable to
fix the ABI, as opposed to fixing the documentation to match reality. KVM has
never consumed kvm_vcpu_pv_apf_data.enabled, so the odds of the ABI change
breaking anything are extremely low.
----------------------------------------------------------------
Xiaoyao Li (2):
x86/kvm: Use separate percpu variable to track the enabling of asyncpf
KVM: x86: Improve documentation of MSR_KVM_ASYNC_PF_EN
Documentation/virt/kvm/x86/msr.rst | 19 +++++++++----------
arch/x86/include/uapi/asm/kvm_para.h | 1 -
arch/x86/kernel/kvm.c | 11 ++++++-----
3 files changed, 15 insertions(+), 16 deletions(-)