From patchwork Fri Feb 17 20:52:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 9580787 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 1F954600C5 for ; Fri, 17 Feb 2017 20:55:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E15F2877C for ; Fri, 17 Feb 2017 20:55:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3BBB28780; Fri, 17 Feb 2017 20:55:50 +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=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 D52072877C for ; Fri, 17 Feb 2017 20:55:49 +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 1cepWZ-0000vI-Pb; Fri, 17 Feb 2017 20:53:03 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cepWY-0000vC-So for xen-devel@lists.xenproject.org; Fri, 17 Feb 2017 20:53:02 +0000 Received: from [193.109.254.147] by server-3.bemta-6.messagelabs.com id 03/88-13524-EA267A85; Fri, 17 Feb 2017 20:53:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfSaju7apOU RBvP3Clt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBl7P91gK/hhW/HpRD9LA2O7URcjJ4eQwAxG iZ5eeRCbRaCRVeLiHCCbi0NCYA6rxImT51lAEhICORJX3nQyQ9iFEv2vp4PZvAKCEidnPgGq4 QAa5CXxabEwSJhTIFBi6a31zBDz1zFK9B5nB7HZBLQk9jTMZ4LYpSrxsPsNK0grr0CAxKrZrC BhYYEgiUd7X7CDhEWASlbs9ga5hlngOK/E5pa/bCBxZgF1ifXzhCYwCsxCcsMshMwCRqZVjBr FqUVlqUW6RgZ6SUWZ6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5mxiB4ccABDsYfy0LOMQo ycGkJMp7xGd5hBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3keJQDnBotT01Iq0zBxgJMCkJTh4l ER4+YHRIMRbXJCYW5yZDpE6xWjM0dN1+iUTx55dl18yCbHk5eelSonzHgeZJABSmlGaBzcIFq GXGGWlhHkZgU4T4ilILcrNLEGVf8UozsGoJMx7E2QKT2ZeCdy+V0CnMAGd0hmxFOSUkkSElFQ DYy7zogVzkqv1JPfvO7Gk1SZoJe+vOZ/f7fH6aLvt6IUPdx5kCQtmHG7488/novX2b6qhWz4w up+9Un+a79TR0wa/Lzc9nv/MiZstsYt9pTR/ZGCh3vpCnsnzl11dukc+OswhfHudw/1Pm9nSa 6v99HVmsszx9eXpezpZQMeJeau8b/Gh5TVp9kosxRmJhlrMRcWJAHe5N8/LAgAA X-Env-Sender: thgarnie@google.com X-Msg-Ref: server-12.tower-27.messagelabs.com!1487364780!86200763!1 X-Originating-IP: [209.85.214.44] X-SpamReason: No, hits=0.3 required=7.0 tests=RCVD_BY_IP X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50370 invoked from network); 17 Feb 2017 20:53:01 -0000 Received: from mail-it0-f44.google.com (HELO mail-it0-f44.google.com) (209.85.214.44) by server-12.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Feb 2017 20:53:01 -0000 Received: by mail-it0-f44.google.com with SMTP id 203so34680866ith.0 for ; Fri, 17 Feb 2017 12:53:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=SQw9/89pEHbz76KMayuzlWw5cND/zrTW1LMzNn5jl18=; b=cnHiO42VHhmLV2GnBI5KeE7XeSC+yvRSipySEsp8/AU5YsXQ7U8TH1nQAJ3eXxun9B vqNoPO270GTQoBdy7QRfYs5wKcdbtfn65y6bGtb9fX2H4t5Xdj9esAxFsAi6SEwDN20c 8pTZMM+P6FUDcMOJtLIs2YVHCjTao7BgXEejz0mtp8n3JIpzmaooKlzqvhnBXNVsLbx7 S/DQ5m3nNtvCM9nGRVbNI1l6N17uQM52ZTTY3T4708+kT4iC+6qzVcukzrlgXLHGPfXe uB7Niy+iH0ybpTNTpMGHlZsKi+MUkg8hXi0ldVwMFS36xEe9nVyAR3ffYaQGdQjVjyo9 XONQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SQw9/89pEHbz76KMayuzlWw5cND/zrTW1LMzNn5jl18=; b=sCFJkHGaF9I8zoBILqdTvaQeHNbJduyuG4JL/W4jSoRg1gSTkUlWWlQEk8Bjjmyg9S InYL2izxKYwoykbRxDNccT72kGgPQSxFvFaS+W7HrlcgEjZaN1QVS3iCr1YTkoZUwXG4 X+QYKJOH1oFpjiDK9nXCxh5zHTRWeJz5oAj8XTGs55pM7g3cQ1SyQJuS4h+6+7AnPPN6 OcoKQFj5HlKQN1V62HOQ0xMfLut+bVO1+48vqcub5Wz2gXUP2L++9ENEv8R8+wrKbreQ rj1JqGDRng2QzpW81YfHXx0KJYEq/xa2bj3RIJbTZkNxqYO/2NGEWg3tmXBWVCAo/eoX zQvQ== X-Gm-Message-State: AMke39k6SNjYW6f7IPDQQE8MkgE5lnhVAdlg4DVDrGxK0+W5yrTimQUaTjfsDwY5zAhK+8CyRTzSfB7dnOwXhLrD X-Received: by 10.36.20.216 with SMTP id 207mr6427430itg.61.1487364779582; Fri, 17 Feb 2017 12:52:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.52.13 with HTTP; Fri, 17 Feb 2017 12:52:59 -0800 (PST) In-Reply-To: References: <20170216215438.126111-1-thgarnie@google.com> <201702170838.cW5onrBk%fengguang.wu@intel.com> From: Thomas Garnier Date: Fri, 17 Feb 2017 12:52:59 -0800 Message-ID: To: kbuild test robot Cc: linux-efi@vger.kernel.org, Stanislaw Gruszka , linux-doc@vger.kernel.org, kvm list , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Matt Fleming , Dave Hansen , Pavel Machek , "H . Peter Anvin" , Kernel Hardening , Jiri Olsa , Boris Ostrovsky , Andi Kleen , Jonathan Corbet , Michael Ellerman , Joerg Roedel , the arch/x86 maintainers , Paul Gortmaker , Christian Borntraeger , Ingo Molnar , xen-devel@lists.xenproject.org, Borislav Petkov , Len Brown , Jiri Kosina , Kees Cook , Arnd Bergmann , He Chen , Brian Gerst , Rusty Russell , lguest@lists.ozlabs.org, Andy Lutomirski , Josh Poimboeuf , Thomas Gleixner , Juergen Gross , Peter Zijlstra , Lorenzo Stoakes , Ard Biesheuvel , Linux PM list , "Rafael J . Wysocki" , LKML , Andy Lutomirski , "Luis R . Rodriguez" , kbuild-all@01.org, Paolo Bonzini , Vitaly Kuznetsov , Tim Chen Subject: Re: [Xen-devel] [PATCH v4 1/4] x86/mm: Adapt MODULES_END based on Fixmap section size 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 This patch aligns MODULES_END to the beginning of the Fixmap section. It optimizes the space available for both sections. The address is pre-computed based on the number of pages required by the Fixmap section. It will allow GDT remapping in the Fixmap section. The current MODULES_END static address does not provide enough space for the kernel to support a large number of processors. Signed-off-by: Thomas Garnier --- Based on next-20170213 Fixed fixmap dependencies on random configurations. --- Documentation/x86/x86_64/mm.txt | 5 ++++- arch/x86/include/asm/pgtable_64_types.h | 3 ++- arch/x86/kernel/module.c | 1 + arch/x86/mm/dump_pagetables.c | 1 + arch/x86/mm/kasan_init_64.c | 1 + mm/vmalloc.c | 1 + 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt index 5724092db811..ee3f9c30957c 100644 --- a/Documentation/x86/x86_64/mm.txt +++ b/Documentation/x86/x86_64/mm.txt @@ -19,7 +19,7 @@ ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks ffffffef00000000 - fffffffeffffffff (=64 GB) EFI region mapping space ... unused hole ... ffffffff80000000 - ffffffff9fffffff (=512 MB) kernel text mapping, from phys 0 -ffffffffa0000000 - ffffffffff5fffff (=1526 MB) module mapping space +ffffffffa0000000 - ffffffffff5fffff (=1526 MB) module mapping space (variable) ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls ffffffffffe00000 - ffffffffffffffff (=2 MB) unused hole @@ -39,6 +39,9 @@ memory window (this size is arbitrary, it can be raised later if needed). The mappings are not part of any other kernel PGD and are only available during EFI runtime calls. +The module mapping space size changes based on the CONFIG requirements for the +following fixmap section. + Note that if CONFIG_RANDOMIZE_MEMORY is enabled, the direct mapping of all physical memory, vmalloc/ioremap space and virtual memory map are randomized. Their order is preserved but their base will be offset early at boot time. diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index 3a264200c62f..bb05e21cf3c7 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h @@ -67,7 +67,8 @@ typedef struct { pteval_t pte; } pte_t; #endif /* CONFIG_RANDOMIZE_MEMORY */ #define VMALLOC_END (VMALLOC_START + _AC((VMALLOC_SIZE_TB << 40) - 1, UL)) #define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE) -#define MODULES_END _AC(0xffffffffff000000, UL) +/* The module sections ends with the start of the fixmap */ +#define MODULES_END __fix_to_virt(__end_of_fixed_addresses + 1) #define MODULES_LEN (MODULES_END - MODULES_VADDR) #define ESPFIX_PGD_ENTRY _AC(-2, UL) #define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT) diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c index 477ae806c2fa..fad61caac75e 100644 --- a/arch/x86/kernel/module.c +++ b/arch/x86/kernel/module.c @@ -35,6 +35,7 @@ #include #include #include +#include #if 0 #define DEBUGP(fmt, ...) \ diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index 8aa6bea1cd6c..90170415f08a 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -19,6 +19,7 @@ #include #include +#include /* * The dumper groups pagetable entries of the same type into one, and for diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c index 0493c17b8a51..34f167cf3316 100644 --- a/arch/x86/mm/kasan_init_64.c +++ b/arch/x86/mm/kasan_init_64.c @@ -8,6 +8,7 @@ #include #include +#include extern pgd_t early_level4_pgt[PTRS_PER_PGD]; extern struct range pfn_mapped[E820_X_MAX]; diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 011b446f8758..84e637f2fa49 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "internal.h"