From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.14687.1674047468695245680 for ; Wed, 18 Jan 2023 05:11:08 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gYp+6PYJ; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D7712617DA for ; Wed, 18 Jan 2023 13:11:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E8FDC43396 for ; Wed, 18 Jan 2023 13:11:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674047467; bh=vQmy68QL0AqhEz9hGpLkw+TmyNkBhRUVFKJV+vmsOag=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=gYp+6PYJb6341+7D88ubwabslN1RY+u+P+O/WuKCLOJD0fl2F2Zt9xL9qoKqEiZ+H Sg6Uan0K0i0NU47CCz/EW9/zzB7f0lhsDwZ+Nh12+sb4yMg6TCOp8t9lPxutMYvvlY Tk0PCvn3tHLHJUR0hbdZyXjf03xdtLf+XnbJqxk3Z/JhZKZpaBBXRcRIzLAhU2fkzL FjV230SPTeldShnPbZL9ua9AB3jEFnHDVYga5/JBEynQVwFTBDAhBuX05Jn6uUafFQ QLRfG/vdf56pVbTeUJJwLEgojUKnUnsDQJ2JAHakYuHRn5lYUZYjZucGfH/jpUxZea jKAg6qMT/zpgQ== Received: by mail-lf1-f49.google.com with SMTP id x40so6572603lfu.12 for ; Wed, 18 Jan 2023 05:11:07 -0800 (PST) X-Gm-Message-State: AFqh2koiFQZOe9l9zp1heyQxT3KAEPe2a4QWEBqARYkpWbCOGJc63C6J eX3E1Z1BDnNH2qiZsq3aO468ROeLT2nkY8ZZ+3A= X-Google-Smtp-Source: AMrXdXs7+l/ibbOdzQUj3zEpXLW+BDqSALFgbO7hpiArMjrjadnI519qDBKcXgcVs7w1Gi2T8JX3XsQbIiNUtZPoO6c= X-Received: by 2002:ac2:5dd4:0:b0:4b5:964d:49a4 with SMTP id x20-20020ac25dd4000000b004b5964d49a4mr587770lfq.637.1674047465244; Wed, 18 Jan 2023 05:11:05 -0800 (PST) MIME-Version: 1.0 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> <7c15856d-d09c-092d-e8c8-6f5eab27182e@redhat.com> In-Reply-To: <7c15856d-d09c-092d-e8c8-6f5eab27182e@redhat.com> From: "Ard Biesheuvel" Date: Wed, 18 Jan 2023 14:10:53 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH v2] OvmfPkg/PlatformInitLib: catch QEMU's CPU hotplug reg block regression To: devel@edk2.groups.io, lersek@redhat.com Cc: Gerd Hoffmann , Michael Brown , Ard Biesheuvel , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Jordan Justen , Min Xu , Oliver Steffen , Sebastien Boeuf , Tom Lendacky Content-Type: text/plain; charset="UTF-8" On Wed, 18 Jan 2023 at 12:50, Laszlo Ersek wrote: > > 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*". > You mean the kind of fw_cfg vairiable that is arbitrarily settable from the QEMU command line, right? Yeah, that would at least provide a way out.