audk/UefiCpuPkg/PiSmmCpuDxeSmm
Jiaxin Wu 58d9463939 UefiCpuPkg/PiSmmCpuDxeSmm: Reduce one round BSP & AP sync
After BSP returned from SmmCoreEntry, there are several rounds BSP
and AP sync in BSP handler:

1 .ReleaseAllAPs();  /// Notify all APs to exit.
if (SmmCpuFeaturesNeedConfigureMtrrs()) {
  2. SmmCpuSyncWaitForAPs(); /// Wait for all APs to program MTRRs.
  3. ReleaseAllAPs(); /// Signal APs to restore MTRRs.
}

4. SmmCpuSyncWaitForAPs(); /// Wait for all APs to complete pending
                               tasks including MTRR.
5. ReleaseAllAPs(); /// Signal APs to Reset states.

6. SmmCpuSyncWaitForAPs(); /// Gather APs to exit SMM synchronously.

Before step 6 and after step 5, BSP performs below items:
A. InitializeDebugAgent() /// Stop source level debug.
B. SmmCpuUpdate() /// Perform pending operations for hot-plug.
C. Present = FALSE; /// Clear the Present flag of BSP.

For InitializeDebugAgent(), BSP needs to wait all APs complete
pending tasks and then notify all APs to stop source level debug.
So, above step 4 & step 5 are required for InitializeDebugAgent().

For SmmCpuUpdate(), it's to perform pending operations for
hot-plug CPUs take effect in next SMI. Existing APs in SMI do not
reply on the CPU switch & hot-add & hot-remove operations. So, no
need step 4 and step 5 for additional one round BSP & AP sync.
Step 6 can make sure all APs are ready to exit SMM, then hot-plug
operation can take effect in next SMI.

For BSP "Present" flag, AP does not reply on it. No need step 4
and step 5 for additional one round BSP & AP sync.

Based on above analysis, step 4 and step 5 are only required if
need configure MTRR and support SMM source level debug. So, we can
reduce one round BSP and AP sync if both are unsupported. With
this change, SMI performance can be improved.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@Intel.com>
2023-12-26 07:18:26 +00:00
..
Ia32 UefiCpuPkg: Backup and Restore MSR IA32_U_CET in SMI handler. 2023-12-07 09:43:43 +00:00
X64 UefiCpuPkg: Backup and Restore MSR IA32_U_CET in SMI handler. 2023-12-07 09:43:43 +00:00
Cet.inc UefiCpuPkg: Add macro definitions for CET feature for NASM files. 2023-12-07 09:43:43 +00:00
CpuS3.c UefiCpuPkg/PiSmmCpuDxeSmm: Check SMM Debug Agent support or not 2023-12-26 07:18:26 +00:00
CpuService.c UefiCpuPkg/PiSmmCpuDxeSmm: Get processor extended information 2023-12-08 13:25:11 +00:00
CpuService.h UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MpService.c UefiCpuPkg/PiSmmCpuDxeSmm: Reduce one round BSP & AP sync 2023-12-26 07:18:26 +00:00
PiSmmCpuDxeSmm.c UefiCpuPkg/PiSmmCpuDxeSmm: Check SMM Debug Agent support or not 2023-12-26 07:18:26 +00:00
PiSmmCpuDxeSmm.h UefiCpuPkg/PiSmmCpuDxeSmm: Check SMM Debug Agent support or not 2023-12-26 07:18:26 +00:00
PiSmmCpuDxeSmm.inf UefiCpuPkg/PiSmmCpuDxeSmm: Consume SmmCpuSyncLib 2023-12-20 02:30:56 +00:00
PiSmmCpuDxeSmm.uni
PiSmmCpuDxeSmmExtra.uni
SmmCpuMemoryManagement.c UefiCpuPkg: Use Attribute From SMM MemoryAttributesTable if Nonzero 2023-11-27 18:55:18 +00:00
SmmMp.c UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmMp.h UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmMpPerf.c UefiCpuPkg/SmmCpu: Add PcdSmmApPerfLogEnable control AP perf-logging 2023-06-21 04:37:17 +00:00
SmmMpPerf.h UefiCpuPkg/SmmCpu: Add PcdSmmApPerfLogEnable control AP perf-logging 2023-06-21 04:37:17 +00:00
SmmProfile.c UefiCpuPkg/PiSmmCpuDxeSmm: Fix CP Exception when CET enable 2023-11-10 01:21:12 +00:00
SmmProfile.h UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmProfileInternal.h UefiCpuPkg: Remove UefiCpuLib from module INFs. 2023-03-10 08:23:56 +00:00
SmramSaveState.c UefiCpuPkg: Removes SmmCpuFeaturesReadSaveStateRegister 2023-07-03 03:01:10 +00:00
SyncTimer.c UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00