Skip to content

Commit 10c30de

Browse files
Junaid Shahidbonzini
authored andcommitted
kvm: mmu: Use fast PF path for access tracking of huge pages when possible
The fast page fault path bails out on write faults to huge pages in order to accommodate dirty logging. This change adds a check to do that only when dirty logging is actually enabled, so that access tracking for huge pages can still use the fast path for write faults in the common case. Signed-off-by: Junaid Shahid <[email protected]> Reviewed-by: Ben Gardon <[email protected]> Reviewed-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent c435d4b commit 10c30de

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/x86/kvm/mmu/mmu.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3191,17 +3191,17 @@ static int fast_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
31913191
new_spte |= PT_WRITABLE_MASK;
31923192

31933193
/*
3194-
* Do not fix write-permission on the large spte. Since
3195-
* we only dirty the first page into the dirty-bitmap in
3194+
* Do not fix write-permission on the large spte when
3195+
* dirty logging is enabled. Since we only dirty the
3196+
* first page into the dirty-bitmap in
31963197
* fast_pf_fix_direct_spte(), other pages are missed
31973198
* if its slot has dirty logging enabled.
31983199
*
31993200
* Instead, we let the slow page fault path create a
32003201
* normal spte to fix the access.
3201-
*
3202-
* See the comments in kvm_arch_commit_memory_region().
32033202
*/
3204-
if (sp->role.level > PG_LEVEL_4K)
3203+
if (sp->role.level > PG_LEVEL_4K &&
3204+
kvm_slot_dirty_track_enabled(fault->slot))
32053205
break;
32063206
}
32073207

0 commit comments

Comments
 (0)