]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: any AP in SMM should not wait for the BSP for more than 100 ms
authorLaszlo Ersek <lersek@redhat.com>
Mon, 30 Nov 2015 18:46:50 +0000 (18:46 +0000)
committerlersek <lersek@Edk2>
Mon, 30 Nov 2015 18:46:50 +0000 (18:46 +0000)
This patch complements the previous one, "OvmfPkg: use relaxed AP SMM
synchronization mode". While that patch focuses on the case when the SMI
is raised synchronously by the BSP, on the BSP:

  BSPHandler()             [UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c]
    SmmWaitForApArrival()  [UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c]
      IsSyncTimerTimeout() [UefiCpuPkg/PiSmmCpuDxeSmm/SyncTimer.c]

this patch concerns itself with the case when it is one of the APs that
raises (and sees delivered) the synchronous SMI:

  APHandler()            [UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c]
    IsSyncTimerTimeout() [UefiCpuPkg/PiSmmCpuDxeSmm/SyncTimer.c]

Namely, in APHandler() the AP waits for the BSP to enter SMM regardless of
PcdCpuSmmSyncMode, for PcdCpuSmmApSyncTimeout microseconds (the default
value is 1 second). If the BSP doesn't show up in SMM within that
interval, then the AP brings it in with a directed SMI, and waits for the
BSP again for PcdCpuSmmApSyncTimeout microseconds.

Although during boot services, SmmControl2DxeTrigger() is only called by
the BSP, at runtime the OS can invoke runtime services from an AP (it can
even be forced with "taskset -c 1 efibootmgr"). Because on QEMU
SmmControl2DxeTrigger() only raises the SMI for the calling processor (BSP
and AP alike), the first interval above times out invariably in such cases
-- the BSP never shows up before the AP calls it in.

In order to mitigate the performance penalty, decrease
PcdCpuSmmApSyncTimeout to one tenth of its default value: 100 ms. (For
comparison, Vlv2TbltDevicePkg sets 1 ms.)

NOTE: once QEMU becomes capable of synchronous broadcast SMIs, this patch
and the previous one ("OvmfPkg: use relaxed AP SMM synchronization mode")
should be reverted, and SmmControl2DxeTrigger() should be adjusted
instead.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19059 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgX64.dsc

index 30ffa9caffc82fee04b87de5b98197b9a770e2f6..7259bf7fc92b719e2ceff92a14f6dd53fb5c084f 100644 (file)
 \r
 !if $(SMM_REQUIRE) == TRUE\r
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01\r
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|100000\r
 !endif\r
 \r
 !if $(SECURE_BOOT_ENABLE) == TRUE\r
index 6eb264a540a4b8b74c000503d2f48ff82c1e1411..d08cab359d9fb5c80f1014cb8566b3afd66ac0b9 100644 (file)
 [PcdsFixedAtBuild.X64]\r
 !if $(SMM_REQUIRE) == TRUE\r
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01\r
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|100000\r
 !endif\r
 \r
 !if $(SECURE_BOOT_ENABLE) == TRUE\r
index 48604686445a532150f192baafe3635a1bc084c2..a49b0bf9276c48f36a033d16a7aa05da08ed61c8 100644 (file)
 \r
 !if $(SMM_REQUIRE) == TRUE\r
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01\r
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|100000\r
 !endif\r
 \r
 !if $(SECURE_BOOT_ENABLE) == TRUE\r