KVM: x86/mmu: Don't save mmu_invalidate_seq after checking private attr
PATCH 1/1 KVM: x86/mmu: Don't save mmu_invalidate_seq after checking private attr
Drop the second snapshot of mmu_invalidate_seq in kvm_faultin_pfn(). Before checking the mismatch of private vs. shared, mmu_invalidate_seq is saved to fault->mmu_seq, which can be used to detect an invalidation related to the gfn occurred, i.e. KVM will not install a mapping in page table if fault->mmu_seq != mmu_invalidate_seq.
Currently there is a second snapshot of mmu_invalidate_seq, which may not be same as the first snapshot in kvm_faultin_pfn(), i.e. the gfn attribute may be changed between the two snapshots, but the gfn may be mapped in page table without hindrance. Therefore, drop the second snapshot as it has no obvious benefits.
--- arch/x86/kvm/mmu/mmu.c | 3 --- 1 file changed, 3 deletions(-)
arch/x86/kvm/mmu/mmu.c +0 -3
@@ -4400,9 +4400,6 @@ static int kvm_faultin_pfn(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault,return RET_PF_EMULATE ; } - fault->mmu_seq = vcpu->kvm->mmu_invalidate_seq; -smp_rmb (); -/* * Check for a relevant mmu_notifier invalidation event before getting * the pfn from the primary MMU, and before acquiring mmu_lock.
base-commit: 2bfcfd584ff5ccc8bb7acde19b42570414bf880b
Signature · 1 line
2.34.1
Quoted 6 lines · Tao Su
Drop the second snapshot of
mmu_invalidate_seqinkvm_faultin_pfn(). Before checking the mismatch of private vs. shared,mmu_invalidate_seqis saved tofault->mmu_seq, which can be used to detect an invalidation related to the gfn occurred, i.e. KVM will not install a mapping in page table iffault->mmu_seq!=mmu_invalidate_seq.
Quoted 8 lines
Currently there is a second snapshot of
mmu_invalidate_seq, which may not be same as the first snapshot inkvm_faultin_pfn(), i.e. the gfn attribute may be changed between the two snapshots, but the gfn may be mapped in page table without hindrance. Therefore, drop the second snapshot as it has no obvious benefits.Fixes f6adeae81f35 ("KVM: x86/mmu: Handle no-slot faults at the beginning of kvm_faultin_pfn()")Signed-off-by Tao Su <[email protected]>
Quoted 6 lines · Tao Su
Drop the second snapshot of
mmu_invalidate_seqinkvm_faultin_pfn(). Before checking the mismatch of private vs. shared,mmu_invalidate_seqis saved tofault->mmu_seq, which can be used to detect an invalidation related to the gfn occurred, i.e. KVM will not install a mapping in page table iffault->mmu_seq!=mmu_invalidate_seq.
Quoted 7 lines
Currently there is a second snapshot of
mmu_invalidate_seq, which may not be same as the first snapshot inkvm_faultin_pfn(), i.e. the gfn attribute may be changed between the two snapshots, but the gfn may be mapped in page table without hindrance. Therefore, drop the second snapshot as it has no obvious benefits.[...]
Applied to kvm-x86 fixes, thanks!
[1/1] KVM: x86/mmu: Don't save mmu_invalidate_seq after checking private attr
https://github.com/kvm-x86/linux/commit/f66e50ed09b3
Paolo Bonzini
maintainerQuoted 13 lines · Sean Christopherson
Quoted 12 lines · Tao Su
Drop the second snapshot of
mmu_invalidate_seqinkvm_faultin_pfn(). Before checking the mismatch of private vs. shared,mmu_invalidate_seqis saved tofault->mmu_seq, which can be used to detect an invalidation related to the gfn occurred, i.e. KVM will not install a mapping in page table iffault->mmu_seq!=mmu_invalidate_seq.Currently there is a second snapshot of
mmu_invalidate_seq, which may not be same as the first snapshot inkvm_faultin_pfn(), i.e. the gfn attribute may be changed between the two snapshots, but the gfn may be mapped in page table without hindrance. Therefore, drop the second snapshot as it has no obvious benefits.
Quoted 6 lines
Quoted 1 line
[...]
Applied to kvm-x86 fixes, thanks!
[1/1] KVM: x86/mmu: Don't save
mmu_invalidate_seqafter checking private attrhttps://github.com/kvm-x86/linux/commit/f66e50ed09b3
Since I'm already sending a much larger pull request for -rc3, I guess you don't mind if I also queue this one. :)
Paolo
Sean Christopherson
maintainerQuoted 16 lines · Paolo Bonzini
Quoted 15 lines · Sean Christopherson
Quoted 13 lines · Tao Su
Drop the second snapshot of
mmu_invalidate_seqinkvm_faultin_pfn(). Before checking the mismatch of private vs. shared,mmu_invalidate_seqis saved tofault->mmu_seq, which can be used to detect an invalidation related to the gfn occurred, i.e. KVM will not install a mapping in page table iffault->mmu_seq!=mmu_invalidate_seq.Currently there is a second snapshot of
mmu_invalidate_seq, which may not be same as the first snapshot inkvm_faultin_pfn(), i.e. the gfn attribute may be changed between the two snapshots, but the gfn may be mapped in page table without hindrance. Therefore, drop the second snapshot as it has no obvious benefits.[...]
Quoted 7 lines
Quoted 4 lines
Applied to kvm-x86 fixes, thanks!
[1/1] KVM: x86/mmu: Don't save
mmu_invalidate_seqafter checking private attrhttps://github.com/kvm-x86/linux/commit/f66e50ed09b3Since I'm already sending a much larger pull request for -rc3, I guess you don't mind if I also queue this one. :)
Not at all, dropped from kvm-x86.