linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: X86: Don't reset mmu context when changing PGE or PCID
@ 2021-09-19  2:42 Lai Jiangshan
  2021-09-19  2:42 ` [PATCH 1/2] KVM: X86: Don't reset mmu context when X86_CR4_PCIDE 1->0 Lai Jiangshan
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Lai Jiangshan @ 2021-09-19  2:42 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, kvm, Lai Jiangshan

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-10-15 16:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-19  2:42 [PATCH 0/2] KVM: X86: Don't reset mmu context when changing PGE or PCID Lai Jiangshan
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

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).