Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp554181pxb; Tue, 14 Sep 2021 03:51:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx02tKlbbrC318AmMGLxDLugNPMtBcm9QoFbYUxyGv19lHsvPHXfYoBEXvUvP45kKAME6cT X-Received: by 2002:a05:6402:1157:: with SMTP id g23mr18472951edw.90.1631616701019; Tue, 14 Sep 2021 03:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631616701; cv=none; d=google.com; s=arc-20160816; b=Nr7pkGMcXnBxjnfB50rSqxmCxmQDCJrZF7eGVyEekbbdVhCUDu88EwthoKBmZx7eWe hSCAgipWZA2dtQ8WW7P4qFEf0WMirQKyShx6o41yForbziKnhdr08sB8opneXw3ZkSrf RHyBHp4VCZnD2AIPSbkmn2EcQyrOnI/OG8YeyKvcsnHSIABFQZK34s706ByxbZ0qnfsD YfvEntx/MMLSwULLnEp/FhMZ/zU9Our7640Gxq+DbjpwWv05EyjqNPgQgiDJxyZJ4sVy zUvDyGmkoMss/8rKpdR4o/DOpCs/Sa2oNTAA8CfviPl7NA4rWE3Mgwj57KfIqyUHy1Dr UnEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tHeJnF1k6ZyHrxR5t5ZIhno68yHo7xZ7224tLpR6g/I=; b=H75hJe9l39YW/X8a/jjtN9yuPumIq5hq0DCj+zGHa7OpL/uUJ+75yhPnXScx2PMirt Qnjc5JevkCnTVcTafjM0uoPTZlcf5GRJGSkC6N/hKRNm/B5iBbhYFAJnwd2w7AWFGbEb vcR7HKoDfGvbIufTso92B5GSeUG/P0wlQuxm15ugDtCa8/En2S7nT7urXrrfvdhIY3cs 6jcNfArVRA+dI+bo+NBvRhVRtoMy6zhbAbaU9TcyUq+6a7ZZuhUIambLr00okPIgAs5E BVJt0CNEZ4PixXOVppu8xXJSMwYixtMs6gfdcDYp/8GpRHbc4MN4yPQN5t3YDf+kSmnd bLmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=APRgfJAd; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u20si10281047edv.439.2021.09.14.03.51.16; Tue, 14 Sep 2021 03:51:41 -0700 (PDT) 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=@messagingengine.com header.s=fm3 header.b=APRgfJAd; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231794AbhINKuw (ORCPT + 99 others); Tue, 14 Sep 2021 06:50:52 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:60767 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230153AbhINKuu (ORCPT ); Tue, 14 Sep 2021 06:50:50 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 79C745C0212; Tue, 14 Sep 2021 06:49:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 14 Sep 2021 06:49:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=tHeJnF 1k6ZyHrxR5t5ZIhno68yHo7xZ7224tLpR6g/I=; b=APRgfJAdR+9vVcfDaslR2x 5+B8MflgQL6X4jjhWtV4ne9qsJmsiuX4sZmXojOFaqfhbI7CVfqShb8eN+U5V9Ta EZOEMFo0kLQwaqaOAWlaAJqcYZi0uL8t8QQZfTd++gkAyTKQI2H34KlCHnJys1mv 0L0l2l+p9qxg3ofLU2J6fV42fGlB1RB/kJl2qKJulO2baFkDiCTYxqcmu/PLIc5N xtuz61NqBziez18OaJJH6/YFBZGJzEuLTFrxzSuJNLdLg14DyugG7KUd8+RQznkX kbhU4v4ejXiozBECA+6tZfw7tJJaDj9blxxblKMjeBkiF+SL4D/KuOlvtmHqc+Fw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudegledgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeetveff iefghfekhffggeeffffhgeevieektedthfehveeiheeiiedtudegfeetffenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghrmhgrrhgvkhes ihhnvhhishhisghlvghthhhinhhgshhlrggsrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Sep 2021 06:49:30 -0400 (EDT) Date: Tue, 14 Sep 2021 12:49:27 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Juergen Gross Cc: xen-devel@lists.xenproject.org, x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , stable@vger.kernel.org Subject: Re: [PATCH] x86/setup: call early_reserve_memory() earlier Message-ID: References: <20210914094108.22482-1-jgross@suse.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ng3gYZ7HeyL14wKB" Content-Disposition: inline In-Reply-To: <20210914094108.22482-1-jgross@suse.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Ng3gYZ7HeyL14wKB Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Tue, 14 Sep 2021 12:49:27 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Juergen Gross Cc: xen-devel@lists.xenproject.org, x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , stable@vger.kernel.org Subject: Re: [PATCH] x86/setup: call early_reserve_memory() earlier On Tue, Sep 14, 2021 at 11:41:08AM +0200, Juergen Gross wrote: > 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. >=20 > Move the call of early_reserve_memory() to the beginning of > setup_arch() in order to avoid such problems. >=20 > Cc: stable@vger.kernel.org > Fixes: a799c2bd29d19c565 ("x86/setup: Consolidate early memory reservatio= ns") > Reported-by: Marek Marczykowski-G=C3=B3recki > Signed-off-by: Juergen Gross Thanks, it works! Tested-by: Marek Marczykowski-G=C3=B3recki > --- > arch/x86/kernel/setup.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) >=20 > 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, unsi= gned 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 >=20 --=20 Best Regards, Marek Marczykowski-G=C3=B3recki Invisible Things Lab --Ng3gYZ7HeyL14wKB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmFAfjcACgkQ24/THMrX 1yyiDAf/cbECScwjsEcDuWCxieb4bXydSDNTKkPbdFll3q6+HMw1aHcvhY/WBej7 xt4vOb/dbqLjRBSPH3w3vCVw8r2zGk8QjhojMNN/8uRqkDpax/KsutFiEs8XsfTC 3NME49YGNCXocNGHIVF79/PNZpKpPIHN40CA/B8r5/OqM6DEBKt9KNWDX7Z9fb/o s/NdqU/1hFWswunAL87hJ3e/XU8pu1mxP794sAq8XRCwBQjlKoBrdHDBF6QlLau8 Q2qx8U9y7sWNsf4hsGXkgcjLvy7R+zOCvzzXtF4m0SkueVPOm4ilUG4/65X+kcy5 3i+rBfYZ41Qb8csPFnFJOPud0tuTdQ== =mhfL -----END PGP SIGNATURE----- --Ng3gYZ7HeyL14wKB--