From: Sean Christopherson <seanjc@google.com>
To: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: linux-kernel@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Lai Jiangshan <jiangshan.ljs@antgroup.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH V2 6/8] kvm: x86/mmu: Remove FNAME(invlpg)
Date: Fri, 10 Feb 2023 01:10:57 +0000 [thread overview]
Message-ID: <Y+WZoXYvacqx/+Yu@google.com> (raw)
In-Reply-To: <20230207155735.2845-7-jiangshanlai@gmail.com>
On Tue, Feb 07, 2023, Lai Jiangshan wrote:
> Use FNAME(sync_spte) to share the code which has a slight semantics
> changed: clean vTLB entry is kept.
...
> +static void __kvm_mmu_invalidate_gva(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
> + gva_t gva, hpa_t root_hpa)
> +{
> + struct kvm_shadow_walk_iterator iterator;
> +
> + vcpu_clear_mmio_info(vcpu, gva);
> +
> + write_lock(&vcpu->kvm->mmu_lock);
> + for_each_shadow_entry_using_root(vcpu, root_hpa, gva, iterator) {
> + struct kvm_mmu_page *sp = sptep_to_sp(iterator.sptep);
> +
> + if (sp->unsync && *iterator.sptep) {
Please make the !0 change in a separate patch. It took me a while to connect the
dots, and to also understand what I suspect is a major motivation: sync_spte()
already has this check, i.e. the change is happening regardless, so might as well
avoid the indirect branch.
> + gfn_t gfn = kvm_mmu_page_get_gfn(sp, iterator.index);
> + int ret = mmu->sync_spte(vcpu, sp, iterator.index);
> +
> + if (ret < 0)
> + mmu_page_zap_pte(vcpu->kvm, sp, iterator.sptep, NULL);
> + if (ret)
> + kvm_flush_remote_tlbs_with_address(vcpu->kvm, gfn, 1);
Why open code kvm_flush_remote_tlbs_sptep()? Does it actually shave enough
cycles to be visible?
If open coding is really justified, can you rebase on one of the two branches?
And then change this to kvm_flush_remote_tlbs_gfn().
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/mmu
next prev parent reply other threads:[~2023-02-10 1:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 15:57 [PATCH V2 0/8] kvm: x86/mmu: Share the same code to invalidate each vTLB entry Lai Jiangshan
2023-02-07 15:57 ` [PATCH V2 1/8] kvm: x86/mmu: Use KVM_MMU_ROOT_XXX for kvm_mmu_invalidate_gva() Lai Jiangshan
2023-02-10 0:50 ` Sean Christopherson
2023-02-07 15:57 ` [PATCH V2 2/8] kvm: x86/mmu: Use kvm_mmu_invalidate_gva() in kvm_mmu_invpcid_gva() Lai Jiangshan
2023-02-07 15:57 ` [PATCH V2 3/8] kvm: x86/mmu: Use kvm_mmu_invalidate_gva() in nested_ept_invalidate_addr() Lai Jiangshan
2023-02-10 0:52 ` Sean Christopherson
2023-02-07 15:57 ` [PATCH V2 4/8] kvm: x86/mmu: Set mmu->sync_page as NULL for direct paging Lai Jiangshan
2023-02-07 16:17 ` Paolo Bonzini
2023-02-10 0:57 ` Sean Christopherson
2023-02-07 15:57 ` [PATCH V2 5/8] kvm: x86/mmu: Move the code out of FNAME(sync_page)'s loop body into mmu.c Lai Jiangshan
2023-02-07 15:57 ` [PATCH V2 6/8] kvm: x86/mmu: Remove FNAME(invlpg) Lai Jiangshan
2023-02-10 1:10 ` Sean Christopherson [this message]
2023-02-16 4:16 ` Lai Jiangshan
2023-02-07 15:57 ` [PATCH V2 7/8] kvm: x86/mmu: Reduce the update to the spte in FNAME(sync_page) Lai Jiangshan
2023-02-07 15:57 ` [PATCH V2 8/8] kvm: x86/mmu: Remove @no_dirty_log from FNAME(prefetch_gpte) Lai Jiangshan
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=Y+WZoXYvacqx/+Yu@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jiangshan.ljs@antgroup.com \
--cc=jiangshanlai@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.