]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/MpInitLib: expand comment on initial AP enumeration
authorLaszlo Ersek <lersek@redhat.com>
Thu, 10 Oct 2019 09:07:39 +0000 (11:07 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Fri, 11 Oct 2019 21:19:41 +0000 (23:19 +0200)
Before adding another AP enumeration mode, clarify the documentation on
the current logic. No functional changes.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1515
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
UefiCpuPkg/Library/MpInitLib/MpLib.c

index d6f84c6f45c02c551d63aa30822f4a34a4d45bf3..594a035d8b927ec031daff272c600d7c81dfd447 100644 (file)
@@ -1045,14 +1045,36 @@ WakeUpAP (
     }\r
     if (CpuMpData->InitFlag == ApInitConfig) {\r
       //\r
-      // Here support two methods to collect AP count through adjust\r
-      // PcdCpuApInitTimeOutInMicroSeconds values.\r
+      // The AP enumeration algorithm below is suitable for two use cases.\r
       //\r
-      // one way is set a value to just let the first AP to start the\r
-      // initialization, then through the later while loop to wait all Aps\r
-      // finsh the initialization.\r
-      // The other way is set a value to let all APs finished the initialzation.\r
-      // In this case, the later while loop is useless.\r
+      // (1) The check-in time for an individual AP is bounded, and APs run\r
+      //     through their initialization routines strongly concurrently. In\r
+      //     particular, the number of concurrently running APs\r
+      //     ("NumApsExecuting") is never expected to fall to zero\r
+      //     *temporarily* -- it is expected to fall to zero only when all\r
+      //     APs have checked-in.\r
+      //\r
+      //     In this case, the platform is supposed to set\r
+      //     PcdCpuApInitTimeOutInMicroSeconds to a low-ish value (just long\r
+      //     enough for one AP to start initialization). The timeout will be\r
+      //     reached soon, and remaining APs are collected by watching\r
+      //     NumApsExecuting fall to zero. If NumApsExecuting falls to zero\r
+      //     mid-process, while some APs have not completed initialization,\r
+      //     the behavior is undefined.\r
+      //\r
+      // (2) The check-in time for an individual AP is unbounded, and/or APs\r
+      //     may complete their initializations widely spread out. In\r
+      //     particular, some APs may finish initialization before some APs\r
+      //     even start.\r
+      //\r
+      //     In this case, the platform is supposed to set\r
+      //     PcdCpuApInitTimeOutInMicroSeconds to a high-ish value. The AP\r
+      //     enumeration will always take that long (except when the boot CPU\r
+      //     count happens to be maximal, that is,\r
+      //     PcdCpuMaxLogicalProcessorNumber). All APs are expected to\r
+      //     check-in before the timeout, and NumApsExecuting is assumed zero\r
+      //     at timeout. APs that miss the time-out may cause undefined\r
+      //     behavior.\r
       //\r
       TimedWaitForApFinish (\r
         CpuMpData,\r