Skip to content

Commit b1a8d2b

Browse files
dmatlacksean-jc
authored andcommitted
KVM: x86/mmu: Fix and clarify comments about clearing D-bit vs. write-protecting
Drop the "If AD bits are enabled/disabled" verbiage from the comments above kvm_tdp_mmu_clear_dirty_{slot,pt_masked}() since TDP MMU SPTEs may need to be write-protected even when A/D bits are enabled. i.e. These comments aren't technically correct. No functional change intended. Signed-off-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20240315230541.1635322-4-dmatlack@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent feac19a commit b1a8d2b

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

arch/x86/kvm/mmu/tdp_mmu.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,11 +1594,9 @@ static bool clear_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root,
15941594
}
15951595

15961596
/*
1597-
* Clear the dirty status of all the SPTEs mapping GFNs in the memslot. If
1598-
* AD bits are enabled, this will involve clearing the dirty bit on each SPTE.
1599-
* If AD bits are not enabled, this will require clearing the writable bit on
1600-
* each SPTE. Returns true if an SPTE has been changed and the TLBs need to
1601-
* be flushed.
1597+
* Clear the dirty status (D-bit or W-bit) of all the SPTEs mapping GFNs in the
1598+
* memslot. Returns true if an SPTE has been changed and the TLBs need to be
1599+
* flushed.
16021600
*/
16031601
bool kvm_tdp_mmu_clear_dirty_slot(struct kvm *kvm,
16041602
const struct kvm_memory_slot *slot)
@@ -1656,11 +1654,9 @@ static void clear_dirty_pt_masked(struct kvm *kvm, struct kvm_mmu_page *root,
16561654
}
16571655

16581656
/*
1659-
* Clears the dirty status of all the 4k SPTEs mapping GFNs for which a bit is
1660-
* set in mask, starting at gfn. The given memslot is expected to contain all
1661-
* the GFNs represented by set bits in the mask. If AD bits are enabled,
1662-
* clearing the dirty status will involve clearing the dirty bit on each SPTE
1663-
* or, if AD bits are not enabled, clearing the writable bit on each SPTE.
1657+
* Clear the dirty status (D-bit or W-bit) of all the 4k SPTEs mapping GFNs for
1658+
* which a bit is set in mask, starting at gfn. The given memslot is expected to
1659+
* contain all the GFNs represented by set bits in the mask.
16641660
*/
16651661
void kvm_tdp_mmu_clear_dirty_pt_masked(struct kvm *kvm,
16661662
struct kvm_memory_slot *slot,

0 commit comments

Comments
 (0)