[PATCH] UefiCpuPkg/CpuFeature: reduce time complexty to calc CpuInfo.First


Ni, Ray
 

CpuInfo.First stores whether the current thread belongs to the first
package in the platform, first core in a package, first thread in a
core.

But the time complexity of original algorithm to calculate the
CpuInfo.First is O (n) * O (p) * O (c).
n: number of processors
p: number of packages
c: number of cores per package

The patch trades time with space by storing the first package, first
core per package, first thread per core in an array.
The time complexity becomes O (n).

Signed-off-by: Ray Ni <ray.ni@...>
Cc: Eric Dong <eric.dong@...>
Cc: Star Zeng <star.zeng@...>
Cc: Yun Lou <yun.lou@...>
Cc: Laszlo Ersek <lersek@...>
---
.../CpuFeaturesInitialize.c | 87 ++++++++-----------
1 file changed, 36 insertions(+), 51 deletions(-)

diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitializ=
e.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index d4a576385f..d21a1eaf38 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -105,7 +105,10 @@ CpuInitDataInitialize (
EFI_CPU_PHYSICAL_LOCATION *Location;=0D
UINT32 PackageIndex;=0D
UINT32 CoreIndex;=0D
- UINT32 First;=0D
+ UINTN Pages;=0D
+ UINT32 FirstPackage;=0D
+ UINT32 *FirstCore;=0D
+ UINT32 *FirstThread;=0D
ACPI_CPU_DATA *AcpiCpuData;=0D
CPU_STATUS_INFORMATION *CpuStatus;=0D
UINT32 *ThreadCountPerPackage;=0D
@@ -236,74 +239,56 @@ CpuInitDataInitialize (
=0D
//=0D
// Initialize CpuFeaturesData->InitOrder[].CpuInfo.First=0D
+ // Use AllocatePages () instead of AllocatePool () because pool cannot b=
e freed in PEI phase but page can.=0D
//=0D
+ Pages =3D EFI_SIZE_TO_PAGES (CpuStatus->PackageCount * sizeof (UINT3=
2) + CpuStatus->PackageCount * CpuStatus->MaxCoreCount * sizeof (UINT32));=
=0D
+ FirstCore =3D AllocatePages (Pages);=0D
+ ASSERT (FirstCore !=3D NULL);=0D
+ FirstThread =3D FirstCore + CpuStatus->PackageCount;=0D
+=0D
+ FirstPackage =3D MAX_UINT32;=0D
+ for (PackageIndex =3D 0; PackageIndex < CpuStatus->PackageCount; Package=
Index++) {=0D
+ FirstCore[PackageIndex] =3D MAX_UINT32;=0D
+ for (CoreIndex =3D 0; CoreIndex < CpuStatus->MaxCoreCount; CoreIndex++=
) {=0D
+ FirstThread[PackageIndex * CpuStatus->MaxCoreCount + CoreIndex] =3D =
MAX_UINT32;=0D
+ }=0D
+ }=0D
=0D
- //=0D
- // Set First.Package for each thread belonging to the first package.=0D
- //=0D
- First =3D MAX_UINT32;=0D
for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; ProcessorNum=
ber++) {=0D
Location =3D &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.Proc=
essorInfo.Location;=0D
- First =3D MIN (Location->Package, First);=0D
+=0D
+ FirstPackage =3D MIN (Location->Package, FirstPackage)=
;=0D
+ FirstCore[Location->Package] =3D MIN (Location->Core, FirstCore[Locati=
on->Package]);=0D
+ FirstThread[Location->Package * CpuStatus->MaxCoreCount + Location->Co=
re] =3D MIN (=0D
+ Location->Thread,=0D
+ FirstThread[Location->Package * CpuStatus->MaxCoreCount + Location->=
Core]=0D
+ );=0D
}=0D
+=0D
for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; ProcessorNum=
ber++) {=0D
Location =3D &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.Proc=
essorInfo.Location;=0D
- if (Location->Package =3D=3D First) {=0D
+=0D
+ if (Location->Package =3D=3D FirstPackage) {=0D
CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Package =
=3D 1;=0D
}=0D
- }=0D
=0D
- //=0D
- // Set First.Die/Tile/Module for each thread assuming:=0D
- // single Die under each package, single Tile under each Die, single Mo=
dule under each Tile=0D
- //=0D
- for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; ProcessorNum=
ber++) {=0D
+ //=0D
+ // Set First.Die/Tile/Module for each thread assuming:=0D
+ // single Die under each package, single Tile under each Die, single =
Module under each Tile=0D
+ //=0D
CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Die =3D 1;=0D
CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Tile =3D 1;=
=0D
CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Module =3D 1=
;=0D
- }=0D
=0D
- for (PackageIndex =3D 0; PackageIndex < CpuStatus->PackageCount; Package=
Index++) {=0D
- //=0D
- // Set First.Core for each thread in the first core of each package.=0D
- //=0D
- First =3D MAX_UINT32;=0D
- for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; ProcessorN=
umber++) {=0D
- Location =3D &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.Pr=
ocessorInfo.Location;=0D
- if (Location->Package =3D=3D PackageIndex) {=0D
- First =3D MIN (Location->Core, First);=0D
- }=0D
+ if (Location->Core =3D=3D FirstCore[Location->Package]) {=0D
+ CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Core =3D 1=
;=0D
}=0D
-=0D
- for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; ProcessorN=
umber++) {=0D
- Location =3D &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.Pr=
ocessorInfo.Location;=0D
- if (Location->Package =3D=3D PackageIndex && Location->Core =3D=3D F=
irst) {=0D
- CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Core =3D=
1;=0D
- }=0D
+ if (Location->Thread =3D=3D FirstThread[Location->Package * CpuStatus-=
MaxCoreCount + Location->Core]) {=0D
+ CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Thread =3D=
1;=0D
}=0D
}=0D
=0D
- for (PackageIndex =3D 0; PackageIndex < CpuStatus->PackageCount; Package=
Index++) {=0D
- for (CoreIndex =3D 0; CoreIndex < CpuStatus->MaxCoreCount; CoreIndex++=
) {=0D
- //=0D
- // Set First.Thread for the first thread of each core.=0D
- //=0D
- First =3D MAX_UINT32;=0D
- for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; Processo=
rNumber++) {=0D
- Location =3D &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.=
ProcessorInfo.Location;=0D
- if (Location->Package =3D=3D PackageIndex && Location->Core =3D=3D=
CoreIndex) {=0D
- First =3D MIN (Location->Thread, First);=0D
- }=0D
- }=0D
-=0D
- for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; Processo=
rNumber++) {=0D
- Location =3D &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.=
ProcessorInfo.Location;=0D
- if (Location->Package =3D=3D PackageIndex && Location->Core =3D=3D=
CoreIndex && Location->Thread =3D=3D First) {=0D
- CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Thread=
=3D 1;=0D
- }=0D
- }=0D
- }=0D
- }=0D
+ FreePages (FirstCore, Pages);=0D
}=0D
=0D
/**=0D
--=20
2.27.0.windows.1


Zeng, Star
 

Only one minor comment inline, other parts look good to me.

-----Original Message-----
From: Ni, Ray <ray.ni@...>
Sent: Tuesday, December 8, 2020 11:02 PM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@...>; Zeng, Star <star.zeng@...>;
Lou, Yun <yun.lou@...>; Laszlo Ersek <lersek@...>
Subject: [PATCH] UefiCpuPkg/CpuFeature: reduce time complexty to calc
CpuInfo.First

CpuInfo.First stores whether the current thread belongs to the first
package in the platform, first core in a package, first thread in a
core.

But the time complexity of original algorithm to calculate the
CpuInfo.First is O (n) * O (p) * O (c).
n: number of processors
p: number of packages
c: number of cores per package

The patch trades time with space by storing the first package, first
core per package, first thread per core in an array.
The time complexity becomes O (n).

Signed-off-by: Ray Ni <ray.ni@...>
Cc: Eric Dong <eric.dong@...>
Cc: Star Zeng <star.zeng@...>
Cc: Yun Lou <yun.lou@...>
Cc: Laszlo Ersek <lersek@...>
---
.../CpuFeaturesInitialize.c | 87 ++++++++-----------
1 file changed, 36 insertions(+), 51 deletions(-)

diff --git
a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index d4a576385f..d21a1eaf38 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -105,7 +105,10 @@ CpuInitDataInitialize (
EFI_CPU_PHYSICAL_LOCATION *Location;

UINT32 PackageIndex;

UINT32 CoreIndex;

- UINT32 First;

+ UINTN Pages;

+ UINT32 FirstPackage;

+ UINT32 *FirstCore;

+ UINT32 *FirstThread;

ACPI_CPU_DATA *AcpiCpuData;

CPU_STATUS_INFORMATION *CpuStatus;

UINT32 *ThreadCountPerPackage;

@@ -236,74 +239,56 @@ CpuInitDataInitialize (


//

// Initialize CpuFeaturesData->InitOrder[].CpuInfo.First

+ // Use AllocatePages () instead of AllocatePool () because pool cannot be
freed in PEI phase but page can.

//

+ Pages = EFI_SIZE_TO_PAGES (CpuStatus->PackageCount * sizeof
(UINT32) + CpuStatus->PackageCount * CpuStatus->MaxCoreCount * sizeof
(UINT32));

+ FirstCore = AllocatePages (Pages);

+ ASSERT (FirstCore != NULL);

+ FirstThread = FirstCore + CpuStatus->PackageCount;

+

+ FirstPackage = MAX_UINT32;

+ for (PackageIndex = 0; PackageIndex < CpuStatus->PackageCount;
PackageIndex++) {

+ FirstCore[PackageIndex] = MAX_UINT32;

+ for (CoreIndex = 0; CoreIndex < CpuStatus->MaxCoreCount; CoreIndex++)
{

+ FirstThread[PackageIndex * CpuStatus->MaxCoreCount + CoreIndex] =
MAX_UINT32;

+ }

+ }
Could this code block be replaced by a SetMem32(xxx, xxx, MAX_UINT32) call?


Thanks,
Star




- //

- // Set First.Package for each thread belonging to the first package.

- //

- First = MAX_UINT32;

for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus;
ProcessorNumber++) {

Location = &CpuFeaturesData-
InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- First = MIN (Location->Package, First);

+

+ FirstPackage = MIN (Location->Package, FirstPackage);

+ FirstCore[Location->Package] = MIN (Location->Core,
FirstCore[Location->Package]);

+ FirstThread[Location->Package * CpuStatus->MaxCoreCount + Location-
Core] = MIN (
+ Location->Thread,

+ FirstThread[Location->Package * CpuStatus->MaxCoreCount +
Location->Core]

+ );

}

+

for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus;
ProcessorNumber++) {

Location = &CpuFeaturesData-
InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- if (Location->Package == First) {

+

+ if (Location->Package == FirstPackage) {

CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Package =
1;

}

- }



- //

- // Set First.Die/Tile/Module for each thread assuming:

- // single Die under each package, single Tile under each Die, single Module
under each Tile

- //

- for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus;
ProcessorNumber++) {

+ //

+ // Set First.Die/Tile/Module for each thread assuming:

+ // single Die under each package, single Tile under each Die, single
Module under each Tile

+ //

CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Die = 1;

CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Tile = 1;

CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Module = 1;

- }



- for (PackageIndex = 0; PackageIndex < CpuStatus->PackageCount;
PackageIndex++) {

- //

- // Set First.Core for each thread in the first core of each package.

- //

- First = MAX_UINT32;

- for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus;
ProcessorNumber++) {

- Location = &CpuFeaturesData-
InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- if (Location->Package == PackageIndex) {

- First = MIN (Location->Core, First);

- }

+ if (Location->Core == FirstCore[Location->Package]) {

+ CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Core = 1;

}

-

- for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus;
ProcessorNumber++) {

- Location = &CpuFeaturesData-
InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- if (Location->Package == PackageIndex && Location->Core == First) {

- CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Core = 1;

- }

+ if (Location->Thread == FirstThread[Location->Package * CpuStatus-
MaxCoreCount + Location->Core]) {
+ CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Thread =
1;

}

}



- for (PackageIndex = 0; PackageIndex < CpuStatus->PackageCount;
PackageIndex++) {

- for (CoreIndex = 0; CoreIndex < CpuStatus->MaxCoreCount; CoreIndex++)
{

- //

- // Set First.Thread for the first thread of each core.

- //

- First = MAX_UINT32;

- for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus;
ProcessorNumber++) {

- Location = &CpuFeaturesData-
InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- if (Location->Package == PackageIndex && Location->Core ==
CoreIndex) {

- First = MIN (Location->Thread, First);

- }

- }

-

- for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus;
ProcessorNumber++) {

- Location = &CpuFeaturesData-
InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- if (Location->Package == PackageIndex && Location->Core ==
CoreIndex && Location->Thread == First) {

- CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Thread
= 1;

- }

- }

- }

- }

+ FreePages (FirstCore, Pages);

}



/**

--
2.27.0.windows.1


Laszlo Ersek
 

Hi,

On 12/08/20 16:01, Ray Ni wrote:
CpuInfo.First stores whether the current thread belongs to the first
package in the platform, first core in a package, first thread in a
core.

But the time complexity of original algorithm to calculate the
CpuInfo.First is O (n) * O (p) * O (c).
n: number of processors
p: number of packages
c: number of cores per package

The patch trades time with space by storing the first package, first
core per package, first thread per core in an array.
The time complexity becomes O (n).

Signed-off-by: Ray Ni <ray.ni@...>
Cc: Eric Dong <eric.dong@...>
Cc: Star Zeng <star.zeng@...>
Cc: Yun Lou <yun.lou@...>
Cc: Laszlo Ersek <lersek@...>
---
.../CpuFeaturesInitialize.c | 87 ++++++++-----------
1 file changed, 36 insertions(+), 51 deletions(-)
as RegisterCpuFeaturesLib is not used by OVMF, I'll defer this review to
others.

Thanks
Laszlo


diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index d4a576385f..d21a1eaf38 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -105,7 +105,10 @@ CpuInitDataInitialize (
EFI_CPU_PHYSICAL_LOCATION *Location;
UINT32 PackageIndex;
UINT32 CoreIndex;
- UINT32 First;
+ UINTN Pages;
+ UINT32 FirstPackage;
+ UINT32 *FirstCore;
+ UINT32 *FirstThread;
ACPI_CPU_DATA *AcpiCpuData;
CPU_STATUS_INFORMATION *CpuStatus;
UINT32 *ThreadCountPerPackage;
@@ -236,74 +239,56 @@ CpuInitDataInitialize (

//
// Initialize CpuFeaturesData->InitOrder[].CpuInfo.First
+ // Use AllocatePages () instead of AllocatePool () because pool cannot be freed in PEI phase but page can.
//
+ Pages = EFI_SIZE_TO_PAGES (CpuStatus->PackageCount * sizeof (UINT32) + CpuStatus->PackageCount * CpuStatus->MaxCoreCount * sizeof (UINT32));
+ FirstCore = AllocatePages (Pages);
+ ASSERT (FirstCore != NULL);
+ FirstThread = FirstCore + CpuStatus->PackageCount;
+
+ FirstPackage = MAX_UINT32;
+ for (PackageIndex = 0; PackageIndex < CpuStatus->PackageCount; PackageIndex++) {
+ FirstCore[PackageIndex] = MAX_UINT32;
+ for (CoreIndex = 0; CoreIndex < CpuStatus->MaxCoreCount; CoreIndex++) {
+ FirstThread[PackageIndex * CpuStatus->MaxCoreCount + CoreIndex] = MAX_UINT32;
+ }
+ }

- //
- // Set First.Package for each thread belonging to the first package.
- //
- First = MAX_UINT32;
for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
Location = &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- First = MIN (Location->Package, First);
+
+ FirstPackage = MIN (Location->Package, FirstPackage);
+ FirstCore[Location->Package] = MIN (Location->Core, FirstCore[Location->Package]);
+ FirstThread[Location->Package * CpuStatus->MaxCoreCount + Location->Core] = MIN (
+ Location->Thread,
+ FirstThread[Location->Package * CpuStatus->MaxCoreCount + Location->Core]
+ );
}
+
for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
Location = &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- if (Location->Package == First) {
+
+ if (Location->Package == FirstPackage) {
CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Package = 1;
}
- }

- //
- // Set First.Die/Tile/Module for each thread assuming:
- // single Die under each package, single Tile under each Die, single Module under each Tile
- //
- for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
+ //
+ // Set First.Die/Tile/Module for each thread assuming:
+ // single Die under each package, single Tile under each Die, single Module under each Tile
+ //
CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Die = 1;
CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Tile = 1;
CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Module = 1;
- }

- for (PackageIndex = 0; PackageIndex < CpuStatus->PackageCount; PackageIndex++) {
- //
- // Set First.Core for each thread in the first core of each package.
- //
- First = MAX_UINT32;
- for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
- Location = &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- if (Location->Package == PackageIndex) {
- First = MIN (Location->Core, First);
- }
+ if (Location->Core == FirstCore[Location->Package]) {
+ CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Core = 1;
}
-
- for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
- Location = &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- if (Location->Package == PackageIndex && Location->Core == First) {
- CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Core = 1;
- }
+ if (Location->Thread == FirstThread[Location->Package * CpuStatus->MaxCoreCount + Location->Core]) {
+ CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Thread = 1;
}
}

- for (PackageIndex = 0; PackageIndex < CpuStatus->PackageCount; PackageIndex++) {
- for (CoreIndex = 0; CoreIndex < CpuStatus->MaxCoreCount; CoreIndex++) {
- //
- // Set First.Thread for the first thread of each core.
- //
- First = MAX_UINT32;
- for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
- Location = &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- if (Location->Package == PackageIndex && Location->Core == CoreIndex) {
- First = MIN (Location->Thread, First);
- }
- }
-
- for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
- Location = &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.ProcessorInfo.Location;
- if (Location->Package == PackageIndex && Location->Core == CoreIndex && Location->Thread == First) {
- CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.First.Thread = 1;
- }
- }
- }
- }
+ FreePages (FirstCore, Pages);
}

/**


Ni, Ray
 

+ FirstPackage = MAX_UINT32;

+ for (PackageIndex = 0; PackageIndex < CpuStatus->PackageCount;
PackageIndex++) {

+ FirstCore[PackageIndex] = MAX_UINT32;

+ for (CoreIndex = 0; CoreIndex < CpuStatus->MaxCoreCount; CoreIndex++)
{

+ FirstThread[PackageIndex * CpuStatus->MaxCoreCount + CoreIndex] =
MAX_UINT32;

+ }

+ }
Could this code block be replaced by a SetMem32(xxx, xxx, MAX_UINT32) call?
Yes. it could. I thought the for loop is more readable. Maybe it doesn't help a lot
on the code readability. Let me send an updated version to use SetMem32.