Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2381915pxb; Mon, 20 Sep 2021 20:51:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwW3rzdo/jSY16ivwQN3Zhs7eKiMI7xgMIF7WP2IzeTD2nljNZNpsY8uCIQL0n0Dv0brKW9 X-Received: by 2002:aa7:d619:: with SMTP id c25mr32891034edr.365.1632196315428; Mon, 20 Sep 2021 20:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632196315; cv=none; d=google.com; s=arc-20160816; b=lgB480oDc9Hf9if+HaAueI/JDn/85n8D5tquB4+8AwpBBUa+pcPGJOcCPygc9Z+jkq Rk7aPFGrgxLaSXeW2uhwSjFY/iCiKvwWCT+/dLniPUKU9qXDDG9hMAuwq0yv0E2wCv2Q OmRS883EJyr2gQTam22eSgao3/zWWYw+Mi9FG7oeOddGLiP1sWveBvWYTUAuNuxPW3O6 2u8CM1SBfVmbG7aJ6El4lFwD71ur/gDVezm7sn84J+XRe++j/9iGu6/0mnM9dAlA5Ud0 y2QqmlYqWYCdnyMwIOgVbop0/az9YmPD3MxoJKBjLIU2sjOnlRgpDRLrH36KohsWs8P9 w6JA== 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=elddKdD4BPQ0M+cJwTBaZFkbiRuFjkdQnumS8prRBsE=; b=NCkbETkEYae+a2Xcl/0m46t6rjBAwXX3IfIiJXiPwwrXz7Ngw4oXg41uKie7ZcNV0+ gsD2Zg3ToPMELD7NfcYlAV3clywKdaMlXo841ONCl6JQqVi0vrJSw7zsSFmTOurSKj1S UX44NJzQkBHzjugukPmbXU+UwRrtrI1o6A8o7d2Q5GzdPkrJU889v34dZdyLDbplKoOW dGeQ11Kd4ELfS5o80N52rpRQYZLy4XH7Voo+oXcOOgu9r01RmzqfWOUH4sUdG2Y77DQN cKqpwgut1nHjQ/dHj5WS9CCM1tSrk4KNa6hQAvfpAYl8RGzn3anfPnAIsOScrKGKXyY3 T1SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=v4Pz4Ctd; 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 bf15si18760687edb.235.2021.09.20.20.51.32; Mon, 20 Sep 2021 20:51:55 -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=v4Pz4Ctd; 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 S1344248AbhIUAFG (ORCPT + 99 others); Mon, 20 Sep 2021 20:05:06 -0400 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:37653 "EHLO wout4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239789AbhIUADF (ORCPT ); Mon, 20 Sep 2021 20:03:05 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id B964E3200B5E; Mon, 20 Sep 2021 20:01:35 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 20 Sep 2021 20:01:36 -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=elddKd D4BPQ0M+cJwTBaZFkbiRuFjkdQnumS8prRBsE=; b=v4Pz4Ctd6lSYg77kUzC3vv 7tV7NeWPWhYBvJW48B09tcF4tugDz/Q+ZL+eUMY4wUKYpSahhf4SmJiONTv+ChOu +QhIvU3VLWYZgEExcs5GM2X1R9AN7gCk7WXert82s1zszvgsRPCutKL9jy1KBQvT OmbY1FSiaMiDqetNLHe2igFwMm4RXDkwPy9XaA8CWOHyorBi2bIf/MrmGb0gnkxo ZxDJHXCk2CS1JSUpHnTemx4vSwkxvUE+y6lVJMMrNwkhlxGsRfAqcrxDj/LPntJG yQEV2CWKxf7aNQIuoGIO05HQmhxlj42o6zLNCHnMDwfWB62nvMmK0E6TIjOzvFkA == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudeifedgvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeetveff iefghfekhffggeeffffhgeevieektedthfehveeiheeiiedtudegfeetffenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghrmhgrrhgvkhes ihhnvhhishhisghlvghthhhinhhgshhlrggsrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 20 Sep 2021 20:01:32 -0400 (EDT) Date: Tue, 21 Sep 2021 02:01:28 +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, efault@gmx.de, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , stable@vger.kernel.org Subject: Re: [PATCH v2] x86/setup: call early_reserve_memory() earlier Message-ID: References: <20210920120421.29276-1-jgross@suse.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aUPRBE57vyxN5AhB" Content-Disposition: inline In-Reply-To: <20210920120421.29276-1-jgross@suse.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --aUPRBE57vyxN5AhB Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Tue, 21 Sep 2021 02:01:28 +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, efault@gmx.de, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , stable@vger.kernel.org Subject: Re: [PATCH v2] x86/setup: call early_reserve_memory() earlier On Mon, Sep 20, 2021 at 02:04:21PM +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() before the call of > e820__memory_setup() 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 I confirm this fixes my boot issue too. Tested-by: Marek Marczykowski-G=C3=B3recki > --- > V2: > - update comment (Jan Beulich, Boris Petkov) > - move call down in setup_arch() (Mike Galbraith) > --- > arch/x86/kernel/setup.c | 26 ++++++++++++++------------ > 1 file changed, 14 insertions(+), 12 deletions(-) >=20 > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > index 79f164141116..40ed44ead063 100644 > --- a/arch/x86/kernel/setup.c > +++ b/arch/x86/kernel/setup.c > @@ -830,6 +830,20 @@ void __init setup_arch(char **cmdline_p) > =20 > x86_init.oem.arch_setup(); > =20 > + /* > + * Do some memory reservations *before* memory is added to memblock, so > + * memblock allocations won't overwrite it. > + * > + * 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. > + * > + * This call needs to happen before e820__memory_setup() which calls the > + * xen_memory_setup() on Xen dom0 which relies on the fact that those > + * early reservations have happened already. > + */ > + early_reserve_memory(); > + > iomem_resource.end =3D (1ULL << boot_cpu_data.x86_phys_bits) - 1; > e820__memory_setup(); > parse_setup_data(); > @@ -876,18 +890,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 --aUPRBE57vyxN5AhB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmFJINkACgkQ24/THMrX 1yxeEgf+OTiRexZli2dhF3IwJBnJzNUlMY1c9IGqgKF1TZ0LZafQLFWuvFG0sN8Q U+Cla7L/0wYCu+M3TLT502GYcD2B1xbA2IdugAVXCgShZoRqHPE4tiF7+UuUb1jo DvroNdgMPgPelkQvexh/OG2XMrSwEjalNV+WH9axOAOlUC0p8ji+7DRhZX9au6fV qQrjeOfxipfe2XL8RC8ED8dXx7c+xYzpTyphfzhdAwGwMHWpAjzmuHqbGIN2V/IP xLNETBqQfk+M2VjVPihda8RFue3V/nc4fVL+e5X/EkSW24WC0+5h/U2U1cy0HKqI 8nwCQvL/CmtUZPZbZJCrQ6mM+rob7w== =Cn+N -----END PGP SIGNATURE----- --aUPRBE57vyxN5AhB--