public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ankur Arora" <ankur.a.arora@oracle.com>
To: devel@edk2.groups.io
Cc: lersek@redhat.com, imammedo@redhat.com,
	boris.ostrovsky@oracle.com,
	Ankur Arora <ankur.a.arora@oracle.com>
Subject: [PATCH v2 00/10] support CPU hot-unplug
Date: Thu,  7 Jan 2021 11:55:05 -0800	[thread overview]
Message-ID: <20210107195515.106158-1-ankur.a.arora@oracle.com> (raw)

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


             reply	other threads:[~2021-01-07 19:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 19:55 Ankur Arora [this message]
2021-01-07 19:55 ` [PATCH v2 01/10] OvmfPkg/CpuHotplugSmm: move CPU Hotplug into PlugCpus() Ankur Arora
2021-01-07 19:55 ` [PATCH v2 02/10] OvmfPkg/CpuHotplugSmm: handle Hot-unplug events Ankur Arora
2021-01-07 19:55 ` [PATCH v2 03/10] OvmfPkg/CpuHotplugSmm: add Qemu CpuStatus helper Ankur Arora
2021-01-07 19:55 ` [PATCH v2 04/10] OvmfPkg/CpuHotplugSmm: handle CPU hot-unplug Ankur Arora
2021-01-07 19:55 ` [PATCH v2 05/10] MdePkg: add MmRegisterShutdownInterface() Ankur Arora
2021-01-07 20:48   ` [edk2-devel] " Laszlo Ersek
2021-01-07 21:00     ` Laszlo Ersek
2021-01-07 21:19     ` Ankur Arora
2021-01-07 21:50       ` Laszlo Ersek
2021-01-07 21:45     ` Laszlo Ersek
2021-01-07 23:42       ` Ankur Arora
2021-01-07 19:55 ` [PATCH v2 06/10] UefiCpuPkg/PiSmmCpuDxeSmm: initialize IsBsp Ankur Arora
2021-01-07 19:55 ` [PATCH v2 07/10] UefiCpuPkg/SmmCpuFeaturesLib: add IsBsp as a param to SmmCpuFeaturesRendezvousExit() Ankur Arora
2021-01-07 19:55 ` [PATCH v2 08/10] OvmfCpuPkg/CpuHotplug: add a hot-unplug handler called at SMI exit Ankur Arora
2021-01-07 19:55 ` [PATCH v2 09/10] OvmfPkg/SmmControl2Dxe: negotiate ICH9_LPC_SMI_F_CPU_HOT_UNPLUG Ankur Arora
2021-01-07 19:55 ` [PATCH v2 10/10] MdePkg: use CpuPause() in CpuDeadLoop() Ankur Arora
2021-01-07 22:30   ` [edk2-devel] " Michael D Kinney
2021-01-07 23:43     ` Ankur Arora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210107195515.106158-1-ankur.a.arora@oracle.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox