From: "Laszlo Ersek" <lersek@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Ard Biesheuvel <ardb@kernel.org>,
devel@edk2.groups.io, Michael Brown <mcb30@ipxe.org>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Brijesh Singh <brijesh.singh@amd.com>,
Erdem Aktas <erdemaktas@google.com>,
James Bottomley <jejb@linux.ibm.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Jordan Justen <jordan.l.justen@intel.com>,
Min Xu <min.m.xu@intel.com>, Oliver Steffen <osteffen@redhat.com>,
Sebastien Boeuf <sebastien.boeuf@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [edk2-devel] [PATCH v2] OvmfPkg/PlatformInitLib: catch QEMU's CPU hotplug reg block regression
Date: Wed, 18 Jan 2023 14:25:10 +0100 [thread overview]
Message-ID: <37568c75-2a5d-4cba-a798-c7f6b6c92b3d@redhat.com> (raw)
In-Reply-To: <20230118131044.2rtb2wmb77qcbb4q@sirius.home.kraxel.org>
On 1/18/23 14:10, Gerd Hoffmann wrote:
> Hi,
>
>> ... you could introduce a new fw_cfg boolean switch (and explain it in
>> the hang message) that meant: "I know what this QEMU bug is, I
>> understand its consequences are obscure, risky, and far-reaching in
>> OVMF, I've been warned, I know what I'm doing". That's a relatively
>> small addition to this patch, and then the risk is assumed by the user.
>> It resolves "being out of luck *entirely*".
>
> Using -fw_cfg would work on old qemu versions indeed.
>
> take care,
> Gerd
>
> From 65a4f683eaf94f82693811ce9b2393586a15afd7 Mon Sep 17 00:00:00 2001
> From: Gerd Hoffmann <kraxel@redhat.com>
> Date: Fri, 13 Jan 2023 13:07:36 +0100
> Subject: [PATCH 1/1] OvmfPkg/PlatformInitLib: add switch to disable cpu
> hotplug support.
>
> Add a fw_cfg-based switch to disable cpu hotplug support in OVMF.
> This allows to boot OVMF on known-broken qemu versions.
>
> This is only safe to do in case hotplug is not used. Taking care
> of that is left to the user.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> OvmfPkg/Library/PlatformInitLib/Platform.c | 30 ++++++++++++++++++++--
> 1 file changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/PlatformInitLib/Platform.c
> index c3d5f5eeb375..15811a4ff726 100644
> --- a/OvmfPkg/Library/PlatformInitLib/Platform.c
> +++ b/OvmfPkg/Library/PlatformInitLib/Platform.c
> @@ -414,8 +414,12 @@ PlatformMaxCpuCountInitialization (
> IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
> )
> {
> - UINT16 BootCpuCount = 0;
> - UINT32 MaxCpuCount;
> + FIRMWARE_CONFIG_ITEM SupportedFeaturesItem;
> + UINTN SupportedFeaturesSize;
> + EFI_STATUS Status;
> + UINT16 BootCpuCount = 0;
> + UINT32 MaxCpuCount;
> + BOOLEAN CpuHotplugDisabled = FALSE;
>
> //
> // Try to fetch the boot CPU count.
> @@ -425,6 +429,15 @@ PlatformMaxCpuCountInitialization (
> BootCpuCount = QemuFwCfgRead16 ();
> }
>
> + Status = QemuFwCfgFindFile (
> + "opt/org.tianocore/nocpuhotplug",
> + &SupportedFeaturesItem,
> + &SupportedFeaturesSize
> + );
> + if (!EFI_ERROR (Status)) {
> + CpuHotplugDisabled = TRUE;
> + }
> +
> if (BootCpuCount == 0) {
> //
> // QEMU doesn't report the boot CPU count. (BootCpuCount == 0) will let
> @@ -434,6 +447,9 @@ PlatformMaxCpuCountInitialization (
> //
> DEBUG ((DEBUG_WARN, "%a: boot CPU count unavailable\n", __FUNCTION__));
> MaxCpuCount = PlatformInfoHob->DefaultMaxCpuNumber;
> + } else if (CpuHotplugDisabled) {
> + DEBUG ((DEBUG_INFO, "%a: CPU hotplug support disabled via opt/org.tianocore/nocpuhotplug\n", __FUNCTION__));
> + MaxCpuCount = BootCpuCount;
> } else {
> //
> // We will expose BootCpuCount to MpInitLib. MpInitLib will count APs up to
> @@ -563,12 +579,22 @@ PlatformMaxCpuCountInitialization (
> DEBUG_ERROR,
> "%a: Broken CPU hotplug register block: Present=%u Possible=%u.\n"
> "%a: Update QEMU to v8, or to stable with dab30fbef389 backported.\n"
> + "\n"
> + "%a: Alternatively start qemu with:\n"
> + "%a: -fw_cfg name=opt/org.tianocore/nocpuhotplug,string=1\n"
> + "%a: to disable OVMF cpu hotplug support. Note that you must\n"
> + "%a: not ask qemu to hotplug CPUs then\n"
> + "\n"
> "%a: Refer to "
> "<https://bugzilla.tianocore.org/show_bug.cgi?id=4250>.\n",
> __FUNCTION__,
> Present,
> Possible,
> __FUNCTION__,
> + __FUNCTION__,
> + __FUNCTION__,
> + __FUNCTION__,
> + __FUNCTION__,
> __FUNCTION__
> ));
> ASSERT (FALSE);
... let me post a v3 in this direction, later.
Thanks
Laszlo
next prev parent reply other threads:[~2023-01-18 13:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 8:28 [PATCH v2] OvmfPkg/PlatformInitLib: catch QEMU's CPU hotplug reg block regression Laszlo Ersek
2023-01-12 9:55 ` [edk2-devel] " Michael Brown
2023-01-12 10:09 ` Ard Biesheuvel
2023-01-12 13:31 ` Laszlo Ersek
2023-01-12 13:22 ` Laszlo Ersek
2023-01-12 16:08 ` Michael Brown
2023-01-12 17:58 ` Laszlo Ersek
2023-01-12 18:22 ` Laszlo Ersek
2023-01-12 22:49 ` Michael Brown
2023-01-13 6:03 ` Gerd Hoffmann
2023-01-13 9:32 ` Gerd Hoffmann
2023-01-13 10:10 ` Laszlo Ersek
2023-01-13 12:22 ` Gerd Hoffmann
2023-01-16 14:42 ` Ard Biesheuvel
2023-01-16 14:48 ` Laszlo Ersek
2023-01-17 12:37 ` Gerd Hoffmann
2023-01-17 16:43 ` Ard Biesheuvel
2023-01-18 7:25 ` Gerd Hoffmann
2023-01-18 11:50 ` Laszlo Ersek
2023-01-18 13:10 ` Gerd Hoffmann
2023-01-18 13:25 ` Laszlo Ersek [this message]
2023-01-18 13:10 ` Ard Biesheuvel
2023-01-18 13:21 ` Laszlo Ersek
2023-01-12 18:34 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37568c75-2a5d-4cba-a798-c7f6b6c92b3d@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox