The highlights are two fixes for bugs where "destroying" and "initializing" a gfn=>pfn cache while it is being accessed results in various forms of badness, e.g. re-initialization of an in-use lock, consuming a NULL pointer, potential memory corruption, etc... Everything else is cleanup to make the gpc APIs easier to use and harder to use incorrectly. The main difference with v2 is in playing it safer with 32-bit guests that place the runstate info close to the end of a page. This is a preexisting issue that is fixed here because it affects the gfn-to-pfn cache API. In particular, compared to v2 the length is passed at activation time instead of initialization time. This affects patch 7 ("KVM: Store gfn_to_pfn_cache length at activation time"), which now incorporates some parts of patch 13 ("KVM: Drop @gpa from exported gfn=>pfn cache check() and refresh() helpers") to introduce __kvm_gpc_refresh. Initially I wanted to restrict the ordering between setting Xen VM and vCPU attributes. In the end I left that patch out because it may complicate the reset sequence further. Paolo Michal Luczaj (8): KVM: Initialize gfn_to_pfn_cache locks in dedicated helper KVM: Shorten gfn_to_pfn_cache function names KVM: x86: Remove unused argument in gpc_unmap_khva() KVM: Store immutable gfn_to_pfn_cache properties KVM: Use gfn_to_pfn_cache's immutable "kvm" in kvm_gpc_check() KVM: Clean up hva_to_pfn_retry() KVM: Use gfn_to_pfn_cache's immutable "kvm" in kvm_gpc_refresh() KVM: selftests: Add tests in xen_shinfo_test to detect lock races Paolo Bonzini (2): KVM: x86: set gfn-to-pfn cache length consistently with VM word size KVM: Store gfn_to_pfn_cache length at activation time Sean Christopherson (6): KVM: Reject attempts to consume or refresh inactive gfn_to_pfn_cache KVM: Drop KVM's API to allow temprorarily unmapping gfn=>pfn cache KVM: Do not partially reinitialize gfn=>pfn cache during activation KVM: Drop @gpa from exported gfn=>pfn cache check() and refresh() helpers KVM: Skip unnecessary "unmap" if gpc is already valid during refresh KVM: selftests: Mark "guest_saw_irq" as volatile in xen_shinfo_test arch/x86/kvm/x86.c | 24 +-- arch/x86/kvm/xen.c | 121 ++++++++------ include/linux/kvm_host.h | 70 ++++---- include/linux/kvm_types.h | 2 + .../selftests/kvm/x86_64/xen_shinfo_test.c | 142 +++++++++++++++- virt/kvm/pfncache.c | 155 ++++++++++-------- 6 files changed, 345 insertions(+), 169 deletions(-) -- 2.31.1