Skip to content

Commit 1dc9cc1

Browse files
committed
KVM: x86/mmu: Reword a misleading comment about checking gpte_changed()
Rewrite the comment in FNAME(fetch) to explain why KVM needs to check that the gPTE is still fresh before continuing the shadow page walk, even if KVM already has a linked shadow page for the gPTE in question. No functional change intended. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 7d67b03 commit 1dc9cc1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

arch/x86/kvm/mmu/paging_tmpl.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,14 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault,
695695
return RET_PF_RETRY;
696696

697697
/*
698-
* Verify that the gpte in the page we've just write
699-
* protected is still there.
698+
* Verify that the gpte in the page, which is now either
699+
* write-protected or unsync, wasn't modified between the fault
700+
* and acquiring mmu_lock. This needs to be done even when
701+
* reusing an existing shadow page to ensure the information
702+
* gathered by the walker matches the information stored in the
703+
* shadow page (which could have been modified by a different
704+
* vCPU even if the page was already linked). Holding mmu_lock
705+
* prevents the shadow page from changing after this point.
700706
*/
701707
if (FNAME(gpte_changed)(vcpu, gw, it.level - 1))
702708
return RET_PF_RETRY;

0 commit comments

Comments
 (0)