[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210302100406.22059-3-rppt@kernel.org>
Date: Tue, 2 Mar 2021 12:04:06 +0200
From: Mike Rapoport <rppt@...nel.org>
To: x86@...nel.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Baoquan He <bhe@...hat.com>, Borislav Petkov <bp@...en8.de>,
David Hildenbrand <david@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Mel Gorman <mgorman@...e.de>, Michal Hocko <mhocko@...nel.org>,
Mike Rapoport <rppt@...nel.org>,
Mike Rapoport <rppt@...ux.ibm.com>, Qian Cai <cai@....pw>,
Thomas Gleixner <tglx@...utronix.de>,
Vlastimil Babka <vbabka@...e.cz>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Borislav Petkov <bp@...e.de>
Subject: [PATCH v3 2/2] x86/setup: merge several reservations of start of the memory
From: Mike Rapoport <rppt@...ux.ibm.com>
Currently the first several pages are reserved both to avoid leaking their
contents on systems with L1TF and to avoid corrupting BIOS memory.
Merge the two memory reservations.
Signed-off-by: Mike Rapoport <rppt@...ux.ibm.com>
Reviewed-by: David Hildenbrand <david@...hat.com>
Acked-by: Borislav Petkov <bp@...e.de>
---
arch/x86/kernel/setup.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 3e3c6036b023..776fc9b3fafe 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -713,11 +713,6 @@ static int __init parse_reservelow(char *p)
early_param("reservelow", parse_reservelow);
-static void __init trim_low_memory_range(void)
-{
- memblock_reserve(0, ALIGN(reserve_low, PAGE_SIZE));
-}
-
static void __init early_reserve_memory(void)
{
/*
@@ -730,10 +725,17 @@ static void __init early_reserve_memory(void)
(unsigned long)__end_of_kernel_reserve - (unsigned long)_text);
/*
- * Make sure page 0 is always reserved because on systems with
- * L1TF its contents can be leaked to user processes.
+ * The first 4Kb of memory is a BIOS owned area, but generally it is
+ * not listed as such in the E820 table.
+ *
+ * Reserve the first memory page and typically some additional
+ * memory (64KiB by default) since some BIOSes are known to corrupt
+ * low memory. See the Kconfig help text for X86_RESERVE_LOW.
+ *
+ * In addition, make sure page 0 is always reserved because on
+ * systems with L1TF its contents can be leaked to user processes.
*/
- memblock_reserve(0, PAGE_SIZE);
+ memblock_reserve(0, ALIGN(reserve_low, PAGE_SIZE));
early_reserve_initrd();
@@ -746,7 +748,6 @@ static void __init early_reserve_memory(void)
reserve_bios_regions();
trim_snb_memory();
- trim_low_memory_range();
}
/*
--
2.28.0
Powered by blists - more mailing lists