Skip to content

KVM: X86: Don't reset mmu context when changing PGE or PCID

Lai Jiangshan kvm lkml 1 version Applied

Status from this message: Queued with kvm_make_request(KVM_REQ_TLB_FLUSH_GUEST, vcpu) replacement, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2KVM: X86: Don't reset mmu context when X86_CR4_PCIDE 1->0arch/x86/kvm/x86.c+4 -22 replies
2/2KVM: X86: Don't reset mmu context when toggling X86_CR4_PGEarch/x86/kvm/mmu.h arch/x86/kvm/x86.c+4 -41 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchSean Christopherson
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] KVM: X86: Don't reset mmu context when changing PGE or PCID

From: Lai Jiangshan <[email protected]>

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(-)
Signature · 1 line
2.19.1.6.gb485710b