From nobody Thu Apr 25 01:02:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1631612496; cv=none; d=zohomail.com; s=zohoarc; b=iRcgin5+lvcEFoupI7esCmdX7ufQNRcyiZHTfLixra5w8rQs3LaIZ+K1+6OdjJMDj1zOi79CEgArCRxlDKvkqSnwEgPvD2qtGWi0/fMM59SXNwFY6e8DC4LHqivAcHKySDC2Zpe+UIK7UJuECIndQbN0Jk0RZyT7QDGLY88jGIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631612496; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=30u9QxljtHQChxZ06/YlGhJs1iq5r8Bx3qVFUI1IaBI=; b=W6NCChUQOHB32cy5yYvJuA3YqnUOGGqVvp6xcxhWLHgpvctGrRdEqxqtaKJNla00MUyc4trrWq24WIePR0qG+wkRpuCgjoIp/D70WchHKw5YDLlspipLoQvd5swK3SQZ1wDDGIL8PwKFidHEMuYwYAEP01d8UZ8SSWpdqQzB+Q8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1631612496386150.5384879727959; Tue, 14 Sep 2021 02:41:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.186351.335077 (Exim 4.92) (envelope-from ) id 1mQ4wG-0004jq-C0; Tue, 14 Sep 2021 09:41:16 +0000 Received: by outflank-mailman (output) from mailman id 186351.335077; Tue, 14 Sep 2021 09:41:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mQ4wG-0004jj-99; Tue, 14 Sep 2021 09:41:16 +0000 Received: by outflank-mailman (input) for mailman id 186351; Tue, 14 Sep 2021 09:41:15 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mQ4wF-0004jc-J6 for xen-devel@lists.xenproject.org; Tue, 14 Sep 2021 09:41:15 +0000 Received: from smtp-out1.suse.de (unknown [195.135.220.28]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9b130ae0-b80e-4de6-90fe-18fb070c4870; Tue, 14 Sep 2021 09:41:13 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AF5EA220CC; Tue, 14 Sep 2021 09:41:12 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 61C0313E55; Tue, 14 Sep 2021 09:41:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1VE8FjhuQGFuSwAAMHmgww (envelope-from ); Tue, 14 Sep 2021 09:41:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9b130ae0-b80e-4de6-90fe-18fb070c4870 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1631612472; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=30u9QxljtHQChxZ06/YlGhJs1iq5r8Bx3qVFUI1IaBI=; b=iyMgnQgHJFFJjFjFAPR5PynTg/uuBNPUBW7HSkJDvAHUqb2vI8NVwufZ9B8pw1W8RwbV21 sY9ZPbqzyYgOU8rd59OHmzpkABuHi4r4SbS2XZaPS0OidXTQJHOpHEsK3oqq72VAHugVPv X+5HfzQQuA8wHQ0cTH5y8G4eeOVFOdw= From: Juergen Gross To: xen-devel@lists.xenproject.org, x86@kernel.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , stable@vger.kernel.org, =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Subject: [PATCH] x86/setup: call early_reserve_memory() earlier Date: Tue, 14 Sep 2021 11:41:08 +0200 Message-Id: <20210914094108.22482-1-jgross@suse.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1631612498807100001 Commit a799c2bd29d19c565 ("x86/setup: Consolidate early memory reservations") introduced early_reserve_memory() to do all needed initial memblock_reserve() calls in one function. Unfortunately the call of early_reserve_memory() is done too late for Xen dom0, as in some cases a Xen hook called by e820__memory_setup() will need those memory reservations to have happened already. Move the call of early_reserve_memory() to the beginning of setup_arch() in order to avoid such problems. Cc: stable@vger.kernel.org Fixes: a799c2bd29d19c565 ("x86/setup: Consolidate early memory reservations= ") Reported-by: Marek Marczykowski-G=C3=B3recki Signed-off-by: Juergen Gross Acked-by: Mike Rapoport Tested-by: Marek Marczykowski-G=C3=B3recki --- arch/x86/kernel/setup.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 79f164141116..f369c51ec580 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -757,6 +757,18 @@ dump_kernel_offset(struct notifier_block *self, unsign= ed long v, void *p) =20 void __init setup_arch(char **cmdline_p) { + /* + * Do some memory reservations *before* memory is added to + * memblock, so memblock allocations won't overwrite it. + * Do it after early param, so we could get (unlikely) panic from + * serial. + * + * After this point everything still needed from the boot loader or + * firmware or kernel text should be early reserved or marked not + * RAM in e820. All other memory is free game. + */ + early_reserve_memory(); + #ifdef CONFIG_X86_32 memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); =20 @@ -876,18 +888,6 @@ void __init setup_arch(char **cmdline_p) =20 parse_early_param(); =20 - /* - * Do some memory reservations *before* memory is added to - * memblock, so memblock allocations won't overwrite it. - * Do it after early param, so we could get (unlikely) panic from - * serial. - * - * After this point everything still needed from the boot loader or - * firmware or kernel text should be early reserved or marked not - * RAM in e820. All other memory is free game. - */ - early_reserve_memory(); - #ifdef CONFIG_MEMORY_HOTPLUG /* * Memory used by the kernel cannot be hot-removed because Linux --=20 2.26.2