Commit cb16a7b3 authored by Hillf Danton's avatar Hillf Danton Committed by Avi Kivity

KVM: MMU: fix counting of rmap entries in rmap_add()

It seems that rmap entries are under counted.
Signed-off-by: default avatarHillf Danton <dhillf@gmail.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent a182d873
...@@ -632,6 +632,7 @@ static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn) ...@@ -632,6 +632,7 @@ static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn)
desc->sptes[0] = (u64 *)*rmapp; desc->sptes[0] = (u64 *)*rmapp;
desc->sptes[1] = spte; desc->sptes[1] = spte;
*rmapp = (unsigned long)desc | 1; *rmapp = (unsigned long)desc | 1;
++count;
} else { } else {
rmap_printk("rmap_add: %p %llx many->many\n", spte, *spte); rmap_printk("rmap_add: %p %llx many->many\n", spte, *spte);
desc = (struct kvm_rmap_desc *)(*rmapp & ~1ul); desc = (struct kvm_rmap_desc *)(*rmapp & ~1ul);
...@@ -644,7 +645,7 @@ static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn) ...@@ -644,7 +645,7 @@ static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn)
desc = desc->more; desc = desc->more;
} }
for (i = 0; desc->sptes[i]; ++i) for (i = 0; desc->sptes[i]; ++i)
; ++count;
desc->sptes[i] = spte; desc->sptes[i] = spte;
} }
return count; return count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment