Re: [PATCH 26/27] Enable 32bit dirty log pointers on 64bit host

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

 



On 09/29/2009 10:18 AM, Alexander Graf wrote:
With big endian userspace, we can't quite figure out if a pointer
is 32 bit (shifted>>  32) or 64 bit when we read a 64 bit pointer.

This is what happens with dirty logging. To get the pointer interpreted
correctly, I just make it bounce twice, but admittedly that is not ideal.

I'm open for suggestions here.


How about adding a new union member to struct kvm_dirty_log:

  __u64 dirty_bitmap_virt;

and deprecate dirty_bitmap.

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e27b7a9..91c0225 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -720,6 +720,11 @@ int kvm_get_dirty_log(struct kvm *kvm,

  	r = -EFAULT;
  	if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n))
+#ifdef __BIG_ENDIAN
+		/* Did we get a 32 bit pointer? */
+		if (copy_to_user((void*)((u64)log->dirty_bitmap>>  32),
+				 memslot->dirty_bitmap, n))
+#endif
  		goto out;

  	if (any)


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux