kvm: mmu: Use fast PF path for access tracking of huge pages when possible
PATCH v2 1/1 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.
---
v2:
- Removed a stale comment
arch/x86/kvm/mmu/mmu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/kvm/mmu/mmu.c +5 -5
@@ -3191,17 +3191,17 @@ static int fast_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) new_spte |=PT_WRITABLE_MASK ;/* -* Do not fix write-permission on the large spte. Since -* we only dirty the first page into the dirty-bitmap in +* Do not fix write-permission on the large spte when +* dirty logging is enabled. Since we only dirty the +* first page into the dirty-bitmap in * fast_pf_fix_direct_spte(), other pages are missed * if its slot has dirty logging enabled. * * Instead, we let the slow page fault path create a * normal spte to fix the access. -* -* See the comments in kvm_arch_commit_memory_region(). */ -if (sp->role.level >PG_LEVEL_4K ) +if (sp->role.level >PG_LEVEL_4K && +kvm_slot_dirty_track_enabled (fault->slot))break ; }
Signature · 1 line
2.33.1.1089.g2158813163f-goog
Quoted 34 lines · Junaid Shahid
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]>---
v2:
- Removed a stale commentarch/x86/kvm/mmu/mmu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)arch/x86/kvm/mmu/mmu.c +3
-2@@ -3191,17 +3191,17 @@ static int fast_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) new_spte |=PT_WRITABLE_MASK ;/* -* Do not fix write-permission on the large spte. Since -* we only dirty the first page into the dirty-bitmap in +* Do not fix write-permission on the large spte when +* dirty logging is enabled. Since we only dirty the +* first page into the dirty-bitmap in * fast_pf_fix_direct_spte(), other pages are missed * if its slot has dirty logging enabled. * * Instead, we let the slow page fault path create a
arch/x86/kvm/mmu/mmu.c static int fast_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) · line 3207
Quoted 10 lines
arch/x86/kvm/mmu/mmu.c +2
-3* normal spte to fix the access. -* -* See the comments in kvm_arch_commit_memory_region(). */ -if (sp->role.level >PG_LEVEL_4K ) +if (sp->role.level >PG_LEVEL_4K && +kvm_slot_dirty_track_enabled (fault->slot))break ; }
Queued, thanks.
Paolo