WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] xen: Pack some hvmop memory structures better

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xen: Pack some hvmop memory structures better
From: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Date: Fri, 04 Feb 2011 15:28:18 +0000
Cc: george.dunlap@xxxxxxxxxxxxx
Delivery-date: Fri, 04 Feb 2011 07:29:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
Some of the hvmop memory structures have a shocking amount of unnecesssary
padding in them.  Elements which can have only 3 values are given 64 bits of
memory, and then aligned (so that there is padding behind them).

This patch resizes and reorganizes in the following way, (hopefully) without
introducing any differences between the layout for 32- and 64-bit.

xen_hvm_set_mem_type:
 hvmmem_type -> 16 bits
 nr -> 32 bits (limiting us to setting 16TB at a time)

xen_hvm_set_mem_access:
 hvmmem_access -> 16 bits
 nr -> 32 bits

xen_hvm_get_mem_access:
 hvmmem_access -> 16 bits

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

diff -r 4bdb78db22b6 -r dffa1a0edc8c xen/include/public/hvm/hvm_op.h
--- a/xen/include/public/hvm/hvm_op.h   Wed Feb 02 17:06:36 2011 +0000
+++ b/xen/include/public/hvm/hvm_op.h   Fri Feb 04 15:11:52 2011 +0000
@@ -119,11 +119,11 @@
     /* Domain to be updated. */
     domid_t domid;
     /* Memory type */
-    uint64_aligned_t hvmmem_type;
+    uint16_t hvmmem_type;
+    /* Number of pages. */
+    uint32_t nr;
     /* First pfn. */
     uint64_aligned_t first_pfn;
-    /* Number of pages. */
-    uint64_aligned_t nr;
 };
 typedef struct xen_hvm_set_mem_type xen_hvm_set_mem_type_t;
 DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_mem_type_t);
@@ -176,13 +176,12 @@
 struct xen_hvm_set_mem_access {
     /* Domain to be updated. */
     domid_t domid;
-    uint16_t pad[3]; /* align next field on 8-byte boundary */
     /* Memory type */
-    uint64_t hvmmem_access; /* hvm_access_t */
+    uint16_t hvmmem_access; /* hvm_access_t */
+    /* Number of pages, ignored on setting default access */
+    uint32_t nr;
     /* First pfn, or ~0ull to set the default access for new pages */
     uint64_t first_pfn;
-    /* Number of pages, ignored on setting default access */
-    uint64_t nr;
 };
 typedef struct xen_hvm_set_mem_access xen_hvm_set_mem_access_t;
 DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_mem_access_t);
@@ -192,11 +191,10 @@
 struct xen_hvm_get_mem_access {
     /* Domain to be queried. */
     domid_t domid;
-    uint16_t pad[3]; /* align next field on 8-byte boundary */
     /* Memory type: OUT */
-    uint64_t hvmmem_access; /* hvm_access_t */
+    uint16_t hvmmem_access; /* hvm_access_t */
     /* pfn, or ~0ull for default access for new pages.  IN */
-    uint64_t pfn;
+    uint64_aligned_t pfn;
 };
 typedef struct xen_hvm_get_mem_access xen_hvm_get_mem_access_t;
 DEFINE_XEN_GUEST_HANDLE(xen_hvm_get_mem_access_t);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel