On 2021-03-16 7:07 a.m., Laszlo Ersek wrote:
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-imamm...@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:

Awesome! Thanks Laszlo.

And, thanks especially for the thorough reviews.

Ankur


  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.ar...@oracle.com>
          Message-Id: <20210312062656.2477515-3-ankur.a.ar...@oracle.com>
     +    Reviewed-by: Laszlo Ersek <ler...@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.ar...@oracle.com>
          Message-Id: <20210312062656.2477515-6-ankur.a.ar...@oracle.com>
     +    Reviewed-by: Laszlo Ersek <ler...@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.ar...@oracle.com>
          Message-Id: <20210312062656.2477515-7-ankur.a.ar...@oracle.com>
     +    Reviewed-by: Laszlo Ersek <ler...@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.ar...@oracle.com>
          Message-Id: <20210312062656.2477515-8-ankur.a.ar...@oracle.com>
     +    Reviewed-by: Laszlo Ersek <ler...@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.ar...@oracle.com>
          Message-Id: <20210312062656.2477515-9-ankur.a.ar...@oracle.com>
     +    Reviewed-by: Laszlo Ersek <ler...@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.ar...@oracle.com>
          Message-Id: <20210312062656.2477515-10-ankur.a.ar...@oracle.com>
     +    Reviewed-by: Laszlo Ersek <ler...@redhat.com>
     +    [ler...@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.ar...@oracle.com>
          Message-Id: <20210312062656.2477515-11-ankur.a.ar...@oracle.com>
     +    [ler...@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 <ler...@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 (#72926): https://edk2.groups.io/g/devel/message/72926
Mute This Topic: https://groups.io/mt/81273600/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to