kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lai Jiangshan <jiangshanlai@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	kvm@vger.kernel.org, Lai Jiangshan <laijs@linux.alibaba.com>
Subject: [PATCH 0/2] KVM: X86: Don't reset mmu context when changing PGE or PCID
Date: Sun, 19 Sep 2021 10:42:44 +0800	[thread overview]
Message-ID: <20210919024246.89230-1-jiangshanlai@gmail.com> (raw)

From: Lai Jiangshan <laijs@linux.alibaba.com>

This patchset uses kvm_vcpu_flush_tlb_guest() instead of kvm_mmu_reset_context()
when X86_CR4_PGE is changed or X86_CR4_PCIDE is changed 1->0.

Neither X86_CR4_PGE nor X86_CR4_PCIDE participates in kvm_mmu_role, so
kvm_mmu_reset_context() is not required to be invoked.  Only flushing tlb
is required as SDM says.

The patchset has nothing to do with performance, because the overheads of
kvm_mmu_reset_context() and kvm_vcpu_flush_tlb_guest() are the same.  And
even in the [near] future, kvm_vcpu_flush_tlb_guest() will be optimized,
the code is not in the hot path.

This patchset makes the code more clear when to reset the mmu context.
And it makes KVM_MMU_CR4_ROLE_BITS consistent with kvm_mmu_role.

Lai Jiangshan (2):
  KVM: X86: Don't reset mmu context when X86_CR4_PCIDE 1->0
  KVM: X86: Don't reset mmu context when toggling X86_CR4_PGE

 arch/x86/kvm/mmu.h | 5 ++---
 arch/x86/kvm/x86.c | 7 +++++--
 2 files changed, 7 insertions(+), 5 deletions(-)

-- 
2.19.1.6.gb485710b


             reply	other threads:[~2021-09-19  2:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19  2:42 Lai Jiangshan [this message]
2021-09-19  2:42 ` [PATCH 1/2] KVM: X86: Don't reset mmu context when X86_CR4_PCIDE 1->0 Lai Jiangshan
2021-10-14 18:47   ` Sean Christopherson
2021-10-14 18:48     ` Sean Christopherson
2021-09-19  2:42 ` [PATCH 2/2] KVM: X86: Don't reset mmu context when toggling X86_CR4_PGE Lai Jiangshan
2021-10-14 18:50   ` Sean Christopherson
2021-10-14 16:03 ` [PATCH 0/2] KVM: X86: Don't reset mmu context when changing PGE or PCID Lai Jiangshan
2021-10-15 16:02   ` Paolo Bonzini

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=20210919024246.89230-1-jiangshanlai@gmail.com \
    --to=jiangshanlai@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=laijs@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=vkuznets@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;
as well as URLs for NNTP newsgroup(s).