• Paolo Bonzini's avatar
    KVM: x86: clean up conditions for asynchronous page fault handling · 1dfdb45e
    Paolo Bonzini authored
    Even when asynchronous page fault is disabled, KVM does not want to pause
    the host if a guest triggers a page fault; instead it will put it into
    an artificial HLT state that allows running other host processes while
    allowing interrupt delivery into the guest.
    
    However, the way this feature is triggered is a bit confusing.
    First, it is not used for page faults while a nested guest is
    running: but this is not an issue since the artificial halt
    is completely invisible to the guest, either L1 or L2.  Second,
    it is used even if kvm_halt_in_guest() returns true; in this case,
    the guest probably should not pay the additional latency cost of the
    artificial halt, and thus we should handle the page fault in a
    completely synchronous way.
    
    By introducing a new function kvm_can_deliver_async_pf, this patch
    commonizes the code that chooses whether to deliver an async page fault
    (kvm_arch_async_page_not_present) and the code that chooses whether a
    page fault should be handled synchronously (kvm_can_do_async_pf).
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    1dfdb45e
x86.c 257 KB