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=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 BD26BC433E0 for ; Fri, 15 Jan 2021 10:09:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1D3AE23603 for ; Fri, 15 Jan 2021 10:09:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D3AE23603 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3B7A28D014D; Fri, 15 Jan 2021 05:09:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 368E48D0023; Fri, 15 Jan 2021 05:09:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2581A8D014D; Fri, 15 Jan 2021 05:09:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 109438D0023 for ; Fri, 15 Jan 2021 05:09:25 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C38E1181AEF32 for ; Fri, 15 Jan 2021 10:09:24 +0000 (UTC) X-FDA: 77707587048.03.suit46_270b3f92752e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 8692928A4E9 for ; Fri, 15 Jan 2021 10:09:24 +0000 (UTC) X-HE-Tag: suit46_270b3f92752e X-Filterd-Recvd-Size: 5250 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Jan 2021 10:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610705363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gm92MUKhkCOz/gm7SwDV9j1IMVrCL///0RyjllYTsvQ=; b=HAJDV4FMzrkyKxRXKQF5cQOF3lag3FQU6T0kTz5SPGxw4YI+sY6NUD4gJA2cgWzMpX0NFL RjGOYqnMJCrh0Gs5806SIwlC/tEQDkP8nFk6SF8qvSJXLYOarcCIQhFL2HBQbuImuj4+j8 HaE2UTk5TtLvUy6etPe6ExqB08IEjUo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-7PlKNMoLMWCvHk_8xQUq0A-1; Fri, 15 Jan 2021 05:09:19 -0500 X-MC-Unique: 7PlKNMoLMWCvHk_8xQUq0A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 790B48018A3; Fri, 15 Jan 2021 10:09:17 +0000 (UTC) Received: from [10.36.112.11] (ovpn-112-11.ams2.redhat.com [10.36.112.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43FB160C6D; Fri, 15 Jan 2021 10:09:13 +0000 (UTC) Subject: Re: [PATCH 2/2] x86/setup: merge several reservations of start of the memory To: Mike Rapoport , Andrew Morton Cc: Andrea Arcangeli , Baoquan He , Borislav Petkov , "H. Peter Anvin" , Ingo Molnar , Mel Gorman , Michal Hocko , Mike Rapoport , Qian Cai , Thomas Gleixner , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org References: <20210115083255.12744-1-rppt@kernel.org> <20210115083255.12744-3-rppt@kernel.org> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Fri, 15 Jan 2021 11:09:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20210115083255.12744-3-rppt@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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: On 15.01.21 09:32, Mike Rapoport wrote: > From: Mike Rapoport > > 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 > --- > 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) > > early_param("reservelow", parse_reservelow); > > -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); > > /* > - * 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)); > > early_reserve_initrd(); > > @@ -757,7 +751,6 @@ static void __init early_reserve_memory(void) > reserve_bios_regions(); > > trim_platform_memory_ranges(); > - trim_low_memory_range(); > } > > /* > Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb