Skip to contentSkip to conversation

KVM: x86/mmu: add missing update to max_mmu_rmap_size

PATCH Applied Miaohe Lin 3 participants 3 messages Sep 7, 2022 – Sep 22, 2022

Subsystems (3)
lore
Share & tools
lore

Miaohe Lin

author
#0 lore raw

PATCH 1/1 KVM: x86/mmu: add missing update to max_mmu_rmap_size

The update to statistic max_mmu_rmap_size is unintentionally removed by commit 4293ddb788c1 ("KVM: x86/mmu: Remove redundant spte present check in mmu_set_spte"). Add missing update to it or max_mmu_rmap_size will always be nonsensical 0.

Fixes 4293ddb788c1 ("KVM: x86/mmu: Remove redundant spte present check in mmu_set_spte")
---
 arch/x86/kvm/mmu/mmu.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kvm/mmu/mmu.c +2 -0
index d25d55b1f0b5..858bc53cfab4 100644
@@ -1596,6 +1596,8 @@ static void __rmap_add(struct kvm *kvm,
 	rmap_head = gfn_to_rmap(gfn, sp->role.level, slot);
 	rmap_count = pte_list_add(cache, spte, rmap_head);
 
+	if (rmap_count > kvm->stat.max_mmu_rmap_size)
+		kvm->stat.max_mmu_rmap_size = rmap_count;
 	if (rmap_count > RMAP_RECYCLE_THRESHOLD) {
 		kvm_zap_all_rmap_sptes(kvm, rmap_head);
 		kvm_flush_remote_tlbs_with_address(
Signature · 1 line
2.23.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Miaohe Lin

The update to statistic max_mmu_rmap_size is unintentionally removed by commit 4293ddb788c1 ("KVM: x86/mmu: Remove redundant spte present check in mmu_set_spte"). Add missing update to it or max_mmu_rmap_size will always be nonsensical 0.

Fixes 4293ddb788c1 ("KVM: x86/mmu: Remove redundant spte present check in mmu_set_spte")

For anyone else wondering "how did so many reviewers miss this obvious bug?", the answer is that the reviews were collected for v3 and earlier, and the mishandled merge conflict only showed up in v4.

Quoted 2 lines

---

Paolo, do you want to grab this for 6.0?