]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Document the "rules" for using host_pfn_mapping_level()
authorSean Christopherson <seanjc@google.com>
Fri, 15 Jul 2022 23:21:05 +0000 (23:21 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 28 Jul 2022 17:22:23 +0000 (13:22 -0400)
commit7a62352d300fe265bb0a7737777db9e837039127
treedd5e5776e0af18ba40210e94f8cca7209cb951c5
parent12bd49e9604c0704da92074361824af9de128ed9
KVM: x86/mmu: Document the "rules" for using host_pfn_mapping_level()

Add a comment to document how host_pfn_mapping_level() can be used safely,
as the line between safe and dangerous is quite thin.  E.g. if KVM were
to ever support in-place promotion to create huge pages, consuming the
level is safe if the caller holds mmu_lock and checks that there's an
existing _leaf_ SPTE, but unsafe if the caller only checks that there's a
non-leaf SPTE.

Opportunistically tweak the existing comments to explicitly document why
KVM needs to use READ_ONCE().

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220715232107.3775620-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c