From nobody Sun May 5 19:07:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+68173+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+68173+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1606910199; cv=none; d=zohomail.com; s=zohoarc; b=VDuZEsoHpoLXsw7MHPxwonAcSttwrBWJk6WnUVSvaTy1XEIDPgCURogrR7A2SDn3NrvmuTz5/wsYLWtR6gY36RCFWSmlO+cAAqlF4KthVcwZaRSsuTzZ+ZiL3kd5JPAKTGcXObUfgOZQmIf/G1oCoAcOSabfCjGg9rsW+QIaGNM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606910199; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=jJ1oRYAPMlasKE3ajdG79+0Q5nDUpxewTlW38nCCXO0=; b=Tu+9C08JgNI97HJHgl28kIuSjdw3waAQC/t+aa1FrT6Krz4CMruIRVqpGNjG3JRNoro64ZbSbZDEflilChjpRizBMWcHk74Nxf0DWjAplchYuqecfCjMUCk3OXZjiz0CLz2ucVyajGMmt+xV4t4Y6+ddfVJlJsVsumK6y2wqSCs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+68173+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1606910199460835.1136726348103; Wed, 2 Dec 2020 03:56:39 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id TQh3YY1788612xHmvD9S2Cth; Wed, 02 Dec 2020 03:56:38 -0800 X-Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web12.3676.1606910197960088938 for ; Wed, 02 Dec 2020 03:56:38 -0800 IronPort-SDR: KeazqjpmOZBqZcFxGt5wIvTcuNYANHKS8Db3/BnKbDID/PGh+kvI9PouU4sarj8wIRV6+Rz6jW 5RwOQpWQlVQA== X-IronPort-AV: E=McAfee;i="6000,8403,9822"; a="152830632" X-IronPort-AV: E=Sophos;i="5.78,386,1599548400"; d="scan'208";a="152830632" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2020 03:56:37 -0800 IronPort-SDR: yKad+UT+CHnrJuhdQkLGT157AWembTBQTfJBnkBUoHFi7SXLSXsfrm4K8BJm43FEwE2ShZ//wP JWql/XttyO3Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,386,1599548400"; d="scan'208";a="539648559" X-Received: from ray-dev.ccr.corp.intel.com ([10.239.158.87]) by fmsmga005.fm.intel.com with ESMTP; 02 Dec 2020 03:56:35 -0800 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Eric Dong , Yun Lou , Laszlo Ersek Subject: [edk2-devel] [PATCH] UefiCpuPkg/Feature: Support different thread count per core Date: Wed, 2 Dec 2020 19:55:05 +0800 Message-Id: <20201202115505.664-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ray.ni@intel.com X-Gm-Message-State: ihaWoajS1jaFm78zTq9mPvNMx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1606910198; bh=JB68cnRcInMy6/BSu/YKJmDRLElxWFAsll24vffmUZk=; h=Cc:Date:From:Reply-To:Subject:To; b=t5lifM9LvPXASZj5lQ1wMnSGDqlEnOs8AB2FzJEkdlT1ggE/jBaXWLoeXHtwvIwebF2 JyLFsvVJhKs/SidkPj4Id5pzuXa4O9NjN/kdfpo7p5bnFoKkvXVMAZunqALPq0SYMV31N 6L9jH5+a8UnGFmIsY5jr+SFig9YycOxZZQw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Today's code assumes every core contains the same number of threads. It's not always TRUE for certain model. Such assumption causes system hang when thread count per core is different and there is core or package dependency between CPU features (using CPU_FEATURE_CORE_BEFORE/AFTER, CPU_FEATURE_PACKAGE_BEFORE/AFTER). The change removes such assumption by calculating the actual thread count per package and per core. Signed-off-by: Ray Ni Cc: Eric Dong Cc: Yun Lou Cc: Laszlo Ersek Acked-by: Laszlo Ersek Reviewed-by: Eric Dong --- UefiCpuPkg/Include/AcpiCpuData.h | 16 ++- .../CpuFeaturesInitialize.c | 113 ++++++++++-------- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 73 ++++++----- 3 files changed, 119 insertions(+), 83 deletions(-) diff --git a/UefiCpuPkg/Include/AcpiCpuData.h b/UefiCpuPkg/Include/AcpiCpuD= ata.h index 77da5d4455..b5a69ad80c 100644 --- a/UefiCpuPkg/Include/AcpiCpuData.h +++ b/UefiCpuPkg/Include/AcpiCpuData.h @@ -1,7 +1,7 @@ /** @file Definitions for CPU S3 data. =20 -Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -60,14 +60,24 @@ typedef struct { UINT32 MaxThreadCount; // // This field points to an array. - // This array saves valid core count (type UINT32) of each package. + // This array saves thread count (type UINT32) of each package. // The array has PackageCount elements. // // If the platform does not support MSR setting at S3 resume, and // therefore it doesn't need the dependency semaphores, it should set // this field to 0. // - EFI_PHYSICAL_ADDRESS ValidCoreCountPerPackage; + EFI_PHYSICAL_ADDRESS ThreadCountPerPackage; + // + // This field points to an array. + // This array saves thread count (type UINT8) of each core. + // The array has PackageCount * MaxCoreCount elements. + // + // If the platform does not support MSR setting at S3 resume, and + // therefore it doesn't need the dependency semaphores, it should set + // this field to 0. + // + EFI_PHYSICAL_ADDRESS ThreadCountPerCore; } CPU_STATUS_INFORMATION; =20 // diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitializ= e.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c index 5c673fa8cf..0cce909cc0 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c @@ -103,14 +103,13 @@ CpuInitDataInitialize ( UINT32 Package; UINT32 Thread; EFI_CPU_PHYSICAL_LOCATION *Location; - BOOLEAN *CoresVisited; - UINTN Index; UINT32 PackageIndex; UINT32 CoreIndex; UINT32 First; ACPI_CPU_DATA *AcpiCpuData; CPU_STATUS_INFORMATION *CpuStatus; - UINT32 *ValidCoreCountPerPackage; + UINT32 *ThreadCountPerPackage; + UINT8 *ThreadCountPerCore; UINTN NumberOfCpus; UINTN NumberOfEnabledProcessors; =20 @@ -202,35 +201,32 @@ CpuInitDataInitialize ( // // Collect valid core count in each package because not all cores are va= lid. // - ValidCoreCountPerPackage=3D AllocateZeroPool (sizeof (UINT32) * CpuStatu= s->PackageCount); - ASSERT (ValidCoreCountPerPackage !=3D 0); - CpuStatus->ValidCoreCountPerPackage =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Val= idCoreCountPerPackage; - CoresVisited =3D AllocatePool (sizeof (BOOLEAN) * CpuStatus->MaxCoreCoun= t); - ASSERT (CoresVisited !=3D NULL); - - for (Index =3D 0; Index < CpuStatus->PackageCount; Index ++ ) { - ZeroMem (CoresVisited, sizeof (BOOLEAN) * CpuStatus->MaxCoreCount); - // - // Collect valid cores in Current package. - // - for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; ProcessorN= umber++) { - Location =3D &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.Pr= ocessorInfo.Location; - if (Location->Package =3D=3D Index && !CoresVisited[Location->Core] = ) { - // - // The ValidCores position for Location->Core is valid. - // The possible values in ValidCores[Index] are 0 or 1. - // FALSE means no valid threads in this Core. - // TRUE means have valid threads in this core, no matter the thead= count is 1 or more. - // - CoresVisited[Location->Core] =3D TRUE; - ValidCoreCountPerPackage[Index]++; - } - } + ThreadCountPerPackage =3D AllocateZeroPool (sizeof (UINT32) * CpuStatus-= >PackageCount); + ASSERT (ThreadCountPerPackage !=3D NULL); + CpuStatus->ThreadCountPerPackage =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Thread= CountPerPackage; + + ThreadCountPerCore =3D AllocateZeroPool (sizeof (UINT8) * CpuStatus->Pac= kageCount * CpuStatus->MaxCoreCount); + ASSERT (ThreadCountPerCore !=3D NULL); + CpuStatus->ThreadCountPerCore =3D (EFI_PHYSICAL_ADDRESS)(UINTN)ThreadCou= ntPerCore; + + for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; ProcessorNum= ber++) { + Location =3D &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.Proc= essorInfo.Location; + ThreadCountPerPackage[Location->Package]++; + ThreadCountPerCore[Location->Package * CpuStatus->MaxCoreCount + Locat= ion->Core]++; } - FreePool (CoresVisited); =20 - for (Index =3D 0; Index <=3D Package; Index++) { - DEBUG ((DEBUG_INFO, "Package: %d, Valid Core : %d\n", Index, ValidCore= CountPerPackage[Index])); + for (PackageIndex =3D 0; PackageIndex < CpuStatus->PackageCount; Package= Index++) { + if (ThreadCountPerPackage[PackageIndex] !=3D 0) { + DEBUG ((DEBUG_INFO, "P%02d: Thread Count =3D %d\n", PackageIndex, Th= readCountPerPackage[PackageIndex])); + for (CoreIndex =3D 0; CoreIndex < CpuStatus->MaxCoreCount; CoreIndex= ++) { + if (ThreadCountPerCore[PackageIndex * CpuStatus->MaxCoreCount + Co= reIndex] !=3D 0) { + DEBUG (( + DEBUG_INFO, " P%02d C%04d, Thread Count =3D %d\n", PackageInd= ex, CoreIndex,=20 + ThreadCountPerCore[PackageIndex * CpuStatus->MaxCoreCount + Co= reIndex] + )); + } + } + } } =20 CpuFeaturesData->CpuFlags.CoreSemaphoreCount =3D AllocateZeroPool (sizeo= f (UINT32) * CpuStatus->PackageCount * CpuStatus->MaxCoreCount * CpuStatus-= >MaxThreadCount); @@ -894,11 +890,11 @@ ProgramProcessorRegister ( CPU_REGISTER_TABLE_ENTRY *RegisterTableEntryHead; volatile UINT32 *SemaphorePtr; UINT32 FirstThread; - UINT32 PackageThreadsCount; UINT32 CurrentThread; + UINT32 CurrentCore; UINTN ProcessorIndex; - UINTN ValidThreadCount; - UINT32 *ValidCoreCountPerPackage; + UINT32 *ThreadCountPerPackage; + UINT8 *ThreadCountPerCore; EFI_STATUS Status; UINT64 CurrentValue; =20 @@ -1029,28 +1025,44 @@ ProgramProcessorRegister ( switch (RegisterTableEntry->Value) { case CoreDepType: SemaphorePtr =3D CpuFlags->CoreSemaphoreCount; + ThreadCountPerCore =3D (UINT8 *)(UINTN)CpuStatus->ThreadCountPerCo= re; + + CurrentCore =3D ApLocation->Package * CpuStatus->MaxCoreCount + Ap= Location->Core; // // Get Offset info for the first thread in the core which current = thread belongs to. // - FirstThread =3D (ApLocation->Package * CpuStatus->MaxCoreCount + A= pLocation->Core) * CpuStatus->MaxThreadCount; + FirstThread =3D CurrentCore * CpuStatus->MaxThreadCount; CurrentThread =3D FirstThread + ApLocation->Thread; + // - // First Notify all threads in current Core that this thread has r= eady. + // Different cores may have different valid threads in them. If dr= iver maintail clearly + // thread index in different cores, the logic will be much complic= ated. + // Here driver just simply records the max thread number in all co= res and use it as expect + // thread number for all cores. + // In below two steps logic, first current thread will Release sem= aphore for each thread + // in current core. Maybe some threads are not valid in this core,= but driver don't + // care. Second, driver will let current thread wait semaphore for= all valid threads in + // current core. Because only the valid threads will do release se= maphore for this + // thread, driver here only need to wait the valid thread count. + // + + // + // First Notify ALL THREADs in current Core that this thread is re= ady. // for (ProcessorIndex =3D 0; ProcessorIndex < CpuStatus->MaxThreadCo= unt; ProcessorIndex ++) { - LibReleaseSemaphore ((UINT32 *) &SemaphorePtr[FirstThread + Proc= essorIndex]); + LibReleaseSemaphore (&SemaphorePtr[FirstThread + ProcessorIndex]= ); } // - // Second, check whether all valid threads in current core have re= ady. + // Second, check whether all VALID THREADs (not all threads) in cu= rrent core are ready. // - for (ProcessorIndex =3D 0; ProcessorIndex < CpuStatus->MaxThreadCo= unt; ProcessorIndex ++) { + for (ProcessorIndex =3D 0; ProcessorIndex < ThreadCountPerCore[Cur= rentCore]; ProcessorIndex ++) { LibWaitForSemaphore (&SemaphorePtr[CurrentThread]); } break; =20 case PackageDepType: SemaphorePtr =3D CpuFlags->PackageSemaphoreCount; - ValidCoreCountPerPackage =3D (UINT32 *)(UINTN)CpuStatus->ValidCore= CountPerPackage; + ThreadCountPerPackage =3D (UINT32 *)(UINTN)CpuStatus->ThreadCountP= erPackage; // // Get Offset info for the first thread in the package which curre= nt thread belongs to. // @@ -1058,18 +1070,13 @@ ProgramProcessorRegister ( // // Get the possible threads count for current package. // - PackageThreadsCount =3D CpuStatus->MaxThreadCount * CpuStatus->Max= CoreCount; CurrentThread =3D FirstThread + CpuStatus->MaxThreadCount * ApLoca= tion->Core + ApLocation->Thread; - // - // Get the valid thread count for current package. - // - ValidThreadCount =3D CpuStatus->MaxThreadCount * ValidCoreCountPer= Package[ApLocation->Package]; =20 // - // Different packages may have different valid cores in them. If d= river maintail clearly - // cores number in different packages, the logic will be much comp= licated. - // Here driver just simply records the max core number in all pack= ages and use it as expect - // core number for all packages. + // Different packages may have different valid threads in them. If= driver maintail clearly + // thread index in different packages, the logic will be much comp= licated. + // Here driver just simply records the max thread number in all pa= ckages and use it as expect + // thread number for all packages. // In below two steps logic, first current thread will Release sem= aphore for each thread // in current package. Maybe some threads are not valid in this pa= ckage, but driver don't // care. Second, driver will let current thread wait semaphore for= all valid threads in @@ -1078,15 +1085,15 @@ ProgramProcessorRegister ( // =20 // - // First Notify ALL THREADS in current package that this thread ha= s ready. + // First Notify ALL THREADS in current package that this thread is= ready. // - for (ProcessorIndex =3D 0; ProcessorIndex < PackageThreadsCount ; = ProcessorIndex ++) { - LibReleaseSemaphore ((UINT32 *) &SemaphorePtr[FirstThread + Proc= essorIndex]); + for (ProcessorIndex =3D 0; ProcessorIndex < CpuStatus->MaxThreadCo= unt * CpuStatus->MaxCoreCount; ProcessorIndex ++) { + LibReleaseSemaphore (&SemaphorePtr[FirstThread + ProcessorIndex]= ); } // - // Second, check whether VALID THREADS (not all threads) in curren= t package have ready. + // Second, check whether VALID THREADS (not all threads) in curren= t package are ready. // - for (ProcessorIndex =3D 0; ProcessorIndex < ValidThreadCount; Proc= essorIndex ++) { + for (ProcessorIndex =3D 0; ProcessorIndex < ThreadCountPerPackage[= ApLocation->Package]; ProcessorIndex ++) { LibWaitForSemaphore (&SemaphorePtr[CurrentThread]); } break; diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/= CpuS3.c index 29e9ba92b4..9592430636 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c @@ -1,7 +1,7 @@ /** @file Code for Processor S3 restoration =20 -Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -235,11 +235,11 @@ ProgramProcessorRegister ( CPU_REGISTER_TABLE_ENTRY *RegisterTableEntryHead; volatile UINT32 *SemaphorePtr; UINT32 FirstThread; - UINT32 PackageThreadsCount; UINT32 CurrentThread; + UINT32 CurrentCore; UINTN ProcessorIndex; - UINTN ValidThreadCount; - UINT32 *ValidCoreCountPerPackage; + UINT32 *ThreadCountPerPackage; + UINT8 *ThreadCountPerCore; EFI_STATUS Status; UINT64 CurrentValue; =20 @@ -372,35 +372,52 @@ ProgramProcessorRegister ( // ASSERT ( (ApLocation !=3D NULL) && - (CpuStatus->ValidCoreCountPerPackage !=3D 0) && + (CpuStatus->ThreadCountPerPackage !=3D 0) && + (CpuStatus->ThreadCountPerCore !=3D 0) && (CpuFlags->CoreSemaphoreCount !=3D NULL) && (CpuFlags->PackageSemaphoreCount !=3D NULL) ); switch (RegisterTableEntry->Value) { case CoreDepType: SemaphorePtr =3D CpuFlags->CoreSemaphoreCount; + ThreadCountPerCore =3D (UINT8 *)(UINTN)CpuStatus->ThreadCountPerCo= re; + + CurrentCore =3D ApLocation->Package * CpuStatus->MaxCoreCount + Ap= Location->Core; // // Get Offset info for the first thread in the core which current = thread belongs to. // - FirstThread =3D (ApLocation->Package * CpuStatus->MaxCoreCount + A= pLocation->Core) * CpuStatus->MaxThreadCount; + FirstThread =3D CurrentCore * CpuStatus->MaxThreadCount; CurrentThread =3D FirstThread + ApLocation->Thread; + // - // First Notify all threads in current Core that this thread has r= eady. + // Different cores may have different valid threads in them. If dr= iver maintail clearly + // thread index in different cores, the logic will be much complic= ated. + // Here driver just simply records the max thread number in all co= res and use it as expect + // thread number for all cores. + // In below two steps logic, first current thread will Release sem= aphore for each thread + // in current core. Maybe some threads are not valid in this core,= but driver don't + // care. Second, driver will let current thread wait semaphore for= all valid threads in + // current core. Because only the valid threads will do release se= maphore for this + // thread, driver here only need to wait the valid thread count. + // + + // + // First Notify ALL THREADs in current Core that this thread is re= ady. // for (ProcessorIndex =3D 0; ProcessorIndex < CpuStatus->MaxThreadCo= unt; ProcessorIndex ++) { S3ReleaseSemaphore (&SemaphorePtr[FirstThread + ProcessorIndex]); } // - // Second, check whether all valid threads in current core have re= ady. + // Second, check whether all VALID THREADs (not all threads) in cu= rrent core are ready. // - for (ProcessorIndex =3D 0; ProcessorIndex < CpuStatus->MaxThreadCo= unt; ProcessorIndex ++) { + for (ProcessorIndex =3D 0; ProcessorIndex < ThreadCountPerCore[Cur= rentCore]; ProcessorIndex ++) { S3WaitForSemaphore (&SemaphorePtr[CurrentThread]); } break; =20 case PackageDepType: SemaphorePtr =3D CpuFlags->PackageSemaphoreCount; - ValidCoreCountPerPackage =3D (UINT32 *)(UINTN)CpuStatus->ValidCore= CountPerPackage; + ThreadCountPerPackage =3D (UINT32 *)(UINTN)CpuStatus->ThreadCountP= erPackage; // // Get Offset info for the first thread in the package which curre= nt thread belongs to. // @@ -408,18 +425,13 @@ ProgramProcessorRegister ( // // Get the possible threads count for current package. // - PackageThreadsCount =3D CpuStatus->MaxThreadCount * CpuStatus->Max= CoreCount; CurrentThread =3D FirstThread + CpuStatus->MaxThreadCount * ApLoca= tion->Core + ApLocation->Thread; - // - // Get the valid thread count for current package. - // - ValidThreadCount =3D CpuStatus->MaxThreadCount * ValidCoreCountPer= Package[ApLocation->Package]; =20 // - // Different packages may have different valid cores in them. If d= river maintail clearly - // cores number in different packages, the logic will be much comp= licated. - // Here driver just simply records the max core number in all pack= ages and use it as expect - // core number for all packages. + // Different packages may have different valid threads in them. If= driver maintail clearly + // thread index in different packages, the logic will be much comp= licated. + // Here driver just simply records the max thread number in all pa= ckages and use it as expect + // thread number for all packages. // In below two steps logic, first current thread will Release sem= aphore for each thread // in current package. Maybe some threads are not valid in this pa= ckage, but driver don't // care. Second, driver will let current thread wait semaphore for= all valid threads in @@ -428,15 +440,15 @@ ProgramProcessorRegister ( // =20 // - // First Notify all threads in current package that this thread ha= s ready. + // First Notify ALL THREADS in current package that this thread is= ready. // - for (ProcessorIndex =3D 0; ProcessorIndex < PackageThreadsCount ; = ProcessorIndex ++) { + for (ProcessorIndex =3D 0; ProcessorIndex < CpuStatus->MaxThreadCo= unt * CpuStatus->MaxCoreCount; ProcessorIndex ++) { S3ReleaseSemaphore (&SemaphorePtr[FirstThread + ProcessorIndex]); } // - // Second, check whether all valid threads in current package have= ready. + // Second, check whether VALID THREADS (not all threads) in curren= t package are ready. // - for (ProcessorIndex =3D 0; ProcessorIndex < ValidThreadCount; Proc= essorIndex ++) { + for (ProcessorIndex =3D 0; ProcessorIndex < ThreadCountPerPackage[= ApLocation->Package]; ProcessorIndex ++) { S3WaitForSemaphore (&SemaphorePtr[CurrentThread]); } break; @@ -1059,12 +1071,19 @@ GetAcpiCpuData ( =20 CpuStatus =3D &mAcpiCpuData.CpuStatus; CopyMem (CpuStatus, &AcpiCpuData->CpuStatus, sizeof (CPU_STATUS_INFORMAT= ION)); - if (AcpiCpuData->CpuStatus.ValidCoreCountPerPackage !=3D 0) { - CpuStatus->ValidCoreCountPerPackage =3D (EFI_PHYSICAL_ADDRESS)(UINTN)A= llocateCopyPool ( + if (AcpiCpuData->CpuStatus.ThreadCountPerPackage !=3D 0) { + CpuStatus->ThreadCountPerPackage =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Allo= cateCopyPool ( sizeof (UINT32) * CpuStatus->P= ackageCount, - (UINT32 *)(UINTN)AcpiCpuData->= CpuStatus.ValidCoreCountPerPackage + (UINT32 *)(UINTN)AcpiCpuData->= CpuStatus.ThreadCountPerPackage + ); + ASSERT (CpuStatus->ThreadCountPerPackage !=3D 0); + } + if (AcpiCpuData->CpuStatus.ThreadCountPerCore !=3D 0) { + CpuStatus->ThreadCountPerCore =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Allocat= eCopyPool ( + sizeof (UINT8) * (CpuStatus->P= ackageCount * CpuStatus->MaxCoreCount), + (UINT32 *)(UINTN)AcpiCpuData->= CpuStatus.ThreadCountPerCore ); - ASSERT (CpuStatus->ValidCoreCountPerPackage !=3D 0); + ASSERT (CpuStatus->ThreadCountPerCore !=3D 0); } if (AcpiCpuData->ApLocation !=3D 0) { mAcpiCpuData.ApLocation =3D (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateCopyP= ool ( --=20 2.27.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#68173): https://edk2.groups.io/g/devel/message/68173 Mute This Topic: https://groups.io/mt/78657549/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-