[edk2-devel] [PATCH v9 00/10] support CPU hot-unplug

Laszlo Ersek lersek at redhat.com
Tue Mar 16 14:07:33 UTC 2021


On 03/12/21 07:26, Ankur Arora wrote:
> Hi,
>
> This series adds OVMF support for CPU hot-unplug.
>
> QEMU secureboot hot-unplug logic corresponding to this is in upstream.
> Also posted here:
>   https://lore.kernel.org/qemu-devel/20201207140739.3829993-1-imammedo@redhat.com/
>
> Testing (with QEMU 5.2.50):
>  - Stable with randomized CPU plug/unplug (guest maxcpus=33,128)
>  - Synthetic tests with simultaneous multi CPU hot-unplug
>
> Also at:
>   github.com/terminus/edk2/ hot-unplug-v9
>
> Changelog:
>
> v9:
>   - Rebased on top of edd46cd407ea
>   - Clarify comments around memory-barriers in patches 7, 8, 9
>   - Address other review comments from v8

Merged as commit range 4751a48aeb2a..f3bdfc41866e, via
<https://github.com/tianocore/edk2/pull/1494>, with the following R-b's
/ comments / light tweaks added:

>  1:  4b4466ed7c44 =  1:  0cb242e33693 OvmfPkg/CpuHotplugSmm: refactor hotplug logic
>  2:  719828efdebe !  2:  a752dd07466c OvmfPkg/CpuHotplugSmm: collect hot-unplug events
>     @@ -20,6 +20,7 @@
>          Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
>          Signed-off-by: Ankur Arora <ankur.a.arora at oracle.com>
>          Message-Id: <20210312062656.2477515-3-ankur.a.arora at oracle.com>
>     +    Reviewed-by: Laszlo Ersek <lersek at redhat.com>
>
>      diff --git a/OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h b/OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h
>      --- a/OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h
>  3:  7d732efcb7af =  3:  2d92e052c3af OvmfPkg/CpuHotplugSmm: add Qemu Cpu Status helper
>  4:  64649eeeee42 =  4:  15e6ae8ea400 OvmfPkg/CpuHotplugSmm: introduce UnplugCpus()
>  5:  7190a5d134a7 !  5:  8ade9d425a6e OvmfPkg: define CPU_HOT_EJECT_DATA
>     @@ -15,6 +15,7 @@
>          Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
>          Signed-off-by: Ankur Arora <ankur.a.arora at oracle.com>
>          Message-Id: <20210312062656.2477515-6-ankur.a.arora at oracle.com>
>     +    Reviewed-by: Laszlo Ersek <lersek at redhat.com>
>
>      diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
>      --- a/OvmfPkg/OvmfPkg.dec
>  6:  1fd019dac476 !  6:  b6d5996706dd OvmfPkg/SmmCpuFeaturesLib: init CPU ejection state
>     @@ -22,6 +22,7 @@
>          Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
>          Signed-off-by: Ankur Arora <ankur.a.arora at oracle.com>
>          Message-Id: <20210312062656.2477515-7-ankur.a.arora at oracle.com>
>     +    Reviewed-by: Laszlo Ersek <lersek at redhat.com>
>
>      diff --git a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
>      --- a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
>  7:  c8758d9b9764 !  7:  af9c77e151fa OvmfPkg/SmmCpuFeaturesLib: call CPU hot-eject handler
>     @@ -19,6 +19,7 @@
>          Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
>          Signed-off-by: Ankur Arora <ankur.a.arora at oracle.com>
>          Message-Id: <20210312062656.2477515-8-ankur.a.arora at oracle.com>
>     +    Reviewed-by: Laszlo Ersek <lersek at redhat.com>
>
>      diff --git a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
>      --- a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
>  8:  5ff8e8700678 !  8:  30c69d2cfa63 OvmfPkg/CpuHotplugSmm: add EjectCpu()
>     @@ -19,6 +19,7 @@
>          Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
>          Signed-off-by: Ankur Arora <ankur.a.arora at oracle.com>
>          Message-Id: <20210312062656.2477515-9-ankur.a.arora at oracle.com>
>     +    Reviewed-by: Laszlo Ersek <lersek at redhat.com>
>
>      diff --git a/OvmfPkg/CpuHotplugSmm/CpuHotplugSmm.inf b/OvmfPkg/CpuHotplugSmm/CpuHotplugSmm.inf
>      --- a/OvmfPkg/CpuHotplugSmm/CpuHotplugSmm.inf
>  9:  d6660f8f2f14 !  9:  f05328886302 OvmfPkg/CpuHotplugSmm: do actual CPU hot-eject
>     @@ -27,6 +27,9 @@
>          Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
>          Signed-off-by: Ankur Arora <ankur.a.arora at oracle.com>
>          Message-Id: <20210312062656.2477515-10-ankur.a.arora at oracle.com>
>     +    Reviewed-by: Laszlo Ersek <lersek at redhat.com>
>     +    [lersek at redhat.com: unneeded inner QemuSelector declaration in EjectCpu()
>     +     triggers VS warning #4456 (local variable shadowed); remove it]
>
>      diff --git a/OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h b/OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h
>      --- a/OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h
>     @@ -102,8 +105,6 @@
>      +    UINT32 Idx;
>      +
>      +    for (Idx = 0; Idx < mCpuHotEjectData->ArrayLength; Idx++) {
>     -+      UINT64 QemuSelector;
>     -+
>      +      QemuSelector = mCpuHotEjectData->QemuSelectorMap[Idx];
>      +
>      +      if (QemuSelector != CPU_EJECT_QEMU_SELECTOR_INVALID) {
> 10:  0a9a1cd40b98 ! 10:  f3bdfc41866e OvmfPkg/SmmControl2Dxe: negotiate CPU hot-unplug
>     @@ -14,6 +14,9 @@
>          Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
>          Signed-off-by: Ankur Arora <ankur.a.arora at oracle.com>
>          Message-Id: <20210312062656.2477515-11-ankur.a.arora at oracle.com>
>     +    [lersek at redhat.com: preserve the empty line between the ICH9_LPC_SMI_F_*
>     +     group of macro definitions and the SCRATCH_BUFFER type definition]
>     +    Reviewed-by: Laszlo Ersek <lersek at redhat.com>
>
>      diff --git a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c
>      --- a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c
>     @@ -22,16 +25,15 @@
>       // "etc/smi/supported-features" and "etc/smi/requested-features" fw_cfg files.
>       //
>       #define ICH9_LPC_SMI_F_CPU_HOTPLUG BIT1
>     --
>      +//
>      +// The following bit value stands for "enable CPU hot-unplug, and inject an SMI
>      +// with control value ICH9_APM_CNT_CPU_HOTPLUG upon hot-unplug", in the
>      +// "etc/smi/supported-features" and "etc/smi/requested-features" fw_cfg files.
>      +//
>      +#define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG BIT2
>     +
>       //
>       // Provides a scratch buffer (allocated in EfiReservedMemoryType type memory)
>     - // for the S3 boot script fragment to write to and read from.
>      @@
>         QemuFwCfgReadBytes (sizeof mSmiFeatures, &mSmiFeatures);
>

Thanks for the contribution,
Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72875): https://edk2.groups.io/g/devel/message/72875
Mute This Topic: https://groups.io/mt/81273600/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list