Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp249831pxb; Fri, 15 Jan 2021 02:14:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHlat1VMKZ5gHJ7M7Lio2HUuuUVdtF17qqrepX4DVknolWVMS4sGpCRTulu0jx2Ah5wyAc X-Received: by 2002:a50:e846:: with SMTP id k6mr9157805edn.245.1610705641800; Fri, 15 Jan 2021 02:14:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610705641; cv=none; d=google.com; s=arc-20160816; b=ZEGAWJssaTkhLJySxb1S/5D3GD7TjxGytayNv72SGiYUCV2lQKxvg3bkRBZC4cyqlo 8ZkbrXvZwxk/nL1q34HofSoZE5YcjA51fONeNrX2A2Yx3X3Saqmf4Z5Y/jVy681ZLFLH uK5KWY+sOrYNPLgrtVFXbc0l3EcbAmispvquplT+1KH60K8n2d5mYNc7f1ZYj5OaaibH R2aem6CqvuFEjAzvHRFlXOZndz1/zhAvhceLKWE4V310QxXwz5md5vUhKHtImdGNqiFS jwIZPRKRHT4crjODQwdy1XV2lwPY5JgyFnRXGYGaCf4H6CLKIvod9bNxhAKTOSfRL22F yRjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=gm92MUKhkCOz/gm7SwDV9j1IMVrCL///0RyjllYTsvQ=; b=ZaNMoQt14xLXaa/eZbbJTC0XQ8qxQORHXKrywVDll8UC5iCSQgx2e4QWWm6rgw7emg mhNJJCqCNKDLXpstYJic4Us9lVb5QDED0Tkg20qnSmprVzcS1r/QzGnRznfQATPqfCwB bp8EQcdJj9X5UUstrWScf5JAMaUxEpbZ0G0/s2g+HPthEfOKXXblU+4KM4X5vV2Q37rG pRqPTSGRoKf1XDNmH2P9n7C74W5BN9yAPFx0/XM6ZixkvyfXNkx9Wee2Cegax687CW2S tKoYhMxyVf4JRvYi035jLnFK6HYO0A2qR00UM841Tp1KSphvcP/3+uip4DhWPIv8fFQ/ Uk8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HAJDV4FM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si2008971eds.425.2021.01.15.02.13.37; Fri, 15 Jan 2021 02:14:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HAJDV4FM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731286AbhAOKLM (ORCPT + 99 others); Fri, 15 Jan 2021 05:11:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60077 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726484AbhAOKKt (ORCPT ); Fri, 15 Jan 2021 05:10:49 -0500 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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