[edk2-devel] [PATCH 0/4] UefiCpuPkg, OvmfPkg: separate PCDs for boot CPU count vs. max CPU count

Laszlo Ersek posted 4 patches 4 years, 6 months ago
Failed in applying to current master (apply log)
OvmfPkg/Include/IndustryStandard/QemuFwCfg.h  | 22 ++++++
OvmfPkg/OvmfPkgIa32.dsc                       |  2 +-
OvmfPkg/OvmfPkgIa32X64.dsc                    |  2 +-
OvmfPkg/OvmfPkgX64.dsc                        |  2 +-
OvmfPkg/OvmfXen.dsc                           |  4 -
OvmfPkg/PlatformPei/Platform.c                | 83 +++++++++++++-------
OvmfPkg/PlatformPei/PlatformPei.inf           |  2 +-
UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf |  1 +
UefiCpuPkg/Library/MpInitLib/MpLib.c          | 42 ++++++----
UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf |  3 +-
UefiCpuPkg/UefiCpuPkg.dec                     | 11 +++
UefiCpuPkg/UefiCpuPkg.uni                     |  4 +
12 files changed, 125 insertions(+), 53 deletions(-)
[edk2-devel] [PATCH 0/4] UefiCpuPkg, OvmfPkg: separate PCDs for boot CPU count vs. max CPU count
Posted by Laszlo Ersek 4 years, 6 months ago
Repo:   https://github.com/lersek/edk2.git
Branch: max_cpus_bz_1515
Ref:    https://bugzilla.tianocore.org/show_bug.cgi?id=1515

UefiCpuPkg/MpInitLib currently lacks support for the following use case:

- time-limited AP enumeration is not reliable on the platform
  (individual AP check-in may take arbitrarily long), and

- APs may finish the wakeup routine, and report in to the BSP, in any
  sequence whatsoever, and

- the number of boot CPUs (which is known in advance) is strictly less
  than the number of maximum CPUs (which is also known in advance).

In the above case, the platform cannot tell UefiCpuPkg/MpInitLib to wait
exactly until all boot APs check in. That is, the platform can't request
that the AP enumeration never time out, but also not wait for too long.

For supporting this use case, the patch series introduces
PcdCpuBootLogicalProcessorNumber to UefiCpuPkg, and makes MpInitLib wait
for exactly that many CPUs (= BSP + APs) to show up during CPU
enumeration.

Working towards VCPU hotplug with OVMF, OvmfPkg/PlatformPei fetches both
the boot and the max CPU counts from QEMU, co-operating with the
following QEMU patch set:

  [qemu-devel] [PATCH 0/4] hw/i386: pass "MachineState.smp.max_cpus" to OVMF
  http://mid.mail-archive.com/20191008105259.5378-1-lersek@redhat.com

and passes them to UefiCpuPkg via PcdCpuBootLogicalProcessorNumber and
PcdCpuMaxLogicalProcessorNumber.

As a result, PcdCpuApInitTimeOutInMicroSeconds becomes irrelevant for,
and unused by, OVMF -- time-limited AP enumeration is never going to be
used.

When OVMF is built with -D SMM_REQUIRE, this patch series is just a
small building block, towards the full VCPU hotplug feature. However,
when OVMF is built without -D SMM_REQUIRE, this series (together with
the counterpart patch set for QEMU) completes the VCPU hotplug feature:
it allows S3 resume to work with VCPUs hot-plugged previously (at OS
runtime, of course).

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Ray Ni <ray.ni@intel.com>

Thanks
Laszlo

Laszlo Ersek (4):
  UefiCpuPkg/MpInitLib: honor the platform's boot CPU count in AP
    detection
  OvmfPkg/OvmfXen.dsc: remove PcdCpu* dynamic defaults
  OvmfPkg/IndustryStandard: define FW_CFG_X86_TOPOLOGY structure type
  OvmfPkg/PlatformPei: rewrite MaxCpuCountInitialization() for CPU
    hotplug

 OvmfPkg/Include/IndustryStandard/QemuFwCfg.h  | 22 ++++++
 OvmfPkg/OvmfPkgIa32.dsc                       |  2 +-
 OvmfPkg/OvmfPkgIa32X64.dsc                    |  2 +-
 OvmfPkg/OvmfPkgX64.dsc                        |  2 +-
 OvmfPkg/OvmfXen.dsc                           |  4 -
 OvmfPkg/PlatformPei/Platform.c                | 83 +++++++++++++-------
 OvmfPkg/PlatformPei/PlatformPei.inf           |  2 +-
 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf |  1 +
 UefiCpuPkg/Library/MpInitLib/MpLib.c          | 42 ++++++----
 UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf |  3 +-
 UefiCpuPkg/UefiCpuPkg.dec                     | 11 +++
 UefiCpuPkg/UefiCpuPkg.uni                     |  4 +
 12 files changed, 125 insertions(+), 53 deletions(-)

-- 
2.19.1.3.g30247aa5d201


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48562): https://edk2.groups.io/g/devel/message/48562
Mute This Topic: https://groups.io/mt/34441227/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH 0/4] UefiCpuPkg, OvmfPkg: separate PCDs for boot CPU count vs. max CPU count
Posted by Ard Biesheuvel 4 years, 6 months ago
On Tue, 8 Oct 2019 at 13:27, Laszlo Ersek <lersek@redhat.com> wrote:
>
> Repo:   https://github.com/lersek/edk2.git
> Branch: max_cpus_bz_1515
> Ref:    https://bugzilla.tianocore.org/show_bug.cgi?id=1515
>
> UefiCpuPkg/MpInitLib currently lacks support for the following use case:
>
> - time-limited AP enumeration is not reliable on the platform
>   (individual AP check-in may take arbitrarily long), and
>
> - APs may finish the wakeup routine, and report in to the BSP, in any
>   sequence whatsoever, and
>
> - the number of boot CPUs (which is known in advance) is strictly less
>   than the number of maximum CPUs (which is also known in advance).
>
> In the above case, the platform cannot tell UefiCpuPkg/MpInitLib to wait
> exactly until all boot APs check in. That is, the platform can't request
> that the AP enumeration never time out, but also not wait for too long.
>
> For supporting this use case, the patch series introduces
> PcdCpuBootLogicalProcessorNumber to UefiCpuPkg, and makes MpInitLib wait
> for exactly that many CPUs (= BSP + APs) to show up during CPU
> enumeration.
>
> Working towards VCPU hotplug with OVMF, OvmfPkg/PlatformPei fetches both
> the boot and the max CPU counts from QEMU, co-operating with the
> following QEMU patch set:
>
>   [qemu-devel] [PATCH 0/4] hw/i386: pass "MachineState.smp.max_cpus" to OVMF
>   http://mid.mail-archive.com/20191008105259.5378-1-lersek@redhat.com
>
> and passes them to UefiCpuPkg via PcdCpuBootLogicalProcessorNumber and
> PcdCpuMaxLogicalProcessorNumber.
>
> As a result, PcdCpuApInitTimeOutInMicroSeconds becomes irrelevant for,
> and unused by, OVMF -- time-limited AP enumeration is never going to be
> used.
>
> When OVMF is built with -D SMM_REQUIRE, this patch series is just a
> small building block, towards the full VCPU hotplug feature. However,
> when OVMF is built without -D SMM_REQUIRE, this series (together with
> the counterpart patch set for QEMU) completes the VCPU hotplug feature:
> it allows S3 resume to work with VCPUs hot-plugged previously (at OS
> runtime, of course).
>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien.grall@arm.com>
> Cc: Ray Ni <ray.ni@intel.com>
>
> Thanks
> Laszlo
>
> Laszlo Ersek (4):
>   UefiCpuPkg/MpInitLib: honor the platform's boot CPU count in AP
>     detection

Assuming this ^^^ patch gets accepted by the maintainers,

>   OvmfPkg/OvmfXen.dsc: remove PcdCpu* dynamic defaults
>   OvmfPkg/IndustryStandard: define FW_CFG_X86_TOPOLOGY structure type
>   OvmfPkg/PlatformPei: rewrite MaxCpuCountInitialization() for CPU
>     hotplug
>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

for the OvmfPkg changes.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48567): https://edk2.groups.io/g/devel/message/48567
Mute This Topic: https://groups.io/mt/34441227/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH 0/4] UefiCpuPkg, OvmfPkg: separate PCDs for boot CPU count vs. max CPU count
Posted by Laszlo Ersek 4 years, 6 months ago
On 10/08/19 13:35, Ard Biesheuvel wrote:
> On Tue, 8 Oct 2019 at 13:27, Laszlo Ersek <lersek@redhat.com> wrote:
>>
>> Repo:   https://github.com/lersek/edk2.git
>> Branch: max_cpus_bz_1515
>> Ref:    https://bugzilla.tianocore.org/show_bug.cgi?id=1515
>>
>> UefiCpuPkg/MpInitLib currently lacks support for the following use case:
>>
>> - time-limited AP enumeration is not reliable on the platform
>>   (individual AP check-in may take arbitrarily long), and
>>
>> - APs may finish the wakeup routine, and report in to the BSP, in any
>>   sequence whatsoever, and
>>
>> - the number of boot CPUs (which is known in advance) is strictly less
>>   than the number of maximum CPUs (which is also known in advance).
>>
>> In the above case, the platform cannot tell UefiCpuPkg/MpInitLib to wait
>> exactly until all boot APs check in. That is, the platform can't request
>> that the AP enumeration never time out, but also not wait for too long.
>>
>> For supporting this use case, the patch series introduces
>> PcdCpuBootLogicalProcessorNumber to UefiCpuPkg, and makes MpInitLib wait
>> for exactly that many CPUs (= BSP + APs) to show up during CPU
>> enumeration.
>>
>> Working towards VCPU hotplug with OVMF, OvmfPkg/PlatformPei fetches both
>> the boot and the max CPU counts from QEMU, co-operating with the
>> following QEMU patch set:
>>
>>   [qemu-devel] [PATCH 0/4] hw/i386: pass "MachineState.smp.max_cpus" to OVMF
>>   http://mid.mail-archive.com/20191008105259.5378-1-lersek@redhat.com
>>
>> and passes them to UefiCpuPkg via PcdCpuBootLogicalProcessorNumber and
>> PcdCpuMaxLogicalProcessorNumber.
>>
>> As a result, PcdCpuApInitTimeOutInMicroSeconds becomes irrelevant for,
>> and unused by, OVMF -- time-limited AP enumeration is never going to be
>> used.
>>
>> When OVMF is built with -D SMM_REQUIRE, this patch series is just a
>> small building block, towards the full VCPU hotplug feature. However,
>> when OVMF is built without -D SMM_REQUIRE, this series (together with
>> the counterpart patch set for QEMU) completes the VCPU hotplug feature:
>> it allows S3 resume to work with VCPUs hot-plugged previously (at OS
>> runtime, of course).
>>
>> Cc: Anthony Perard <anthony.perard@citrix.com>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Cc: Igor Mammedov <imammedo@redhat.com>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Julien Grall <julien.grall@arm.com>
>> Cc: Ray Ni <ray.ni@intel.com>
>>
>> Thanks
>> Laszlo
>>
>> Laszlo Ersek (4):
>>   UefiCpuPkg/MpInitLib: honor the platform's boot CPU count in AP
>>     detection
> 
> Assuming this ^^^ patch gets accepted by the maintainers,
> 
>>   OvmfPkg/OvmfXen.dsc: remove PcdCpu* dynamic defaults
>>   OvmfPkg/IndustryStandard: define FW_CFG_X86_TOPOLOGY structure type
>>   OvmfPkg/PlatformPei: rewrite MaxCpuCountInitialization() for CPU
>>     hotplug
>>
> 
> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> for the OvmfPkg changes.
> 

Thanks!
Laszlo

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48603): https://edk2.groups.io/g/devel/message/48603
Mute This Topic: https://groups.io/mt/34441227/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-