From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43705C433E0 for ; Fri, 15 Jan 2021 08:33:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B4E5722C7D for ; Fri, 15 Jan 2021 08:33:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4E5722C7D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 304708D013C; Fri, 15 Jan 2021 03:33:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2DA7E8D0023; Fri, 15 Jan 2021 03:33:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F11A8D013C; Fri, 15 Jan 2021 03:33:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id 0AC418D0023 for ; Fri, 15 Jan 2021 03:33:32 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BF69E180AD807 for ; Fri, 15 Jan 2021 08:33:31 +0000 (UTC) X-FDA: 77707345422.20.move18_5807bf62752d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id A1E37180C07A3 for ; Fri, 15 Jan 2021 08:33:31 +0000 (UTC) X-HE-Tag: move18_5807bf62752d X-Filterd-Recvd-Size: 4131 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Jan 2021 08:33:31 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B4B6E23436; Fri, 15 Jan 2021 08:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610699610; bh=StoT2zp79sznIPfcRkkmD1yMT7cGVvKLETHGz0Lwr3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZMzuYEacN0wqIbOJ5wTWm5r6t/pKWqQzWZKUM6+sW2j61F1dxN1ZSm2o0RtLNwty ZhBXIqRNtG4Cy346zt8KEHMhL3WhQ7m21aoEcmpmNLv2IET4NRUsqjZx0GnTih8CoT 5mWAzUGd9KbCX/Xs/uTpu+/EfpZEuz0lYaeZBhBti6lGoRlmCkbNUqukoaYZBviMGT +P4ENiB2ZHA86/GJVUzzcIMePKKm7rME+Lv5T8sUsqW3NcLs+r8I5MBNxA6jzDb1kQ G4C9+GRZxRqDMw60BeBUQXjnn+eT17lK8qB5cR91eTBnqQOa5BDaK3whZ7zu4rGa+C 1w75MLZUsFE1g== From: Mike Rapoport To: Andrew Morton Cc: Andrea Arcangeli , Baoquan He , Borislav Petkov , David Hildenbrand , "H. Peter Anvin" , Ingo Molnar , Mel Gorman , Michal Hocko , Mike Rapoport , Mike Rapoport , Qian Cai , Thomas Gleixner , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org Subject: [PATCH 2/2] x86/setup: merge several reservations of start of the memory Date: Fri, 15 Jan 2021 10:32:55 +0200 Message-Id: <20210115083255.12744-3-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210115083255.12744-1-rppt@kernel.org> References: <20210115083255.12744-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Mike Rapoport Currently the first several pages are reserved both to avoid leaking thei= r contents on systems with L1TF and to avoid corrupting BIOS memory. Merge the two memory reservations. Signed-off-by: Mike Rapoport --- arch/x86/kernel/setup.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 32cd2e790a0a..3f2fd67240f8 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -715,20 +715,6 @@ static int __init parse_reservelow(char *p) =20 early_param("reservelow", parse_reservelow); =20 -static void __init trim_low_memory_range(void) -{ - /* - * A special case is the first 4Kb of memory; - * This is a BIOS owned area, not kernel ram, but generally - * not listed as such in the E820 table. - * - * This typically reserves additional memory (64KiB by default) - * since some BIOSes are known to corrupt low memory. See the - * Kconfig help text for X86_RESERVE_LOW. - */ - memblock_reserve(0, ALIGN(reserve_low, PAGE_SIZE)); -} - static void __init early_reserve_memory(void) { /* @@ -741,10 +727,18 @@ static void __init early_reserve_memory(void) (unsigned long)__end_of_kernel_reserve - (unsigned long)_text); =20 /* - * 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, we must 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)); =20 early_reserve_initrd(); =20 @@ -757,7 +751,6 @@ static void __init early_reserve_memory(void) reserve_bios_regions(); =20 trim_platform_memory_ranges(); - trim_low_memory_range(); } =20 /* --=20 2.28.0