Skip to content

KVM: Async #PF fixes and cleanups

Sean Christopherson kvm lkml 1 version Applied

Status from this message: Applied to kvm-x86 asyncpf, with comment tweaks as per Vitaly. Thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 20 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/4KVM: Always flush async #PF workqueue when vCPU is being destroyedvirt/kvm/async_pf.c+32 -510 replies
2/4KVM: Put mm immediately after async #PF worker completes remote gup()virt/kvm/async_pf.c+1 -22 replies
3/4KVM: Get reference to VM's address space in the async #PF workerinclude/linux/kvm_host.h virt/kvm/async_pf.c+18 -155 replies
4/4KVM: Nullify async #PF worker's "apf" pointer as soon as it might be freedvirt/kvm/async_pf.c+6 -52 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchXu YilunVitaly Kuznetsov
1/4R-b
2/4R-b R-b
3/4R-b R-b
4/4R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] KVM: Async #PF fixes and cleanups

Fix a use-after-module-unload bug in the async #PF code by ensuring all workqueue items fully complete before tearing down vCPUs. Do a bit of cleanup to try and make the code slightly more readable.

Side topic, I'm pretty s390's flic_set_attr() is broken/racy. The async #PF code assumes that only the vCPU can invoke kvm_clear_async_pf_completion_queue(), as there are multiple assets that are effectively protected by vcpu->mutex. I don't any real world VMMs trigger the race(s), but AFAICT it's a bug. I think/assume taking all vCPUs' mutexes would plug the hole?

Sean Christopherson (4):
KVM: Always flush async #PF workqueue when vCPU is being destroyed
KVM: Put mm immediately after async #PF worker completes remote gup()
KVM: Get reference to VM's address space in the async #PF worker
KVM: Nullify async #PF worker's "apf" pointer as soon as it might be
freed

 include/linux/kvm_host.h |  1 -
 virt/kvm/async_pf.c      | 79 ++++++++++++++++++++++++++++------------
 2 files changed, 55 insertions(+), 25 deletions(-)

base-commit: 1c6d984f523f67ecfad1083bb04c55d91977bb15

Signature · 1 line
2.43.0.472.g3155946c3a-goog