Skip to content

Commit 24cd19a

Browse files
Lai Jiangshanbonzini
Lai Jiangshan
authored andcommitted
KVM: X86: Update mmu->pdptrs only when it is changed
It is unchanged in most cases. Signed-off-by: Lai Jiangshan <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 2e9ebd5 commit 24cd19a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

arch/x86/kvm/x86.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -828,9 +828,12 @@ int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
828828
}
829829
}
830830

831-
memcpy(mmu->pdptrs, pdpte, sizeof(mmu->pdptrs));
832-
kvm_register_mark_dirty(vcpu, VCPU_EXREG_PDPTR);
833-
kvm_make_request(KVM_REQ_LOAD_MMU_PGD, vcpu);
831+
kvm_register_mark_available(vcpu, VCPU_EXREG_PDPTR);
832+
if (memcmp(mmu->pdptrs, pdpte, sizeof(mmu->pdptrs))) {
833+
memcpy(mmu->pdptrs, pdpte, sizeof(mmu->pdptrs));
834+
kvm_register_mark_dirty(vcpu, VCPU_EXREG_PDPTR);
835+
kvm_make_request(KVM_REQ_LOAD_MMU_PGD, vcpu);
836+
}
834837
vcpu->arch.pdptrs_from_userspace = false;
835838

836839
return 1;

0 commit comments

Comments
 (0)