This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [rfc] [patch] 32/64-bit hypercall interface revisited

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [rfc] [patch] 32/64-bit hypercall interface revisited
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Fri, 14 Apr 2006 16:15:25 -0500
Cc: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 14 Apr 2006 14:14:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Last year we had a discussion[1] about how the hypercall ABI
unfortunately contains fields that change width between 32- and 64-bit
builds. This is a huge problem as we come up on the python management
stack for ppc64, since the distributions ship 32-bit python. A 32-bit
python/libxc cannot currently manage a 64-bit hypervisor.

I had a patch but was unable to test it, and some other things were more
important at the time so I dropped the issue. Ultimately, there were
three main issues:

First, "unsigned longs" in the dom0 interface (but not the guest
interface) should be converted[2] to a new type[3]:
        typedef unsigned long long __attribute__((aligned(8))) foo_t;

Second, hypercalls that deal with frame numbers, e.g. DOM0_GETMEMLIST,
also use "unsigned long". I've sent a separate mail about this, but I
think it makes sense to define a DOM0_GETMEMLIST2 hypercall for this
issue. I haven't investigated this fully.

Third, the tools need to treat GUEST_HANDLEs specially.[4] The attached
patch does this; I have a ppc32 app successfully making
DOM0_GETVCPUCONTEXT hcalls to a ppc64 Xen. The patch has only been
compile-tested on x86-32, so I would appreciate it if people could try
it out on x86.

For reference, the PPC changes look something like this:
-    typedef struct { type *p; } __guest_handle_ ## name
+    typedef union { uint64_t u; type *p; } __guest_handle_ ## name

+#define SET_HANDLE(hnd, val) do {           \
+        (void)((hnd).p == (val));           \
+        (hnd).u = (uint64_t)(unsigned long)(void *)(val);  \
+    } while (0)
+#define GET_HANDLE(val, hnd) do {           \
+        (val) = (hnd).p;                    \
+    } while (0)

This patch could be applied in advance of solving problems #1 and #2
above. However, it will likely require hand-merging with the libxc
whitespace patch I sent recently.

[1] In the archive, the thread spilled from Sep to Oct:


[3] the alignment of long long on 32-bit x86 is 4 bytes, not 8

[4] the original incarnation of GUEST_HANDLE

Hollis Blanchard
IBM Linux Technology Center

Xen-devel mailing list