linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: x86/mmu: add missing update to max_mmu_rmap_size
@ 2022-09-07  8:06 Miaohe Lin
  2022-09-07 14:26 ` Sean Christopherson
  2022-09-22 21:03 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Miaohe Lin @ 2022-09-07  8:06 UTC (permalink / raw)
  To: seanjc, pbonzini, tglx, mingo, bp, dave.hansen
  Cc: x86, hpa, kvm, linux-kernel, linmiaohe

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")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 arch/x86/kvm/mmu/mmu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index d25d55b1f0b5..858bc53cfab4 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -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(
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: x86/mmu: add missing update to max_mmu_rmap_size
  2022-09-07  8:06 [PATCH] KVM: x86/mmu: add missing update to max_mmu_rmap_size Miaohe Lin
@ 2022-09-07 14:26 ` Sean Christopherson
  2022-09-22 21:03 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2022-09-07 14:26 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa, kvm, linux-kernel

On Wed, Sep 07, 2022, Miaohe Lin wrote:
> 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.

> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---

Reviewed-by: Sean Christopherson <seanjc@google.com>


Paolo, do you want to grab this for 6.0?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: x86/mmu: add missing update to max_mmu_rmap_size
  2022-09-07  8:06 [PATCH] KVM: x86/mmu: add missing update to max_mmu_rmap_size Miaohe Lin
  2022-09-07 14:26 ` Sean Christopherson
@ 2022-09-22 21:03 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-09-22 21:03 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: seanjc, pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa, kvm,
	linux-kernel

Queued, thanks.

Paolo



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-22 21:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07  8:06 [PATCH] KVM: x86/mmu: add missing update to max_mmu_rmap_size Miaohe Lin
2022-09-07 14:26 ` Sean Christopherson
2022-09-22 21:03 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).