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

Ankur Arora posted 10 patches 3 years, 2 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
MdeModulePkg/Core/PiSmmCore/PiSmmCore.c            |   1 +
MdePkg/Include/Pi/PiMmCis.h                        |  16 +
MdePkg/Include/Pi/PiSmmCis.h                       |   2 +
MdePkg/Library/BaseLib/CpuDeadLoop.c               |   3 +-
.../MmServicesTableLib/MmServicesTableLib.c        |  11 +
OvmfPkg/CpuHotplugSmm/CpuHotplug.c                 | 416 ++++++++++++++++-----
OvmfPkg/CpuHotplugSmm/QemuCpuhp.c                  |  58 ++-
OvmfPkg/CpuHotplugSmm/QemuCpuhp.h                  |   6 +
OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h  |   2 +
.../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c  |   6 +-
OvmfPkg/SmmControl2Dxe/SmiFeatures.c               |  21 +-
UefiCpuPkg/Include/Library/SmmCpuFeaturesLib.h     |   4 +-
.../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c  |   4 +-
UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c              |  20 +-
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c         |   1 +
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h         |   1 +
16 files changed, 463 insertions(+), 109 deletions(-)
[edk2-devel] [PATCH v2 00/10] support CPU hot-unplug
Posted by Ankur Arora 3 years, 2 months ago
Hi,

This series adds support for CPU hot-unplug with OVMF.

Please see this in conjunction with the QEMU secureboot hot-unplug v2
series posted here (now upstreamed):
  https://lore.kernel.org/qemu-devel/20201207140739.3829993-1-imammedo@redhat.com/

Patch 1 ("OvmfPkg/CpuHotplugSmm: move CPU Hotplug into PlugCpus()") does
some refactoring to setup for addition of the unplug logic in patch 2
("OvmfPkg/CpuHotplugSmm: handle Hot-unplug events").

Patch 3 ("OvmfPkg/CpuHotplugSmm: add Qemu CpuStatus helper") adds a QEMU
helper which would be used to do the final unplug.

Patch 4 ("OvmfPkg/CpuHotplugSmm: handle CPU hot-unplug") does the SMM
state management for doing the unplug.

Patch 5 ("MdePkg: add MmRegisterShutdownInterface()") adds an interface
to register a ShutdownAp callback to be called from
SmmCpuFeaturesRendezvousExit().

Patch 6 ("UefiCpuPkg/PiSmmCpuDxeSmm: initialize IsBsp") initializes
IsBsp so it accurately reflects if a CPU is BSP or not.
Patch 7 ("UefiCpuPkg/SmmCpuFeaturesLib: add IsBsp as a param to
SmmCpuFeaturesRendezvousExit()") consumes this.

Patch 8 ("OvmfCpuPkg/CpuHotplug: add a hot-unplug handler called at SMI exit")
adds (and registers) the actual handler which provides a holding area for
the AP while the BSP calls QEMU to do the hot-unplug.

And, finally expose this functionality to QEMU with the fw_cfg interface in
Patch 9 ("OvmfPkg/SmmControl2Dxe: negotiate ICH9_LPC_SMI_F_CPU_HOT_UNPLUG").

Patch 10 ("MdePkg: use CpuPause() in CpuDeadLoop()") is unrelated to the
series and just adds a CpuPause() in the CpuDeadLoop((). 

Testing with the QEMU 5.2.50:
 * negotiation with/without CPU hotplug enabled
 * CPU plug/unplug testing in a loop
 * Synthetic tests with simultaneous multi CPU hot-unplug

Also at:
  github.com/terminus/edk2/ hot-unplug-v2

V1: https://patchew.org/EDK2/20201208053432.2690694-1-ankur.a.arora@oracle.com/
Changes from V1:
 * do the ejection via SmmCpuFeaturesRendezvousExit()

Please review.

Thanks
Ankur

Ankur Arora (10):
  OvmfPkg/CpuHotplugSmm: move CPU Hotplug into PlugCpus()
  OvmfPkg/CpuHotplugSmm: handle Hot-unplug events
  OvmfPkg/CpuHotplugSmm: add Qemu CpuStatus helper
  OvmfPkg/CpuHotplugSmm: handle CPU hot-unplug
  MdePkg: add MmRegisterShutdownInterface()
  UefiCpuPkg/PiSmmCpuDxeSmm: initialize IsBsp
  UefiCpuPkg/SmmCpuFeaturesLib: add IsBsp as a param to
    SmmCpuFeaturesRendezvousExit()
  OvmfCpuPkg/CpuHotplug: add a hot-unplug handler called at SMI exit
  OvmfPkg/SmmControl2Dxe: negotiate ICH9_LPC_SMI_F_CPU_HOT_UNPLUG
  MdePkg: use CpuPause() in CpuDeadLoop()

 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c            |   1 +
 MdePkg/Include/Pi/PiMmCis.h                        |  16 +
 MdePkg/Include/Pi/PiSmmCis.h                       |   2 +
 MdePkg/Library/BaseLib/CpuDeadLoop.c               |   3 +-
 .../MmServicesTableLib/MmServicesTableLib.c        |  11 +
 OvmfPkg/CpuHotplugSmm/CpuHotplug.c                 | 416 ++++++++++++++++-----
 OvmfPkg/CpuHotplugSmm/QemuCpuhp.c                  |  58 ++-
 OvmfPkg/CpuHotplugSmm/QemuCpuhp.h                  |   6 +
 OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h  |   2 +
 .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c  |   6 +-
 OvmfPkg/SmmControl2Dxe/SmiFeatures.c               |  21 +-
 UefiCpuPkg/Include/Library/SmmCpuFeaturesLib.h     |   4 +-
 .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c  |   4 +-
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c              |  20 +-
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c         |   1 +
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h         |   1 +
 16 files changed, 463 insertions(+), 109 deletions(-)

-- 
2.9.3



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69978): https://edk2.groups.io/g/devel/message/69978
Mute This Topic: https://groups.io/mt/79507573/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-