From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: eric.dong@intel.com) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by groups.io with SMTP; Wed, 10 Jul 2019 18:59:41 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2019 18:59:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,476,1557212400"; d="scan'208";a="186276063" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga001.fm.intel.com with ESMTP; 10 Jul 2019 18:59:40 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 10 Jul 2019 18:59:40 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 10 Jul 2019 18:59:40 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.3]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.110]) with mapi id 14.03.0439.000; Thu, 11 Jul 2019 09:59:38 +0800 From: "Dong, Eric" To: "Zeng, Star" , "devel@edk2.groups.io" CC: Laszlo Ersek , "Ni, Ray" , "Kumar, Chandana C" , "Li, Kevin Y" Subject: Re: [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: Fix an ASSERTION issue Thread-Topic: [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: Fix an ASSERTION issue Thread-Index: AQHVNxSUB/+ISG6N2UK0WO+Xx9xPdKbEqk9A Date: Thu, 11 Jul 2019 01:59:38 +0000 Message-ID: References: <20190710114236.14800-1-star.zeng@intel.com> In-Reply-To: <20190710114236.14800-1-star.zeng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: eric.dong@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong > -----Original Message----- > From: Zeng, Star > Sent: Wednesday, July 10, 2019 7:43 PM > To: devel@edk2.groups.io > Cc: Zeng, Star ; Laszlo Ersek ; > Dong, Eric ; Ni, Ray ; Kumar, > Chandana C ; Li, Kevin Y > > Subject: [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: Fix an ASSERTION > issue >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1968 >=20 > We met assertion like below, it happens when there is only one processor. >=20 > ASSERT_EFI_ERROR (Status =3D Not started) > ASSERT [CpuFeaturesDxe] X:\XXX\XXX\RegisterCpuFeaturesLib\ > DxeRegisterCpuFeaturesLib.c(149): !EFI_ERROR (Status) >=20 > The code should not call StartupAllAPs when there is only one processor. >=20 > Cc: Laszlo Ersek > Cc: Eric Dong > Cc: Ray Ni > Cc: Chandana Kumar > Cc: Kevin Li > Signed-off-by: Star Zeng > --- > .../CpuFeaturesInitialize.c | 10 +++-- > .../DxeRegisterCpuFeaturesLib.c | 43 +++++++++++-------- > .../PeiRegisterCpuFeaturesLib.c | 11 +++-- > 3 files changed, 37 insertions(+), 27 deletions(-) >=20 > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > index aff7ad600cad..1746f4f07f7b 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > @@ -1071,10 +1071,12 @@ CpuFeaturesDetect ( >=20 > CpuInitDataInitialize (); >=20 > - // > - // Wakeup all APs for data collection. > - // > - StartupAPsWorker (CollectProcessorData, NULL); > + if (CpuFeaturesData->NumberOfCpus > 1) { > + // > + // Wakeup all APs for data collection. > + // > + StartupAPsWorker (CollectProcessorData, NULL); } >=20 > // > // Collect data on BSP > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c > index 9c78a2d993c4..ffd99046a6cd 100644 > --- > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c > +++ > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLi > +++ b.c > @@ -229,31 +229,36 @@ CpuFeaturesInitialize ( > OldBspNumber =3D GetProcessorIndex (CpuFeaturesData); > CpuFeaturesData->BspNumber =3D OldBspNumber; >=20 > - Status =3D gBS->CreateEvent ( > - EVT_NOTIFY_WAIT, > - TPL_CALLBACK, > - EfiEventEmptyFunction, > - NULL, > - &MpEvent > - ); > - ASSERT_EFI_ERROR (Status); > + if (CpuFeaturesData->NumberOfCpus > 1) { > + Status =3D gBS->CreateEvent ( > + EVT_NOTIFY_WAIT, > + TPL_CALLBACK, > + EfiEventEmptyFunction, > + NULL, > + &MpEvent > + ); > + ASSERT_EFI_ERROR (Status); > + > + // > + // Wakeup all APs for programming. > + // > + StartupAPsWorker (SetProcessorRegister, MpEvent); } >=20 > - // > - // Wakeup all APs for programming. > - // > - StartupAPsWorker (SetProcessorRegister, MpEvent); > // > // Programming BSP > // > SetProcessorRegister (CpuFeaturesData); >=20 > - // > - // Wait all processors to finish the task. > - // > - do { > - Status =3D gBS->CheckEvent (MpEvent); > - } while (Status =3D=3D EFI_NOT_READY); > - ASSERT_EFI_ERROR (Status); > + if (CpuFeaturesData->NumberOfCpus > 1) { > + // > + // Wait all processors to finish the task. > + // > + do { > + Status =3D gBS->CheckEvent (MpEvent); > + } while (Status =3D=3D EFI_NOT_READY); > + ASSERT_EFI_ERROR (Status); > + } >=20 > // > // Switch to new BSP if required > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c > index 2b1553f9b84b..8ad5a40e5a44 100644 > --- > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c > +++ > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLi > +++ b.c > @@ -273,10 +273,13 @@ CpuFeaturesInitialize ( > // DXE type instance. > // >=20 > - // > - // Wakeup all APs for programming. > - // > - StartupAPsWorker (SetProcessorRegister, NULL); > + if (CpuFeaturesData->NumberOfCpus > 1) { > + // > + // Wakeup all APs for programming. > + // > + StartupAPsWorker (SetProcessorRegister, NULL); } > + > // > // Programming BSP > // > -- > 2.21.0.windows.1