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=-11.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 01FDAC433E0 for ; Thu, 28 Jan 2021 10:57:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 63E6B64DDA for ; Thu, 28 Jan 2021 10:57:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63E6B64DDA 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 743676B0005; Thu, 28 Jan 2021 05:57:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F3876B0006; Thu, 28 Jan 2021 05:57:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 607D06B006C; Thu, 28 Jan 2021 05:57:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0247.hostedemail.com [216.40.44.247]) by kanga.kvack.org (Postfix) with ESMTP id 4C6836B0005 for ; Thu, 28 Jan 2021 05:57:34 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 01D768249980 for ; Thu, 28 Jan 2021 10:57:34 +0000 (UTC) X-FDA: 77754882828.21.meat65_42111cb2759f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id D78DC180442E5 for ; Thu, 28 Jan 2021 10:57:33 +0000 (UTC) X-HE-Tag: meat65_42111cb2759f X-Filterd-Recvd-Size: 3450 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Jan 2021 10:57:33 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 071EC6146D; Thu, 28 Jan 2021 10:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611831452; bh=tpQLEl3JcKJKah5jOR4EJ16hQaTeFdER9R5YaRN/lpk=; h=From:To:Cc:Subject:Date:From; b=OVzQhhOic7sERItejIOnfrOuEpOnfMvqtcsdZcGkcf1KIUlRvjZSvxzh3eu8hpSzG nuV34mkip7GpR1W6pkVGyVnzFlg4SxeKy2aGrciPwVGnUsAdaKcpHDhk17ScMKrHm1 NTAyIr6M88s6hlKtMNfHQwxCxCC9HSZH/6QAJElp4Zw8ywsQLyMXhXVZf5eqBZSEN5 ddKxFS+qx5JusIDd+SBKbtzwMfS/j0GChPOu4zRef2bbpsRNI55d10O5gHJY1hTQkW 9kbTzk/o+mz7ClN/NLRPiW0V/SYpaJTvvbfuixxZ9fEriS0FDKhAtPtFiL4fn831YI YBQXPRGESUs4g== 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 v2 0/2] x86/setup: consolidate early memory reservations Date: Thu, 28 Jan 2021 12:57:09 +0200 Message-Id: <20210128105711.10428-1-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 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 Hi, David noticed that we do some of memblock_reserve() calls after allocatio= ns are possible: https://lore.kernel.org/lkml/6ba6bde3-1520-5cd0-f987-32d543f0b79f@redhat.= com For now there is no actual problem because in top-down mode we allocate from the end of the memory and in bottom-up mode we allocate above the kernel image. But there is a patch in the mm tree that allow bottom-up allocations below the kernel: https://lore.kernel.org/lkml/20201217201214.3414100-2-guro@fb.com and with this change we may get a memory corruption if an allocation step= s on some of the firmware areas that are yet to be reserved. The below patches consolidate early memory reservations done during setup_arch() so that memory used by firmware, bootloader, kernel text/dat= a and the memory that should be excluded from the available memory for whatever other reason is reserved before memblock allocations are possibl= e. The patches are vs v5.11-rc3-mmots-2021-01-12-02-00 as I think they are prerequisite for the memblock bottom-up changes, but if needed I can reba= se then on another tree. v2: * get rid of trim_platform_memory_ranges() and call trim_snb_memory() directly, per Boris comments * massage changelog and comments to use passive voice, per Boris * add Acked-by and Reviewed-by, thanks Boris and David v1: https://lore.kernel.org/lkml/20210115083255.12744-1-rppt@kernel.org Mike Rapoport (2): x86/setup: consolidate early memory reservations x86/setup: merge several reservations of start of the memory arch/x86/kernel/setup.c | 96 ++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 54 deletions(-) --=20 2.28.0