lkml.org 
[lkml]   [2020]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v3 14/37] KVM: x86: Move "flush guest's TLB" logic to separate kvm_x86_ops hook
    From
    Date
    On 25/03/20 11:23, Vitaly Kuznetsov wrote:
    > What do you think about the following (very lightly
    > tested)?
    >
    > commit 485b4a579605597b9897b3d9ec118e0f7f1138ad
    > Author: Vitaly Kuznetsov <vkuznets@redhat.com>
    > Date: Wed Mar 25 11:14:25 2020 +0100
    >
    > KVM: x86: make Hyper-V PV TLB flush use tlb_flush_guest()
    >
    > Hyper-V PV TLB flush mechanism does TLB flush on behalf of the guest
    > so doing tlb_flush_all() is an overkill, switch to using tlb_flush_guest()
    > (just like KVM PV TLB flush mechanism) instead. Introduce
    > KVM_REQ_HV_TLB_FLUSH to support the change.
    >
    > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    >
    > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
    > index 167729624149..8c5659ed211b 100644
    > --- a/arch/x86/include/asm/kvm_host.h
    > +++ b/arch/x86/include/asm/kvm_host.h
    > @@ -84,6 +84,7 @@
    > #define KVM_REQ_APICV_UPDATE \
    > KVM_ARCH_REQ_FLAGS(25, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP)
    > #define KVM_REQ_TLB_FLUSH_CURRENT KVM_ARCH_REQ(26)
    > +#define KVM_REQ_HV_TLB_FLUSH KVM_ARCH_REQ(27)
    >
    > #define CR0_RESERVED_BITS \
    > (~(unsigned long)(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS \
    > diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
    > index a86fda7a1d03..0d051ed11f38 100644
    > --- a/arch/x86/kvm/hyperv.c
    > +++ b/arch/x86/kvm/hyperv.c
    > @@ -1425,8 +1425,7 @@ static u64 kvm_hv_flush_tlb(struct kvm_vcpu *current_vcpu, u64 ingpa,
    > * vcpu->arch.cr3 may not be up-to-date for running vCPUs so we can't
    > * analyze it here, flush TLB regardless of the specified address space.
    > */
    > - kvm_make_vcpus_request_mask(kvm,
    > - KVM_REQ_TLB_FLUSH | KVM_REQUEST_NO_WAKEUP,
    > + kvm_make_vcpus_request_mask(kvm, KVM_REQ_HV_TLB_FLUSH,
    > vcpu_mask, &hv_vcpu->tlb_flush);
    >

    Looks good, but why are you dropping KVM_REQUEST_NO_WAKEUP?

    Paolo

    \
     
     \ /
      Last update: 2020-03-25 16:41    [W:4.838 / U:0.048 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site