KVM: MMU: fix counting of rmap entries in rmap_add()
authorHillf Danton <dhillf@gmail.com>
Sat, 18 Sep 2010 00:41:02 +0000 (08:41 +0800)
committerAvi Kivity <avi@redhat.com>
Sun, 24 Oct 2010 08:52:59 +0000 (10:52 +0200)
It seems that rmap entries are under counted.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/mmu.c

index 3ce56bfe056e671e683b911fbd6c92c753c02bd9..c94c43289f53f41b64bc7f273617307e58d3c4c5 100644 (file)
@@ -632,6 +632,7 @@ static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn)
                desc->sptes[0] = (u64 *)*rmapp;
                desc->sptes[1] = spte;
                *rmapp = (unsigned long)desc | 1;
+               ++count;
        } else {
                rmap_printk("rmap_add: %p %llx many->many\n", spte, *spte);
                desc = (struct kvm_rmap_desc *)(*rmapp & ~1ul);
@@ -644,7 +645,7 @@ static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn)
                        desc = desc->more;
                }
                for (i = 0; desc->sptes[i]; ++i)
-                       ;
+                       ++count;
                desc->sptes[i] = spte;
        }
        return count;