From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DCFCA81DF0 for ; Sun, 6 Nov 2016 16:47:42 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 06 Nov 2016 16:47:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,604,1473145200"; d="scan'208";a="393487" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga002.jf.intel.com with ESMTP; 06 Nov 2016 16:47:45 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 6 Nov 2016 16:47:44 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 6 Nov 2016 16:47:44 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.104]) with mapi id 14.03.0248.002; Mon, 7 Nov 2016 08:47:42 +0800 From: "Fan, Jeff" To: Laszlo Ersek , "edk2-devel@ml01.01.org" CC: "Kinney, Michael D" , "Tian, Feng" , "Gao, Liming" Thread-Topic: [edk2] [PATCH] UefiCpuPkg/MpInitLib: Do not wakeup AP if only one processor supported Thread-Index: AQHSNnQeVAJEZAXmgUaSrrADNHEnK6DIgTQAgAQykeA= Date: Mon, 7 Nov 2016 00:47:41 +0000 Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4A2C434D@shsmsx102.ccr.corp.intel.com> References: <20161104081806.19624-1-jeff.fan@intel.com> <9af37565-ad49-6e1a-bf33-07e1254c4217@redhat.com> In-Reply-To: <9af37565-ad49-6e1a-bf33-07e1254c4217@redhat.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjQ3ZGI5NmItZjE4ZS00YWE2LThhNzgtMzNmZTIyOWY1NTE3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Ik1SU2IxMCtHXC81Tm4rck5RczVSSmFpYlR5WFM0QUFwTE9ucnFYendhMXFnPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] UefiCpuPkg/MpInitLib: Do not wakeup AP if only one processor supported X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 00:47:43 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Laszlo, Yes. MP PPI and Protocol still be installed even there is only one process= or supported or found? Jeff -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Lasz= lo Ersek Sent: Saturday, November 05, 2016 12:40 AM To: Fan, Jeff; edk2-devel@ml01.01.org Cc: Kinney, Michael D; Tian, Feng; Gao, Liming Subject: Re: [edk2] [PATCH] UefiCpuPkg/MpInitLib: Do not wakeup AP if only = one processor supported On 11/04/16 09:18, Jeff Fan wrote: > If MaxLogicalProcessorNumber is only 1, we needn't to wake up APs at=20 > all and needn't to register callback functions. >=20 > It could improve boot performance on single supported system. >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D204 >=20 > Cc: Feng Tian > Cc: Liming Gao > Cc: Michael Kinney > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jeff Fan > --- > UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 7 ++++++ > UefiCpuPkg/Library/MpInitLib/MpLib.c | 39 +++++++++++++++++++--------= ------ > UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 8 +++++++ > 3 files changed, 37 insertions(+), 17 deletions(-) The MP services protocol and PPI that depend on this library will remain av= ailable to callers, right? Thanks Laszlo > diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c=20 > b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c > index b399f1c..eb36d6f 100644 > --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c > @@ -290,6 +290,13 @@ InitMpGlobalData ( > =20 > SaveCpuMpData (CpuMpData); > =20 > + if (CpuMpData->CpuCount =3D=3D 1) { > + // > + // If only BSP exists, return > + // > + return; > + } > + > // > // Avoid APs access invalid buff data which allocated by BootServices, > // so we will allocate reserved data for AP loop code. > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c=20 > b/UefiCpuPkg/Library/MpInitLib/MpLib.c > index 56b870e..a0edc55 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -1143,6 +1143,7 @@ MpInitLibInitialize ( > } else { > MaxLogicalProcessorNumber =3D OldCpuMpData->CpuCount; > } > + ASSERT (MaxLogicalProcessorNumber !=3D 0); > =20 > AsmGetAddressMap (&AddressMap); > ApResetVectorSize =3D AddressMap.RendezvousFunnelSize + sizeof=20 > (MP_CPU_EXCHANGE_INFO); @@ -1209,10 +1210,12 @@ MpInitLibInitialize ( > MtrrGetAllMtrrs (&CpuMpData->MtrrTable); > =20 > if (OldCpuMpData =3D=3D NULL) { > - // > - // Wakeup all APs and calculate the processor count in system > - // > - CollectProcessorCount (CpuMpData); > + if (MaxLogicalProcessorNumber > 1) { > + // > + // Wakeup all APs and calculate the processor count in system > + // > + CollectProcessorCount (CpuMpData); > + } > } else { > // > // APs have been wakeup before, just get the CPU Information @@=20 > -1238,19 +1241,21 @@ MpInitLibInitialize ( > sizeof (CPU_VOLATILE_REGISTERS) > ); > } > - // > - // Wakeup APs to do some AP initialize sync > - // > - WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData); > - // > - // Wait for all APs finished initialization > - // > - while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) { > - CpuPause (); > - } > - CpuMpData->InitFlag =3D ApInitDone; > - for (Index =3D 0; Index < CpuMpData->CpuCount; Index++) { > - SetApState (&CpuMpData->CpuData[Index], CpuStateIdle); > + if (MaxLogicalProcessorNumber > 1) { > + // > + // Wakeup APs to do some AP initialize sync > + // > + WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData); > + // > + // Wait for all APs finished initialization > + // > + while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) { > + CpuPause (); > + } > + CpuMpData->InitFlag =3D ApInitDone; > + for (Index =3D 0; Index < CpuMpData->CpuCount; Index++) { > + SetApState (&CpuMpData->CpuData[Index], CpuStateIdle); > + } > } > } > =20 > diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c=20 > b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c > index e242d37..1f2fcb8 100644 > --- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c > @@ -321,6 +321,14 @@ InitMpGlobalData ( > EFI_STATUS Status; > =20 > SaveCpuMpData (CpuMpData); > + > + if (CpuMpData->CpuCount =3D=3D 1) { > + // > + // If only BSP exists, return > + // > + return; > + } > + > // > // Register an event for EndOfPei > // >=20 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel