From: Sean Christopherson <seanjc@google.com>
To: Liang Chen <liangchen.linux@gmail.com>
Cc: pbonzini@redhat.com, kvm@vger.kernel.org,
David Matlack <dmatlack@google.com>
Subject: Re: [PATCH] KVM: x86: count number of zapped pages for tdp_mmu
Date: Wed, 3 Jan 2024 07:25:55 -0800 [thread overview]
Message-ID: <ZZV8gz7wSCZCX0GZ@google.com> (raw)
In-Reply-To: <20240103123959.46994-1-liangchen.linux@gmail.com>
+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@gmail.com>
> ---
> 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
>
next prev parent reply other threads:[~2024-01-03 15:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-03 12:39 [PATCH] KVM: x86: count number of zapped pages for tdp_mmu Liang Chen
2024-01-03 15:25 ` Sean Christopherson [this message]
2024-01-04 4:14 ` Liang Chen
2024-01-04 18:29 ` David Matlack
2024-01-05 1:47 ` Liang Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZZV8gz7wSCZCX0GZ@google.com \
--to=seanjc@google.com \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=liangchen.linux@gmail.com \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox