Re: [PATCH] KVM: x86: count number of zapped pages for tdp_mmu

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

 



+David

On Wed, Jan 03, 2024, Liang Chen wrote:
> Count the number of zapped pages of tdp_mmu for vm stat.

Why?  I don't necessarily disagree with the change, but it's also not obvious
that this information is all that useful for the TDP MMU, e.g. the pf_fixed/taken
stats largely capture the same information.

> Signed-off-by: Liang Chen <liangchen.linux@xxxxxxxxx>
> ---
>  arch/x86/kvm/mmu/tdp_mmu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
> index 6cd4dd631a2f..7f8bc1329aac 100644
> --- a/arch/x86/kvm/mmu/tdp_mmu.c
> +++ b/arch/x86/kvm/mmu/tdp_mmu.c
> @@ -325,6 +325,7 @@ static void handle_removed_pt(struct kvm *kvm, tdp_ptep_t pt, bool shared)
>  	int i;
>  
>  	trace_kvm_mmu_prepare_zap_page(sp);
> +	++kvm->stat.mmu_shadow_zapped;

This isn't thread safe.  The TDP MMU can zap PTEs with mmu_lock held for read,
i.e. this needs to be an atomic access.  And tdp_mmu_unlink_sp() or even
tdp_unaccount_mmu_page() seems like a better fit for the stats update.

>  	tdp_mmu_unlink_sp(kvm, sp, shared);
>  
> -- 
> 2.40.1
> 




[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