Re: [PATCH v3 4/6] KVM: introduce id_to_memslot function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(2011/11/24 18:40), Xiao Guangrong wrote:

...

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3521,7 +3521,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
  	if (log->slot>= KVM_MEMORY_SLOTS)
  		goto out;

-	memslot =&kvm->memslots->memslots[log->slot];
+	memslot = id_to_memslot(kvm->memslots, log->slot);
  	r = -ENOENT;
  	if (!memslot->dirty_bitmap)
  		goto out;
@@ -3544,15 +3544,16 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
  		if (!slots)
  			goto out;
  		memcpy(slots, kvm->memslots, sizeof(struct kvm_memslots));
-		memslot =&slots->memslots[log->slot];
-		memslot->dirty_bitmap = dirty_bitmap;
+		memslot = id_to_memslot(slots, log->slot);
  		memslot->nr_dirty_pages = 0;
+		memslot->dirty_bitmap = dirty_bitmap;
  		update_memslots(slots, NULL);

  		old_slots = kvm->memslots;
  		rcu_assign_pointer(kvm->memslots, slots);
  		synchronize_srcu_expedited(&kvm->srcu);
-		dirty_bitmap = old_slots->memslots[log->slot].dirty_bitmap;
+		dirty_bitmap = id_to_memslot(old_slots,
+					      log->slot)->dirty_bitmap;

You can eliminate this if you use old_slot and new_slot for the two memory slots.

	Takuya

  		kfree(old_slots);

  		write_protect_slot(kvm, memslot, dirty_bitmap, nr_dirty_pages);
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux