summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/tests
diff options
context:
space:
mode:
authorWei6 Xu <wei6.xu@intel.com>2025-06-19 13:58:02 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-07-01 17:46:33 +0000
commitd49364779c53f0aba2fd445345c8999d548f6a90 (patch)
tree36184ebb419bf93f88331470189ccf5fb2f9cbe5 /BaseTools/Source/Python/tests
parentd15b57292f345db25f1908c5ef43d0fd0c9d409e (diff)
downloadedk2-d49364779c53f0aba2fd445345c8999d548f6a90.zip
edk2-d49364779c53f0aba2fd445345c8999d548f6a90.tar.gz
edk2-d49364779c53f0aba2fd445345c8999d548f6a90.tar.bz2
UefiCpuPkg/PiSmmCpuDxeSmm: Add sync barrier before BSP invokes SmmCoreEntry
This patch introduces a synchronization point between the BSP and APs to ensure all APs have entered their SMM wait-loop (while (TRUE) in APHandler ()) before the BSP calls into the SMI handler logic via gSmmCpuPrivate ->SmmCoreEntry(). Previously, the BSP would invoke ReleaseAllAPs() and immediately proceed to SmmCoreEntry() without confirming whether APs had reached the stable waiting state. If SmmStartupThisAp() was called inside the SMI handler shortly after ReleaseAllAPs(), it might lead to a race condition: APs are issued two consecutive wait signals (SmmCpuSyncWaitForBsp()). BSP sends two consecutive releases (ReleaseAllAPs() + SmmStartupThisAp()) If an AP has not yet responded to the first release, the second release may overwrite the semaphore state, and the AP might miss the notification, causing it to hang or behave unpredictably. To address this: A SmmCpuSyncWaitForAPs() is added in BSP after mmCpuPlatformHookBeforeMmiHandler() and before entering SmmCoreEntry(). A matching SmmCpuSyncReleaseBsp() is added in AP immediately after its own SmmCpuPlatformHookBeforeMmiHandler() This ensures that BSP does not enter SMI handler logic or dispatch any AP-related requests before all APs are confirmed to be idle and ready. Debug sync point markers (e.g., /// #6, #7) are updated accordingly. This change eliminates a subtle but critical race condition in multi-processor/multi-socket systems during SMM entry and improves overall synchronization safety. Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/tests')
0 files changed, 0 insertions, 0 deletions