KVM: Fix stale gfn_to_pfn() reference in kvm_invalidate_memslot() comment
PATCH 1/1 KVM: Fix stale gfn_to_pfn() reference in kvm_invalidate_memslot() comment
Commit 06cdaff80e50 ("KVM: Drop gfn_to_pfn() APIs now that all users are gone") removed gfn_to_pfn(), but kvm_invalidate_memslot() still references gfn_to_pfn() when describing how sp->gfn is validated for guest memory accesses.
Update the comment to reference __kvm_faultin_pfn(), which is the actual path involved here.
No functional change intended.
--- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/kvm_main.c +1 -1
@@ -1818,7 +1818,7 @@ static void kvm_invalidate_memslot(struct kvm *kvm,/* * From this point no new shadow pages pointing to a deleted, or moved, * memslot will be created. Validation of sp->gfn happens in: -* - gfn_to_hva (kvm_read_guest, gfn_to_pfn) +* - gfn_to_hva (kvm_read_guest, __kvm_faultin_pfn) * - kvm_is_visible_gfn (mmu_check_root) */ kvm_arch_flush_shadow_memslot (kvm, old);
Signature · 1 line
2.43.0
Sean Christopherson
reviewerQuoted 21 lines · Jun Miao
Commit
06cdaff80e50("KVM: Dropgfn_to_pfn()APIs now that all users are gone") removedgfn_to_pfn(), butkvm_invalidate_memslot()still referencesgfn_to_pfn()when describing howsp->gfnis validated for guest memory accesses.Update the comment to reference
__kvm_faultin_pfn(), which is the actual path involved here.No functional change intended.
Fixes 06cdaff80e50 ("KVM: Drop gfn_to_pfn() APIs now that all users are gone")Signed-off-by Jun Miao <[email protected]>--- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)virt/kvm/kvm_main.c +0
-0
virt/kvm/kvm_main.c static void kvm_invalidate_memslot(struct kvm *kvm, · line 1821
Quoted 5 lines
virt/kvm/kvm_main.c +1
-1@@ -1818,7 +1818,7 @@ static void kvm_invalidate_memslot(struct kvm *kvm,/* * From this point no new shadow pages pointing to a deleted, or moved, * memslot will be created. Validation of sp->gfn happens in: -* - gfn_to_hva (kvm_read_guest, gfn_to_pfn) +* - gfn_to_hva (kvm_read_guest, __kvm_faultin_pfn)
This isn't really accurate either. On x86, INVALID memslots don't even reach __kvm_faultin_pfn(), because they're filtered out early on by kvm_mmu_faultin_pfn().
Rather than simply fix the stale function reference, I think we should rewrite the comment to describe the mechanics of memslots in excruiating detail. The existing comment is painfully x86-centric, and IMO is unlikely to help anyone actually understand how all of this works; or at least, is supposed to work :-)
Quoted 6 lines
virt/kvm/kvm_main.c +0
-0* - kvm_is_visible_gfn (mmu_check_root) */ kvm_arch_flush_shadow_memslot (kvm, old);Signature · 1 line
2.43.0