kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Gardon <bgardon@google.com>
To: Hou Wenlong <houwenlong93@linux.alibaba.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: x86/mmu: Pass parameter flush as false in kvm_tdp_mmu_zap_collapsible_sptes()
Date: Wed, 17 Nov 2021 09:50:46 -0800	[thread overview]
Message-ID: <CANgfPd_=M-8r8H5uoaPz_VTXZpmX6XD+QGAdBdz4PERUoqE1OA@mail.gmail.com> (raw)
In-Reply-To: <21453a1d2533afb6e59fb6c729af89e771ff2e76.1637140154.git.houwenlong93@linux.alibaba.com>

On Wed, Nov 17, 2021 at 1:20 AM Hou Wenlong
<houwenlong93@linux.alibaba.com> wrote:
>
> Since tlb flush has been done for legacy MMU before
> kvm_tdp_mmu_zap_collapsible_sptes(), so the parameter flush
> should be false for kvm_tdp_mmu_zap_collapsible_sptes().
>
> Fixes: e2209710ccc5d ("KVM: x86/mmu: Skip rmap operations if rmaps not allocated")
> Signed-off-by: Hou Wenlong <houwenlong93@linux.alibaba.com>

Haha, I'm glad we're thinking along similar lines. I just sent a patch
yesterday to remove the flush parameter from that function entirely:
https://lore.kernel.org/lkml/20211115234603.2908381-2-bgardon@google.com/
I'll CC you on that patch.

> ---
>  arch/x86/kvm/mmu/mmu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index d57319e596a9..4b2be04e9862 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -5853,7 +5853,7 @@ static bool kvm_mmu_zap_collapsible_spte(struct kvm *kvm,
>  void kvm_mmu_zap_collapsible_sptes(struct kvm *kvm,
>                                    const struct kvm_memory_slot *slot)
>  {
> -       bool flush = false;
> +       bool flush;
>
>         if (kvm_memslots_have_rmaps(kvm)) {
>                 write_lock(&kvm->mmu_lock);
> @@ -5870,7 +5870,7 @@ void kvm_mmu_zap_collapsible_sptes(struct kvm *kvm,
>
>         if (is_tdp_mmu_enabled(kvm)) {
>                 read_lock(&kvm->mmu_lock);
> -               flush = kvm_tdp_mmu_zap_collapsible_sptes(kvm, slot, flush);
> +               flush = kvm_tdp_mmu_zap_collapsible_sptes(kvm, slot, false);
>                 if (flush)
>                         kvm_arch_flush_remote_tlbs_memslot(kvm, slot);
>                 read_unlock(&kvm->mmu_lock);
> --
> 2.31.1
>

  reply	other threads:[~2021-11-17 17:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17  9:20 [PATCH 1/2] KVM: x86/mmu: Skip tlb flush if it has been done in zap_gfn_range() Hou Wenlong
2021-11-17  9:20 ` [PATCH 2/2] KVM: x86/mmu: Pass parameter flush as false in kvm_tdp_mmu_zap_collapsible_sptes() Hou Wenlong
2021-11-17 17:50   ` Ben Gardon [this message]
2021-11-17 18:32     ` Paolo Bonzini
2021-11-17 15:56 ` [PATCH 1/2] KVM: x86/mmu: Skip tlb flush if it has been done in zap_gfn_range() Sean Christopherson
2021-11-17 16:45 ` Paolo Bonzini
2021-11-17 17:03   ` Sean Christopherson
2021-11-17 18:04     ` Sean Christopherson

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='CANgfPd_=M-8r8H5uoaPz_VTXZpmX6XD+QGAdBdz4PERUoqE1OA@mail.gmail.com' \
    --to=bgardon@google.com \
    --cc=bp@alien8.de \
    --cc=houwenlong93@linux.alibaba.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).