KVM: Ensure WAIT requests actually wait
Status from this message: Applied to kvm-x86 fixes, thanks!
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | KVM: s390: Drop unused and unreachable kvm_arch_vcpu_should_kick()arch/ | +0 | 3 replies | |
| 2/7 | KVM: Add a @force param to __kvm_vcpu_kick() for PPC backwards compatibilityinclude/ virt/ | +10 | 0 replies | |
| 3/7 | KVM: PPC: Explicitly force IPIs when directly kicking vCPUsarch/ arch/ arch/ +3 more | +20 | 3 replies | |
| 4/7 | KVM: MIPS: Rework kvm_arch_vcpu_should_kick() to use standard implementationarch/ | +1 | 0 replies | |
| 5/7 | KVM: Move kvm_arch_vcpu_should_kick() to common code as kvm_vcpu_should_kick()arch/ arch/ arch/ +5 more | +8 | 0 replies | |
| 6/7 | KVM: Plumb the full request into __kvm_vcpu_kick()arch/ include/ virt/ | +13 | 0 replies | |
| 7/7 | KVM: Drop kvm_vcpu_should_kick() and use kvm_request_needs_ipi()virt/ | +2 | 0 replies |
Reviews trailers per patch
1 of 7 patches has a Reviewed-by or Acked-by.
| Patch | Gautam Menghani |
|---|---|
| 1/7 | |
| 2/7 | |
| 3/7 | R-b |
| 4/7 | |
| 5/7 | |
| 6/7 | |
| 7/7 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/7] KVM: Ensure WAIT requests actually wait
Fix a bug in where kvm_make_request_and_kick() won't actually wait if the kick races without another non-waiting kick. The issue is that all of the conditional kvm_arch_vcpu_should_kick() implementations are missing this code:
if (req & KVM_REQUEST_WAIT) return mode != OUTSIDE_GUEST_MODE;
Thankfully, kvm_request_needs_ipi() does the right thing, so this doesn't affect kvm_make_all_cpus_request() or kvm_make_vcpus_request_mask(), i.e. it's limited to x86 SNP's used of kvm_make_request_and_kick().
To fix, address this TODO:
/* TODO: merge with kvm_arch_vcpu_should_kick */
and purge kvm_arch_vcpu_should_kick(). As usual, PPC makes that difficult because it has wonky code that is poorly documented. For reasons unknown, kvm_vcpu_kick() unconditionally returns true on (most flavors of) PPC. To preserve that behavior, add a compatibility wrapper in PPC, along with a @force param to __kvm_vcpu_kick().
This series would ideally go into 7.4, even though it's obviously not small, as guest_memfd in-place conversion massively widens the window where a missed kick+wait can lead to the host trying to reclaim an in-use VMSA page, which is generally fatal to the host.
Sean Christopherson (7):
KVM: s390: Drop unused and unreachable kvm_arch_vcpu_should_kick()
KVM: Add a @force param to __kvm_vcpu_kick() for PPC backwards
compatibility
KVM: PPC: Explicitly force IPIs when directly kicking vCPUs
KVM: MIPS: Rework kvm_arch_vcpu_should_kick() to use standard
implementation
KVM: Move kvm_arch_vcpu_should_kick() to common code as
kvm_vcpu_should_kick()
KVM: Plumb the full request into __kvm_vcpu_kick()
KVM: Drop kvm_vcpu_should_kick() and use kvm_request_needs_ipi()
arch/arm64/kvm/arm.c | 5 ----- arch/loongarch/kvm/vcpu.c | 5 ----- arch/mips/kvm/mips.c | 5 ----- arch/powerpc/include/asm/kvm_ppc.h | 13 ++++++++++++- arch/powerpc/kvm/book3s.c | 4 ++-- arch/powerpc/kvm/book3s_pr.c | 2 +- arch/powerpc/kvm/booke.c | 6 +++--- arch/powerpc/kvm/e500_emulate.c | 2 +- arch/powerpc/kvm/powerpc.c | 7 +------ arch/riscv/kvm/vcpu.c | 5 ----- arch/s390/kvm/s390/s390.c | 7 ------- arch/x86/kvm/x86.c | 5 ----- include/linux/kvm_host.h | 7 +++---- virt/kvm/kvm_main.c | 28 ++++++++++++++++------------ 14 files changed, 39 insertions(+), 62 deletions(-)
base-commit: 7e60162b16f9da0d2fa83da5c1723b6853a0ac1d
Signature · 1 line
2.56.0.313.g2479322e68-goog