From patchwork Tue Mar 2 10:04:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 12111331 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 EE12BC433DB for ; Tue, 2 Mar 2021 10:04:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 754D164F0A for ; Tue, 2 Mar 2021 10:04:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 754D164F0A 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 EC3508D00F6; Tue, 2 Mar 2021 05:04:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E4D848D0063; Tue, 2 Mar 2021 05:04:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC6848D00F6; Tue, 2 Mar 2021 05:04:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id B0F578D0063 for ; Tue, 2 Mar 2021 05:04:24 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 75899180AD80F for ; Tue, 2 Mar 2021 10:04:24 +0000 (UTC) X-FDA: 77874499248.30.5F9BE88 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf26.hostedemail.com (Postfix) with ESMTP id 635894080F51 for ; Tue, 2 Mar 2021 10:04:23 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D14FB64F12; Tue, 2 Mar 2021 10:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614679461; bh=F7EFwzdiJGCuUJUM4rhmyuct8ZJs4bkPmXvvBTimuS4=; h=From:To:Cc:Subject:Date:From; b=eWQYvRA+/QbPaWtGg12DWWxHmts3dBQRib7AsddTMsqcEAwURGHsaHiGDP6KI+3ln OVdUKwOsJlf0nMX/97t7gPDyhRmnTP+933CyJGhHS+W0pdIwtRD0+t8y+/9bXaxK6S 3tF3HSpnXyOaZngWyd/Vum4UDv5Wx4usuYHMep4bytRtl5eNXrp52nftzv+cUBmBkv iOVde5WikU6HpKF7Qz7M9KW4wWl9A/R6uXRjkXp/vA8Bf5HiapCfMEXuEcqQkx1AIU FHvIs/gc+16X65JroeDchcU/j2sxxEKSFFRFXKbpSqHHxt4EdmDBYjt/EDXPQs6fVd qnpAUjW3GIMew== From: Mike Rapoport To: x86@kernel.org Cc: Andrew Morton , 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 Subject: [PATCH v3 0/2] x86/setup: consolidate early memory reservations Date: Tue, 2 Mar 2021 12:04:04 +0200 Message-Id: <20210302100406.22059-1-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 635894080F51 X-Stat-Signature: xaq89tcytzrtesrjmutj7r33u8drm3p1 Received-SPF: none (kernel.org>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614679463-626676 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 allocations are possible: https://lore.kernel.org/lkml/6ba6bde3-1520-5cd0-f987-32d543f0b79f@redhat.com The below patches consolidate early memory reservations done during setup_arch() so that memory used by firmware, bootloader, kernel text/data and the memory that should be excluded from the available memory for whatever other reason is reserved before memblock allocations are possible. The patches are rebased on v5.12-rc1 and I think x86 tree is the best way to merge them. v3: * rebase on v5.12-rc1 v2: https://lore.kernel.org/lkml/20210128105711.10428-1-rppt@kernel.org * 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 | 95 ++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 49 deletions(-) Acked-by: David Hildenbrand