From: "Gerd Hoffmann" <kraxel@redhat.com>
To: "Ni, Ray" <ray.ni@intel.com>
Cc: "Liu, Zhiguang" <zhiguang.liu@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>,
"Kumar, Rahul R" <rahul.r.kumar@intel.com>,
"Dong, Eric" <eric.dong@intel.com>
Subject: Re: [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging
Date: Tue, 17 Jan 2023 13:13:59 +0100 [thread overview]
Message-ID: <20230117121359.52rxmec7dv6gfksa@sirius.home.kraxel.org> (raw)
In-Reply-To: <MN6PR11MB82447DFC632BF2EF249272048CC69@MN6PR11MB8244.namprd11.prod.outlook.com>
On Tue, Jan 17, 2023 at 09:02:01AM +0000, Ni, Ray wrote:
> + Gerd.
>
> > -----Original Message-----
> > From: Liu, Zhiguang <zhiguang.liu@intel.com>
> > Sent: Wednesday, January 4, 2023 1:41 PM
> > To: devel@edk2.groups.io
> > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Dong,
> > Eric <eric.dong@intel.com>
> > Subject: [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4246
> >
> > In function InitPaging, NumberOfPml5Entries is calculated by below code
> > NumberOfPml5Entries = (UINTN)LShiftU64 (1, SizeOfMemorySpace - 48);
> > If the SizeOfMemorySpace is larger than 48, NumberOfPml5Entries will be
> > larger than 1. However, this doesn't make sense if the hardware doesn't
> > support 5 level page table.
> > + ASSERT (SizeOfMemorySpace <= 52);
> > +
> > //
> > - // Calculate the table entries of PML4E and PDPTE.
> > + // Calculate the table entries of PML5E, PML4E and PDPTE.
> > //
> > NumberOfPml5Entries = 1;
> > - if (SizeOfMemorySpace > 48) {
> > + if (Enable5LevelPaging && (SizeOfMemorySpace > 48)) {
> > NumberOfPml5Entries = (UINTN)LShiftU64 (1, SizeOfMemorySpace - 48);
> > - SizeOfMemorySpace = 48;
> > }
> >
> > + SizeOfMemorySpace = SizeOfMemorySpace > 48 ? 48 : SizeOfMemorySpace;
if (SizeOfMemorySpace > 48) {
if (Enable5LevelPaging) {
NumberOfPml5Entries = ...
}
SizeOfMemorySpace = 48
}
That is a much more readable version.
The only effect I can see is that this avoids creating page tables which
would not be used anyway.
Can you explain where the hangs mentioned in the subject line are coming
from and why the patch fixes them?
take care,
Gerd
next prev parent reply other threads:[~2023-01-17 12:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-04 5:41 [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging Zhiguang Liu
2023-01-12 12:11 ` [edk2-devel] " Zeng, Star
2023-01-17 8:44 ` Wu, Jiaxin
2023-01-17 9:01 ` Ni, Ray
2023-01-17 9:02 ` Ni, Ray
2023-01-17 12:13 ` Gerd Hoffmann [this message]
2023-01-17 12:48 ` [edk2-devel] " Ni, Ray
2023-01-18 1:13 ` Zhiguang Liu
2023-01-18 8:53 ` Gerd Hoffmann
2023-01-18 9:12 ` Zhiguang Liu
2023-01-18 10:10 ` Gerd Hoffmann
2023-01-18 15:27 ` Ni, Ray
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=20230117121359.52rxmec7dv6gfksa@sirius.home.kraxel.org \
--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