From: "Ni, Ray" <ray.ni@intel.com>
To: "Zeng, Star" <star.zeng@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Eric" <eric.dong@intel.com>, Laszlo Ersek <lersek@redhat.com>
Subject: Re: [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: Use AllocatePages() for InitOrder
Date: Fri, 11 Dec 2020 10:37:16 +0000 [thread overview]
Message-ID: <CO1PR11MB4930EF468CC9970B0A0ED7928CCA0@CO1PR11MB4930.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20201209112757.34196-1-star.zeng@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: Zeng, Star <star.zeng@intel.com>
> Sent: Wednesday, December 9, 2020 7:28 PM
> To: devel@edk2.groups.io
> Cc: Zeng, Star <star.zeng@intel.com>; Ni, Ray <ray.ni@intel.com>; Dong, Eric <eric.dong@intel.com>; Laszlo Ersek
> <lersek@redhat.com>
> Subject: [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: Use AllocatePages() for InitOrder
>
> The required buffer size for InitOrder will be 96K when NumberOfCpus=1024.
> sizeof (CPU_FEATURES_INIT_ORDER) = 96
> NumberOfCpus = 1024 = 1K
> sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus = 96K
>
> AllocateZeroPool() will call to PeiServicesAllocatePool() which will use
> EFI_HOB_MEMORY_POOL to management memory pool.
> EFI_HOB_MEMORY_POOL.Header.HobLength is UINT16 type, so there is no way
> for AllocateZeroPool() to allocate > 64K memory.
>
> So AllocateZeroPool() could not be used anymore for the case above or
> even bigger required buffer size.
>
> This patch updates the code to use AllocatePages() instead of
> AllocateZeroPool() to allocate buffer for InitOrder.
>
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> ---
> .../Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> index d4a576385f0f..ba052732a86c 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> @@ -126,8 +126,9 @@ CpuInitDataInitialize (
>
> GetNumberOfProcessor (&NumberOfCpus, &NumberOfEnabledProcessors);
>
> - CpuFeaturesData->InitOrder = AllocateZeroPool (sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus);
> + CpuFeaturesData->InitOrder = AllocatePages (EFI_SIZE_TO_PAGES (sizeof (CPU_FEATURES_INIT_ORDER) *
> NumberOfCpus));
> ASSERT (CpuFeaturesData->InitOrder != NULL);
> + ZeroMem (CpuFeaturesData->InitOrder, sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus);
>
> //
> // Collect CPU Features information
> --
> 2.21.0.windows.1
prev parent reply other threads:[~2020-12-11 10:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-09 11:27 [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: Use AllocatePages() for InitOrder Zeng, Star
2020-12-11 10:37 ` Ni, Ray [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CO1PR11MB4930EF468CC9970B0A0ED7928CCA0@CO1PR11MB4930.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox