Skip to contentSkip to conversation

KVM: x86/mmu: Consolidate comments about {Host,MMU}-writable

PATCH In review David Matlack 1 participant 1 message Jan 25, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 5/5 KVM: x86/mmu: Consolidate comments about {Host,MMU}-writable

Consolidate the large comment above DEFAULT_SPTE_HOST_WRITABLE with the large comment above is_writable_pte() into one comment. This comment explains the different reasons why an SPTE may be non-writable and KVM keeps track of that with the {Host,MMU}-writable bits.

No functional change intended.

---
 arch/x86/kvm/mmu/mmu.c  |  10 ++--
 arch/x86/kvm/mmu/spte.h | 105 +++++++++++++++++++++-------------------
 2 files changed, 60 insertions(+), 55 deletions(-)
arch/x86/kvm/mmu/mmu.c +4 -6
index 88f3aa5f2a36..f8a508b3c3e7 100644
@@ -549,11 +549,9 @@ static u64 mmu_spte_update_no_track(u64 *sptep, u64 new_spte)
 /* Rules for using mmu_spte_update:
  * Update the state bits, it means the mapped pfn is not changed.
  *
- * Whenever we overwrite a writable spte with a read-only one we
- * should flush remote TLBs. Otherwise rmap_write_protect
- * will find a read-only spte, even though the writable spte
- * might be cached on a CPU's TLB, the return value indicates this
- * case.
+ * Whenever an MMU-writable SPTE is overwritten with a read-only SPTE, remote
+ * TLBs must be flushed. Otherwise rmap_write_protect will find a read-only
+ * spte, even though the writable spte might be cached on a CPU's TLB.
  *
  * Returns true if the TLB needs to be flushed
  */
@@ -5847,7 +5845,7 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm,
 	 * will clear a separate software-only bit (MMU-writable) and skip the
 	 * flush if-and-only-if this bit was already clear.
 	 *
-	 * See DEFAULT_SPTE_MMU_WRITABLE for more details.
+	 * See is_writable_pte() for more details.
 	 */
 	if (flush)
 		kvm_arch_flush_remote_tlbs_memslot(kvm, memslot);
arch/x86/kvm/mmu/spte.h +56 -49

121 lines not on this page · raw message

Signature · 1 line
2.35.0.rc0.227.g00780c9af4-goog