All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen: Pack some hvmop memory structures better
@ 2011-02-04 15:28 George Dunlap
  2011-02-04 16:24 ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: George Dunlap @ 2011-02-04 15:28 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

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@eu.citrix.com>

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);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-07  9:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-04 15:28 [PATCH] xen: Pack some hvmop memory structures better George Dunlap
2011-02-04 16:24 ` Paolo Bonzini
2011-02-04 16:30   ` Tim Deegan
     [not found]     ` <AANLkTinDb6cNHGX9rZ8+gxQ8BwQN3J-k8MhYyKXjjkzq@mail.gmail.com>
2011-02-07  9:22       ` Tim Deegan
2011-02-07  9:22     ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.