From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.13285.1674042639044005678 for ; Wed, 18 Jan 2023 03:50:39 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VldqxClq; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674042638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iwXf8Pu3hjM/X627nlaNvR5KiQDK3tF7Mm094V2ikEM=; b=VldqxClqqe/RQybradZGrgz9CITDS61f7hYlAhu8j2Jpuw1CTWyp3g4L2m8Qwe8G5iFXht 2yhE0LdxHPzQ1vY8fEQ19Qer8hC8iL09PeJpZw4cANS1KwNIQz/0ezgAn/NPKYHBaWse8f 6DwLDDsrTzg3tjevJNiWM1z3vnq5AZU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-32-xFY4JP7HOOaJpBwAzB_-gQ-1; Wed, 18 Jan 2023 06:50:35 -0500 X-MC-Unique: xFY4JP7HOOaJpBwAzB_-gQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AA6C88A0106; Wed, 18 Jan 2023 11:50:34 +0000 (UTC) Received: from [10.39.192.131] (unknown [10.39.192.131]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BE98340C2064; Wed, 18 Jan 2023 11:50:31 +0000 (UTC) Message-ID: <7c15856d-d09c-092d-e8c8-6f5eab27182e@redhat.com> Date: Wed, 18 Jan 2023 12:50:30 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v2] OvmfPkg/PlatformInitLib: catch QEMU's CPU hotplug reg block regression To: Gerd Hoffmann , Ard Biesheuvel Cc: devel@edk2.groups.io, Michael Brown , Ard Biesheuvel , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Jordan Justen , Min Xu , Oliver Steffen , Sebastien Boeuf , Tom Lendacky References: <407c5cee-7a6c-cbc8-35cc-8f2c2724914c@redhat.com> <01020185a6bda78a-05d82180-4d1a-4af4-9a9b-ac78088d11ed-000000@eu-west-1.amazonses.com> <49e4e8bb-3bbd-0ca8-ee59-e75560deffa7@redhat.com> <20230113060354.siony3rjwpgzd5tk@sirius.home.kraxel.org> <20230113093205.oh7euprqlmp26wpu@sirius.home.kraxel.org> <20230113122246.uabdhut4ziwerivm@sirius.home.kraxel.org> <9141ad66-f868-762c-7ea5-d88753466fa6@redhat.com> <20230117123700.ntg5fk7a3ggr2xyo@sirius.home.kraxel.org> <20230118072525.cnk5ysqcnvdyeqow@sirius.home.kraxel.org> From: "Laszlo Ersek" In-Reply-To: <20230118072525.cnk5ysqcnvdyeqow@sirius.home.kraxel.org> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/18/23 08:25, Gerd Hoffmann wrote: > On Tue, Jan 17, 2023 at 05:43:53PM +0100, Ard Biesheuvel wrote: >> On Tue, 17 Jan 2023 at 13:37, Gerd Hoffmann wrote: >>> >>> Hi, >>> >>>>>> In particular the firmware makes no further decisions based on >>>>>> whether QEMU advertized some of these features. >>>>> >>>>> I was thinking the other way around: When cpu hotplug is disabled in >>>>> qemu it should be safe to skip the whole cpu hotplug checking dance. >>>>> See test patch below. >>>>> >>>>> That would give us a config switch (turn off cpu hotplug support) >>>>> which would allow edk2 run on qemu versions with broken cpu hotplug. >>>>> >>>>> Does the idea look sane or do I miss something? >>> >>>> This would be wrong. >>>> >>>> [ detailed description snipped here (but stored for later reference, >>>> thanks for all the details) ] >>> >>> So, the tl;dr version: cpu hotplug is older than smi feature >>> negotiation, so smi hotplug feature bit being off doesn't imply >>> qemu wouldn't hotplug cpus. >>> >>> So, no easy way out. Luckily this affects tcg only. >>> >>> For edk2 ci doing (tcg) efi shell test boots switching to Oliver's >>> latest containers with fixed qemu included should handle things >>> (latest series just posted). So once this is in we should be able to >>> merge this patch without breaking CI. >> >> My head is spinning. >> >> What about running QEMU with only a single CPU, and without any of >> these features? Is there really no way we can make that work without >> turning OVMF into the timebomb that Laszlo describes? > > I can't see any way :( > > ovmf seeing only a single cpu does not imply cpu hotplug can't happen, > it could be "qemu -smp cpus=1,maxcpus=4". Figuring the maxcpus number > depends on the broken cpu hotplug registers. > >> It's just very annoying that on a non-KVM host and a given QEMU >> binary, you might simply be out of luck entirely, and there is no way >> you can run OVMF with the fix applied. I would like to avoid that if >> possible. > > Indeed. ... 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*". Laszlo