KVM: x86: acknowledgment mechanism for async pf page ready notifications
authorVitaly Kuznetsov <vkuznets@redhat.com>
Mon, 25 May 2020 14:41:21 +0000 (16:41 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 1 Jun 2020 08:26:08 +0000 (04:26 -0400)
commit557a961abbe06ed9dfd3b55ef7bd6e68295cda3d
tree257d2ac75925f214eb581e5cf25baa2e0114575c
parent2635b5c4a0e407b84f68e188c719f28ba0e9ae1b
KVM: x86: acknowledgment mechanism for async pf page ready notifications

If two page ready notifications happen back to back the second one is not
delivered and the only mechanism we currently have is
kvm_check_async_pf_completion() check in vcpu_run() loop. The check will
only be performed with the next vmexit when it happens and in some cases
it may take a while. With interrupt based page ready notification delivery
the situation is even worse: unlike exceptions, interrupts are not handled
immediately so we must check if the slot is empty. This is slow and
unnecessary. Introduce dedicated MSR_KVM_ASYNC_PF_ACK MSR to communicate
the fact that the slot is free and host should check its notification
queue. Mandate using it for interrupt based 'page ready' APF event
delivery.

As kvm_check_async_pf_completion() is going away from vcpu_run() we need
a way to communicate the fact that vcpu->async_pf.done queue has
transitioned from empty to non-empty state. Introduce
kvm_arch_async_page_present_queued() and KVM_REQ_APF_READY to do the job.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20200525144125.143875-7-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Documentation/virt/kvm/msr.rst
arch/s390/include/asm/kvm_host.h
arch/x86/include/asm/kvm_host.h
arch/x86/include/uapi/asm/kvm_para.h
arch/x86/kvm/x86.c
virt/kvm/async_pf.c