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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 80682C433E0 for ; Mon, 25 Jan 2021 14:50:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1788E20848 for ; Mon, 25 Jan 2021 14:50:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1788E20848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8A3E98D0005; Mon, 25 Jan 2021 09:50:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8549F8D0001; Mon, 25 Jan 2021 09:50:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 791BD8D0005; Mon, 25 Jan 2021 09:50:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 62D608D0001 for ; Mon, 25 Jan 2021 09:50:49 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2924E3620 for ; Mon, 25 Jan 2021 14:50:49 +0000 (UTC) X-FDA: 77744584218.24.plane49_6106f3127586 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 0BE691A4A0 for ; Mon, 25 Jan 2021 14:50:49 +0000 (UTC) X-HE-Tag: plane49_6106f3127586 X-Filterd-Recvd-Size: 3403 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 Jan 2021 14:50:48 +0000 (UTC) Received: from zn.tnic (p200300ec2f09db0095810f165069682a.dip0.t-ipconnect.de [IPv6:2003:ec:2f09:db00:9581:f16:5069:682a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 4D2A31EC0572; Mon, 25 Jan 2021 15:50:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1611586246; 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:in-reply-to:in-reply-to: references:references; bh=+TCaFbdg4KelXLn9SPKHyv4vN7y4Nq66S6xqaowPGy8=; b=ps+f1Wg2SvNQilg3jVkxCSoTCcvpurycqzelh9QttRfqxWuJvvPaD8eZlj+9rQucikvV5u p7xFwjuO+HAHgbmfAvcTqBsA+fd2tyS0eGSI9G9Zo3fNin8TJwXTQG8Us7mQig5hNKfi3u amJy0ribj2w6PnIixh7Q1qOO2slcUIk= Date: Mon, 25 Jan 2021 15:50:41 +0100 From: Borislav Petkov To: Mike Rapoport Cc: Andrew Morton , Andrea Arcangeli , Baoquan He , David Hildenbrand , "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 Subject: Re: [PATCH 1/2] x86/setup: consolidate early memory reservations Message-ID: <20210125145041.GD23070@zn.tnic> References: <20210115083255.12744-1-rppt@kernel.org> <20210115083255.12744-2-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210115083255.12744-2-rppt@kernel.org> 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 Fri, Jan 15, 2021 at 10:32:54AM +0200, Mike Rapoport wrote: > From: Mike Rapoport > > The early reservations of memory areas used by the firmware, bootloader, > kernel text and data are spread over setup_arch(). Moreover, some of them > happen *after* memblock allocations, e.g trim_platform_memory_ranges() and > trim_low_memory_range() are called after reserve_real_mode() that allocates > memory. > > We did not observe corruption of these memory regions because memblock Make that "We" impersonal, passive voice pls. > always allocates memory either from the end of memory (in top-down mode) or > above the kernel image (in bottom-up mode). However, the bottom up mode is > going to be updated to span the entire memory [1] to avoid limitations > caused by KASLR. > > Consolidate early memory reservations in a dedicated function to improve > robustness against future changes. Having the early reservations in one > place also makes it clearer what memory must be reserved before we allow > memblock allocations. Would it make sense to have a check with a WARN or so to catch early reservations which get added after memblock allocations have been allowed? To catch people who don't pay attention... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette