I think it is possible to run into PF in SMM. SMM only allocate 4G memory by 
default, and use PF to handle >4G memory access.

On X64 version BIOS, if a platform has >4G memory, all those are reported as 
usable, and no memory type info is reported, then the DXE core will treat >4G 
memory as valid and allocate runtime services data there.

Variable driver may allocate runtime data as communication buffer, so SMM may 
access use >4G memory during boot.

Thank you

From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fan, Jeff
Sent: Wednesday, June 1, 2016 1:42 PM
To: Laszlo Ersek <ler...@redhat.com>; Kinney, Michael D 
<michael.d.kin...@intel.com>
Cc: Paolo Bonzini <pbonz...@redhat.com>; edk2-devel-01 
<edk2-de...@ml01.01.org>; Radim Krcmár <rkrc...@redhat.com>
Subject: Re: [edk2] a "strange" branch taken in the SMM fault handler in 
PiSmmCpuDxe

Laszlo,

Have you any clue on bisect this issue?

SmiDefaultPFHandler() is used to dynamically setup page entry for those address 
> 4GBytes.

If your platform is really accessing > 4GBytes address, Page Fault happened 
does make sense.
Otherwise, please check PFAddress value to understand why PFAddress > 4GBytes 
is access.

PageTable[PTIndex] = 7FFF2251 is not one valid page entry.
Usually, we encountered the similar issue due to SMM page table room was 
crashed.

Thanks!
Jeff

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Tuesday, May 31, 2016 8:20 PM
To: Kinney, Michael D
Cc: Paolo Bonzini; edk2-devel-01; Radim Krcmár
Subject: Re: [edk2] a "strange" branch taken in the SMM fault handler in 
PiSmmCpuDxe

On 05/31/16 13:42, Laszlo Ersek wrote:
> Hello Mike,
>
> our virt-QE team reported an interesting issue:
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1308678#c14
>
> We have a small UEFI_APPLICATION ((open source, of course) that
> enrolls a set of fixed certificates into PK / KEK / DB.
>
> In the course of the gRT->SetVariable() call, using the SMM driver
> stack, the fault handler function that is used in SMM is invoked:
> SmiDefaultPFHandler() in "UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c".
>
> Now, I have no clue about any situation when this fault handler should
> be invoked as part of normal operation -- perhaps there are such cases.
> But, in this instance, the function seems to walk the page tables,
> find the PTE, and realize that the Present bit is set in the PTE. Then it 
> prints:
>
>   PageTable = 7FFA6000, PTIndex = 1FF, PageTable[PTIndex] = 7FFF2251
>   New page table overlapped with old page table!
>
> The code that prints this has a comment (rewrapped here for readability):
>
> //
> // Check if the entry has already existed, this issue may occur when
> the // different size page entries created under the same entry //
>
> Can you please help me interpret this? Is it related to 2MB / 1GB
> pages, as opposed to 4KB pages? Or should I be looking for a genuine
> fault in the variable driver?
>
> I've never seen this issue, and in my normal work environment I can't
> reproduce it. In the report linked above, I noticed
>
>   -cpu IvyBridge
>
> which makes QEMU emulate "Intel Xeon E3-12xx v2 (Ivy Bridge)".
>
> Whereas my laptop has a Haswell CPU ("i7-4810MQ"), and with the
> virtual machines I use for testing, I (or rather libvirtd) doesn't
> pass any particular -cpu switch to QEMU. That seems to imply "qemu64"
> ("QEMU Virtual CPU version 2.5+").
>
> ... I've now tried with "-cpu IvyBridge" myself; I still can't reproduce it.

Hold on, I can reproduce it actually, regardless of CPU type. It seems to be an 
edk2 regression somewhere between d7c0dfa and 90bb4c5, that has been fixed 
between 90bb4c5 and current master (2f7b34b20). I'll try to bisect it.

Thanks!
Laszlo

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to