From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.7268.1570781959112125882 for ; Fri, 11 Oct 2019 01:19:19 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: ray.ni@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2019 01:19:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,283,1566889200"; d="scan'208";a="395678215" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 11 Oct 2019 01:19:18 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 11 Oct 2019 01:19:18 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 11 Oct 2019 01:19:18 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.166]) by shsmsx102.ccr.corp.intel.com ([169.254.2.176]) with mapi id 14.03.0439.000; Fri, 11 Oct 2019 16:19:16 +0800 From: "Ni, Ray" To: Laszlo Ersek , edk2-devel-groups-io CC: "Dong, Eric" Subject: Re: [PATCH v2 1/2] UefiCpuPkg/MpInitLib: expand comment on initial AP enumeration Thread-Topic: [PATCH v2 1/2] UefiCpuPkg/MpInitLib: expand comment on initial AP enumeration Thread-Index: AQHVf14SrUXhFkOmEUCpGE9E4MDf8KdVGfmA Date: Fri, 11 Oct 2019 08:19:15 +0000 Deferred-Delivery: Fri, 11 Oct 2019 08:18:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C31D12E@SHSMSX104.ccr.corp.intel.com> References: <20191010112952.7187-1-lersek@redhat.com> <20191010112952.7187-2-lersek@redhat.com> In-Reply-To: <20191010112952.7187-2-lersek@redhat.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: Laszlo Ersek > Sent: Thursday, October 10, 2019 7:30 PM > To: edk2-devel-groups-io > Cc: Dong, Eric ; Ni, Ray > Subject: [PATCH v2 1/2] UefiCpuPkg/MpInitLib: expand comment on initial > AP enumeration >=20 > Before adding another AP enumeration mode, clarify the documentation on > the current logic. No functional changes. >=20 > Cc: Eric Dong > Cc: Ray Ni > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1515 > Signed-off-by: Laszlo Ersek > --- >=20 > Notes: > v2: > - new patch >=20 > UefiCpuPkg/Library/MpInitLib/MpLib.c | 38 +++++++++++++++----- > 1 file changed, 30 insertions(+), 8 deletions(-) >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c > b/UefiCpuPkg/Library/MpInitLib/MpLib.c > index d6f84c6f45c0..594a035d8b92 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -1045,14 +1045,36 @@ WakeUpAP ( > } > if (CpuMpData->InitFlag =3D=3D ApInitConfig) { > // > - // Here support two methods to collect AP count through adjust > - // PcdCpuApInitTimeOutInMicroSeconds values. > - // > - // one way is set a value to just let the first AP to start the > - // initialization, then through the later while loop to wait all A= ps > - // finsh the initialization. > - // The other way is set a value to let all APs finished the initia= lzation. > - // In this case, the later while loop is useless. > + // The AP enumeration algorithm below is suitable for two use case= s. > + // > + // (1) The check-in time for an individual AP is bounded, and APs = run > + // through their initialization routines strongly concurrently= . In > + // particular, the number of concurrently running APs > + // ("NumApsExecuting") is never expected to fall to zero > + // *temporarily* -- it is expected to fall to zero only when a= ll > + // APs have checked-in. > + // > + // In this case, the platform is supposed to set > + // PcdCpuApInitTimeOutInMicroSeconds to a low-ish value (just = long > + // enough for one AP to start initialization). The timeout wil= l be > + // reached soon, and remaining APs are collected by watching > + // NumApsExecuting fall to zero. If NumApsExecuting falls to z= ero > + // mid-process, while some APs have not completed initializati= on, > + // the behavior is undefined. > + // > + // (2) The check-in time for an individual AP is unbounded, and/or= APs > + // may complete their initializations widely spread out. In > + // particular, some APs may finish initialization before some = APs > + // even start. > + // > + // In this case, the platform is supposed to set > + // PcdCpuApInitTimeOutInMicroSeconds to a high-ish value. The = AP > + // enumeration will always take that long (except when the boo= t CPU > + // count happens to be maximal, that is, > + // PcdCpuMaxLogicalProcessorNumber). All APs are expected to > + // check-in before the timeout, and NumApsExecuting is assumed= zero > + // at timeout. APs that miss the time-out may cause undefined > + // behavior. > // > TimedWaitForApFinish ( > CpuMpData, > -- > 2.19.1.3.g30247aa5d201 >=20