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 1 of 4] hvmloader: reduce minimum allocation alignmen

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 1 of 4] hvmloader: reduce minimum allocation alignment from 1024 bytes to 16
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Thu, 2 Jun 2011 16:07:52 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Thu, 02 Jun 2011 08:10:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1307027271@xxxxxxxxxxxxxxxxxxxxxxxxx>
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>
References: <patchbomb.1307027271@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1307026837 -3600
# Node ID 1f07d98d624ec828bd6483425adf204521175833
# Parent  f7493e7dd9daa6b25bade1f027702d2e61c326bb
hvmloader: reduce minimum allocation alignment from 1024 bytes to 16.

1024 bytes create a lot of wastage when the majority of allocations are of BIOS
table data structures which are generally happy with much lower alignment. I
conservatively chose 16 bytes.

Most callers pass 0 for the alignment anyway, for the rombios high code
allocation I kept it 1024 byte aligned since it was the only case that didn't
seem obviously ok with a smaller alignment.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r f7493e7dd9da -r 1f07d98d624e 
tools/firmware/hvmloader/32bitbios_support.c
--- a/tools/firmware/hvmloader/32bitbios_support.c      Thu Jun 02 15:09:24 
2011 +0100
+++ b/tools/firmware/hvmloader/32bitbios_support.c      Thu Jun 02 16:00:37 
2011 +0100
@@ -67,7 +67,7 @@ static uint32_t relocate_32bitbios(char 
      */
     reloc_size = reloc_off;
     printf("%d bytes of ROMBIOS high-memory extensions:\n", reloc_size);
-    highbiosarea = mem_alloc(reloc_size, 0);
+    highbiosarea = mem_alloc(reloc_size, 1024);
     BUG_ON(highbiosarea == NULL);
     printf("  Relocating to 0x%x-0x%x ... ",
            (uint32_t)&highbiosarea[0],
diff -r f7493e7dd9da -r 1f07d98d624e tools/firmware/hvmloader/util.c
--- a/tools/firmware/hvmloader/util.c   Thu Jun 02 15:09:24 2011 +0100
+++ b/tools/firmware/hvmloader/util.c   Thu Jun 02 16:00:37 2011 +0100
@@ -312,9 +312,9 @@ void *mem_alloc(uint32_t size, uint32_t 
     xen_pfn_t mfn;
     uint32_t s, e;
 
-    /* Align to at least one kilobyte. */
-    if ( align < 1024 )
-        align = 1024;
+    /* Align to at least 16 bytes. */
+    if ( align < 16 )
+        align = 16;
 
     s = (reserve + align) & ~(align - 1);
     e = s + size - 1;
@@ -366,9 +366,9 @@ void *scratch_alloc(uint32_t size, uint3
 {
     uint32_t s, e;
 
-    /* Align to at least one kilobyte. */
-    if ( align < 1024 )
-        align = 1024;
+    /* Align to at least 16 bytes. */
+    if ( align < 16 )
+        align = 16;
 
     s = (scratch_start + align - 1) & ~(align - 1);
     e = s + size - 1;

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