From patchwork Tue Feb 28 15:20:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9596003 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B04CC600CB for ; Tue, 28 Feb 2017 15:23:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DB7A20952 for ; Tue, 28 Feb 2017 15:23:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8EB6828516; Tue, 28 Feb 2017 15:23:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8260820952 for ; Tue, 28 Feb 2017 15:23:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cijZs-0008DS-47; Tue, 28 Feb 2017 15:20:36 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cijZq-0008Ct-O4 for xen-devel@lists.xen.org; Tue, 28 Feb 2017 15:20:34 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id B6/32-08534-14595B85; Tue, 28 Feb 2017 15:20:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmkeJIrShJLcpLzFFi42JxWrohUtdx6tY IgyMLlS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozbHxYwFxwWrFiz7QZ7A+NBvi5GTg4JAX+J CT+mMYHYbAL6ErtffAKzRQTUJU53XGTtYuTgYBbwkzj0wBckLCxgJ/Hi51R2EJtFQFXi1YyfY DavgKdE5+LbbBAj5STOH//JDGJzCnhJ7Ph9lAlkjBBQzcYpYGEhATWJa/2XoFoFJU7OfMICYj MLSEgcfPGCeQIj7ywkqVlIUgsYmVYxahSnFpWlFukaGuklFWWmZ5TkJmbm6BoaGOvlphYXJ6a n5iQmFesl5+duYgQGDgMQ7GB81e18iFGSg0lJlDcreWuEEF9SfkplRmJxRnxRaU5q8SFGGQ4O JQlehilAOcGi1PTUirTMHGAIw6QlOHiURHjPTAZK8xYXJOYWZ6ZDpE4xKkqJ854GSQiAJDJK8 +DaYHFziVFWSpiXEegQIZ6C1KLczBJU+VeM4hyMSsK8m0Gm8GTmlcBNfwW0mAlo8QsVsMUliQ gpqQbG3vfJnMs1LgW/3JJ+cfOMlobY1peH3SZNnhpyX6vpX3yh9oQuxtOLl77/cHVZ5nvrY23 FDwRXr+cQr/yzlquk4LB569PNAnPVZ29c+eZhkWFo23rhMqOFfYWTvb07DvVu3a4RqC7temTl +qPB7XWaP3JYD31av6arMWgHh07YubTYz2eF+gV2K7EUZyQaajEXFScCANUjQvmWAgAA X-Env-Sender: prvs=2253f5a22=Andrew.Cooper3@citrix.com X-Msg-Ref: server-15.tower-31.messagelabs.com!1488295231!83815725!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 43282 invoked from network); 28 Feb 2017 15:20:33 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-15.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 28 Feb 2017 15:20:33 -0000 X-IronPort-AV: E=Sophos;i="5.35,220,1484006400"; d="scan'208";a="410307511" From: Andrew Cooper To: Xen-devel Date: Tue, 28 Feb 2017 15:20:18 +0000 Message-ID: <1488295218-26057-2-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1488295218-26057-1-git-send-email-andrew.cooper3@citrix.com> References: <1488295218-26057-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Jan Beulich Subject: [Xen-devel] [PATCH 2/2] efi/boot: Don't free ebmalloc area at all X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- CC: Jan Beulich --- 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;