public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* EFI_MEMORY_ATTRIBUTES_TABLE not in runtime memory
@ 2017-09-18 19:48 Larry Cleeton
  2017-09-19  1:52 ` Zeng, Star
  0 siblings, 1 reply; 3+ messages in thread
From: Larry Cleeton @ 2017-09-18 19:48 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

The EFI_MEMORY_ATTRIBUTES_TABLE constructed in MdeModulePkg/core/dxe/misc/MemoryAttributesTable.c is allocating the table memory using AllocatePool(). It seems it should be allocated using AllocateRuntimePool(). We've observed Linux kernels seeing a zeroed table, likely because those boot services memory pages have been reclaimed and zeroed. It appears that several other configuration tables are allocated with runtime memory. I haven't found any specific statements that this table should be in runtime memory. However it seems pragmatic and consistent that it be in runtime memory.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: EFI_MEMORY_ATTRIBUTES_TABLE not in runtime memory
  2017-09-18 19:48 EFI_MEMORY_ATTRIBUTES_TABLE not in runtime memory Larry Cleeton
@ 2017-09-19  1:52 ` Zeng, Star
  2017-09-19  2:26   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Zeng, Star @ 2017-09-19  1:52 UTC (permalink / raw)
  To: Larry Cleeton, edk2-devel@lists.01.org; +Cc: Yao, Jiewen, Zeng, Star

As I know according to UEFI spec, it has no requirement about the Table needs to be in runtime memory, but only requires the list (holding Guid value and Table pointer) needs to be in runtime memory.

"The InstallConfigurationTable() function is used to maintain the list of configuration tables that are stored in the EFI System Table. The list is stored as an array of (GUID, Pointer) pairs. The list must be allocated from pool memory with PoolType set to EfiRuntimeServicesData."


Jiewen, you should know more detail about this feature.


Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Larry Cleeton
Sent: Tuesday, September 19, 2017 3:49 AM
To: edk2-devel@lists.01.org
Subject: [edk2] EFI_MEMORY_ATTRIBUTES_TABLE not in runtime memory

The EFI_MEMORY_ATTRIBUTES_TABLE constructed in MdeModulePkg/core/dxe/misc/MemoryAttributesTable.c is allocating the table memory using AllocatePool(). It seems it should be allocated using AllocateRuntimePool(). We've observed Linux kernels seeing a zeroed table, likely because those boot services memory pages have been reclaimed and zeroed. It appears that several other configuration tables are allocated with runtime memory. I haven't found any specific statements that this table should be in runtime memory. However it seems pragmatic and consistent that it be in runtime memory.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: EFI_MEMORY_ATTRIBUTES_TABLE not in runtime memory
  2017-09-19  1:52 ` Zeng, Star
@ 2017-09-19  2:26   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2017-09-19  2:26 UTC (permalink / raw)
  To: Zeng, Star; +Cc: Larry Cleeton, edk2-devel@lists.01.org, Yao, Jiewen

On 18 September 2017 at 18:52, Zeng, Star <star.zeng@intel.com> wrote:
> As I know according to UEFI spec, it has no requirement about the Table needs to be in runtime memory, but only requires the list (holding Guid value and Table pointer) needs to be in runtime memory.
>
> "The InstallConfigurationTable() function is used to maintain the list of configuration tables that are stored in the EFI System Table. The list is stored as an array of (GUID, Pointer) pairs. The list must be allocated from pool memory with PoolType set to EfiRuntimeServicesData."
>
>
> Jiewen, you should know more detail about this feature.
>

Whether the list of configuration tables is in runtime memory and
whether the tables themselves are in runtime memory are completely
different things.

Runtime memory will get a mapping in the virtual tables created by the
OS, which is only necessary if the firmware itself refers to the
contents when runtime services are in progress. Using runtime memory
so that it will be automatically protected from allocation by the OS
implies that the memory is lost even if the OS does not understand the
table type in the first place. And if it does understand the table
type, it can reserve the region itself.

In summary, using runtime memory for configuration tables is a bad
idea, and the fact that it is recommended for SMbios (and there is
even a mention that no virtual mapping should be requested, which is
impossible) is a mistake IMO.

-- 
Ard.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-19  2:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-18 19:48 EFI_MEMORY_ATTRIBUTES_TABLE not in runtime memory Larry Cleeton
2017-09-19  1:52 ` Zeng, Star
2017-09-19  2:26   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox