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.129.124]) by mx.groups.io with SMTP id smtpd.web10.54541.1673529782067759966 for ; Thu, 12 Jan 2023 05:23:02 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HJkVz1ls; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673529781; 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=cnBrzaXAmh0uFJaNwNriiOXyqkpT0WOk7HZWXcfxHz8=; b=HJkVz1lsZIhRYEb9IgPaJ7RornpuA/Ze3zTYyXw66z/64tlxELLtLET75D6E6M9KsKHCXn gnw3hQCrSlfCrT3JrzUPt4a8AizZ6t+HIcisVijKyqIKBsm+tWasa46tQMfWfuRBLksZen BxHEsvnrAYrXmpnkPEWdMYJ4S/CXa+A= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-187-Jy1Z24M0NLOs_mOmuHlSDg-1; Thu, 12 Jan 2023 08:22:58 -0500 X-MC-Unique: Jy1Z24M0NLOs_mOmuHlSDg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 578F53C1023A; Thu, 12 Jan 2023 13:22:57 +0000 (UTC) Received: from [10.39.192.93] (unknown [10.39.192.93]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 014BF140EBF6; Thu, 12 Jan 2023 13:22:54 +0000 (UTC) Message-ID: <407c5cee-7a6c-cbc8-35cc-8f2c2724914c@redhat.com> Date: Thu, 12 Jan 2023 14:22:53 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v2] OvmfPkg/PlatformInitLib: catch QEMU's CPU hotplug reg block regression To: Michael Brown , devel@edk2.groups.io Cc: Ard Biesheuvel , Brijesh Singh , Erdem Aktas , Gerd Hoffmann , James Bottomley , Jiewen Yao , Jordan Justen , Min Xu , Oliver Steffen , Sebastien Boeuf , Tom Lendacky References: <20230112082845.128463-1-lersek@redhat.com> <01020185a568604c-e16d8581-963a-4ff3-8566-bf0640ad327d-000000@eu-west-1.amazonses.com> From: "Laszlo Ersek" In-Reply-To: <01020185a568604c-e16d8581-963a-4ff3-8566-bf0640ad327d-000000@eu-west-1.amazonses.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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/12/23 10:55, Michael Brown wrote: > On 12/01/2023 08:28, Laszlo Ersek wrote: >> In QEMU v5.1.0, the CPU hotplug register block misbehaves: the >> negotiation >> protocol is (effectively) broken such that it suggests that switching >> from >> the legacy interface to the modern interface works, but in reality the >> switch never happens. The symptom has been witnessed when using TCG >> acceleration; KVM seems to mask the issue. The issue persists with the >> following (latest) stable QEMU releases: v5.2.0, v6.2.0, v7.2.0. >> Currently >> there is no stable release that addresses the problem. >> >> The QEMU bug confuses the Present and Possible counting in function >> PlatformMaxCpuCountInitialization(), in >> "OvmfPkg/Library/PlatformInitLib/Platform.c". OVMF ends up with Present=0 >> Possible=1. This in turn further confuses MpInitLib in UefiCpuPkg (hence >> firmware-time multiprocessing will be broken). Worse, CPU hot(un)plug >> with >> SMI will be summarily broken in OvmfPkg/CpuHotplugSmm, which (considering >> the privilege level of SMM) is not that great. >> >> Detect the issue in PlatformMaxCpuCountInitialization(), and print an >> error message and *hang* if the issue is present. > > Would this mean that OVMF would refuse to start with all current distro > versions of qemu (when not using KVM), or am I misunderstanding? Your understanding is correct. I'm not in a rush to get this merged, but eventually, it should be. On qemu-devel, I asked for the fix to be applied to all stable branches starting with v5.*. I'm not sure how far "back" qemu-stable is maintained though. Laszlo