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 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97C33C433F5 for ; Wed, 9 Feb 2022 15:20:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.269307.463358 (Exim 4.92) (envelope-from ) id 1nHolf-0003WV-SA; Wed, 09 Feb 2022 15:20:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 269307.463358; Wed, 09 Feb 2022 15:20:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nHolf-0003WO-PA; Wed, 09 Feb 2022 15:20:27 +0000 Received: by outflank-mailman (input) for mailman id 269307; Wed, 09 Feb 2022 15:20:26 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nHole-0003QJ-R9 for xen-devel@lists.xenproject.org; Wed, 09 Feb 2022 15:20:26 +0000 Received: from smtp1.irit.fr (smtp1.irit.fr [141.115.24.2]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ce0110a5-89bb-11ec-8eb8-a37418f5ba1a; Wed, 09 Feb 2022 16:20:25 +0100 (CET) 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: ce0110a5-89bb-11ec-8eb8-a37418f5ba1a From: To: "'Jan Beulich'" Cc: References: <20220209131251.387-1-dinhngoc.tu@irit.fr> In-Reply-To: Subject: RE: [PATCH v2] x86: Use low memory size directly from Multiboot Date: Wed, 9 Feb 2022 16:20:23 +0100 Message-ID: <000801d81dc8$8f15b9a0$ad412ce0$@irit.fr> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Thread-Index: AQIgBme26ChWP5n2WBO9OQe2xD3DKQHRtGxLAKyTMs2r54lCAA== Content-Language: en > -----Original Message----- > From: Jan Beulich > Sent: Wednesday, 9 February 2022 15:26 > To: Tu Dinh Ngoc > Cc: xen-devel@lists.xenproject.org > Subject: Re: [PATCH v2] x86: Use low memory size directly from = Multiboot >=20 > On 09.02.2022 14:12, Tu Dinh Ngoc wrote: > > Previously, Xen used information from the BDA to detect the amount = of > > available low memory. This does not work on some scenarios such as > > Coreboot, or when booting from Kexec on a UEFI system without CSM. > > > > Use the information directly supplied by Multiboot boot information > > instead. > > --- >=20 > Btw - please summarize here briefly what has changed from the earlier > version. As it stands your adjustment looks to take care of one third = of what I > did say in reply to your v1. That's not enough for a v2, or else you = should have > taken care of the remaining aspects verbally. >=20 > Jan Hi, > The comment here is a pretty clear indication that bad values may have = been observed, even if this was only in the distant past. But we have to = not regress even on very old boot loaders. > Is the kexec case recognizable by any means (including to distinguish = kexec properly communicating the value vs it not doing so, as iirc it = was said on irc that this didn't always work correctly there), such that = we could skip using the BDA value in that case? As written in the comments, old versions of kexec (before 2.0.23) = presented the amount of lower and upper memory in the BASIC_MEMINFO = Multiboot2 tag in bytes instead of kilobytes. The v2 patch tries to = detect this condition by checking if there's more than 640 KB of low = memory and corrects the low memory size in that case. This change should only affect the particular case of booting with = Multiboot2 without EFI (e.g. legacy BIOS or Kexec). Other cases like = Multiboot 0.x, EFI booting (with or without MB2), or bootloaders that = generate the BASIC_MEMINFO tag correctly shouldn't be affected.