diff mbox

KVM: X86: MMU: no mmu_notifier_seq++ in kvm_age_hva

Message ID a8af26748dc6168c8363495b05cf8eb0db001347.1474911775.git.pfeiner@google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Feiner Sept. 26, 2016, 5:45 p.m. UTC
The MMU notifier sequence number keeps GPA->HPA mappings in sync when
GPA->HPA lookups are done outside of the MMU lock (e.g., in
tdp_page_fault). Since kvm_age_hva doesn't change GPA->HPA, it's
unnecessary to increment the sequence number.

Signed-off-by: Peter Feiner <pfeiner@google.com>
---
 arch/x86/kvm/mmu.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Radim Krčmář Sept. 29, 2016, 6:27 p.m. UTC | #1
2016-09-26 10:45-0700, Peter Feiner:
> The MMU notifier sequence number keeps GPA->HPA mappings in sync when
> GPA->HPA lookups are done outside of the MMU lock (e.g., in
> tdp_page_fault). Since kvm_age_hva doesn't change GPA->HPA, it's
> unnecessary to increment the sequence number.
> 
> Signed-off-by: Peter Feiner <pfeiner@google.com>
> ---

Applied to kvm/queue, thanks.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 3d4cc8cc..dc6d1e8 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1660,17 +1660,9 @@  int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end)
 	 * This has some overhead, but not as much as the cost of swapping
 	 * out actively used pages or breaking up actively used hugepages.
 	 */
-	if (!shadow_accessed_mask) {
-		/*
-		 * We are holding the kvm->mmu_lock, and we are blowing up
-		 * shadow PTEs. MMU notifier consumers need to be kept at bay.
-		 * This is correct as long as we don't decouple the mmu_lock
-		 * protected regions (like invalidate_range_start|end does).
-		 */
-		kvm->mmu_notifier_seq++;
+	if (!shadow_accessed_mask)
 		return kvm_handle_hva_range(kvm, start, end, 0,
 					    kvm_unmap_rmapp);
-	}
 
 	return kvm_handle_hva_range(kvm, start, end, 0, kvm_age_rmapp);
 }