Re: [PATCH v11 09/46] KVM: x86: hyper-v: Introduce TLB flush fifo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 04, 2022, Vitaly Kuznetsov wrote:
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 0539d216f760..7fb8bd42b13e 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3388,7 +3388,7 @@ static void kvm_vcpu_flush_tlb_all(struct kvm_vcpu *vcpu)
>  	kvm_clear_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu);
>  }
>  
> -static void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu)
> +void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu)

kvm_vcpu_flush_tlb_guest() doesn't need to be exposed in this patch, i.e. can
remain static.  I think it can be restricted to x86.c even in the final form
(will follow-up in later patch).

>  {
>  	++vcpu->stat.tlb_flush;
>  
> @@ -3409,7 +3409,7 @@ static void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu)
>  	 * Flushing all "guest" TLB is always a superset of Hyper-V's fine
>  	 * grained flushing.
>  	 */
> -	kvm_clear_request(KVM_REQ_HV_TLB_FLUSH, vcpu);
> +	kvm_hv_vcpu_purge_flush_tlb(vcpu);
>  }
>  
>  
> @@ -10484,7 +10484,14 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
>  
>  		kvm_service_local_tlb_flush_requests(vcpu);
>  
> -		if (kvm_check_request(KVM_REQ_HV_TLB_FLUSH, vcpu))
> +		/*
> +		 * Fall back to a "full" guest flush if Hyper-V's precise
> +		 * flushing fails.  Note, Hyper-V's flushing is per-vCPU, but
> +		 * the flushes are considered "remote" and not "local" because
> +		 * the requests can be initiated from other vCPUs.
> +		 */
> +		if (kvm_check_request(KVM_REQ_HV_TLB_FLUSH, vcpu) &&
> +		    kvm_hv_vcpu_flush_tlb(vcpu))
>  			kvm_vcpu_flush_tlb_guest(vcpu);
>  
>  		if (kvm_check_request(KVM_REQ_REPORT_TPR_ACCESS, vcpu)) {
> diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
> index a784ff90740b..1ea28a7bdf2f 100644
> --- a/arch/x86/kvm/x86.h
> +++ b/arch/x86/kvm/x86.h
> @@ -79,6 +79,7 @@ static inline unsigned int __shrink_ple_window(unsigned int val,
>  
>  #define MSR_IA32_CR_PAT_DEFAULT  0x0007040600070406ULL
>  
> +void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu);

As above, this is unnecessary.

>  void kvm_service_local_tlb_flush_requests(struct kvm_vcpu *vcpu);
>  int kvm_check_nested_events(struct kvm_vcpu *vcpu);
>  
> -- 
> 2.37.3
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux