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

[Xen-devel] [PATCH 2/2] efi/boot: Don't free ebmalloc area at all



Freeing part of the BSS back for general use proves to be problematic.  It is
not accounted for in xen_in_range(), causing errors when constructing the
IOMMU tables, resulting in a failure to boot.

Other smaller issues are that tboot treats the entire BSS as hypervisor data,
creating and checking a MAC of it on S3, and that, by being 1MB in size,
freeing it guarentees to shatter the hypervisor superpage mappings.

Judging by the content stored in it, 1MB is overkill on size.  Drop it to a
more-reasonable 32kB and keep the entire buffer around after boot.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
---
 xen/common/efi/boot.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index b6cbdad..82bf15b 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -120,11 +120,10 @@ static CHAR16 __initdata newline[] = L"\r\n";
  *     have to be disabled in xen/arch/arm/arm64/head.S; though BSS
  *     should be initialized somehow before use of variables living there,
  *   - use ebmalloc() in ARM/common EFI boot code,
- *   - call free_ebmalloc_unused_mem() somewhere in init code.
  */
 #define EBMALLOC_SIZE  MB(0)
 #else
-#define EBMALLOC_SIZE  MB(1)
+#define EBMALLOC_SIZE  KB(32)
 #endif
 
 static char __section(".bss.page_aligned") __aligned(PAGE_SIZE)
@@ -144,19 +143,6 @@ static void __init __maybe_unused *ebmalloc(size_t size)
     return ptr;
 }
 
-static void __init __maybe_unused free_ebmalloc_unused_mem(void)
-{
-    unsigned long start, end;
-
-    start = (unsigned long)ebmalloc_mem + PAGE_ALIGN(ebmalloc_allocated);
-    end = (unsigned long)ebmalloc_mem + sizeof(ebmalloc_mem);
-
-    destroy_xen_mappings(start, end);
-    init_xenheap_pages(__pa(start), __pa(end));
-
-    printk(XENLOG_INFO "Freed %lukB unused BSS memory\n", (end - start) >> 10);
-}
-
 /*
  * Include architecture specific implementation here, which references the
  * static globals defined above.
@@ -1310,8 +1296,6 @@ void __init efi_init_memory(void)
     } *extra, *extra_head = NULL;
 #endif
 
-    free_ebmalloc_unused_mem();
-
     if ( !efi_enabled(EFI_BOOT) )
         return;
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.