Re: [PATCH 02/14] x86/sgx: Add /sys/kernel/debug/x86/sgx_total_mem

From: Reinette Chatre
Date: Thu Sep 16 2021 - 11:35:53 EST


Hi Jarkko,

On 9/16/2021 7:09 AM, Jarkko Sakkinen wrote:
On Wed, 2021-09-15 at 13:30 -0700, Reinette Chatre wrote:
From: Jarkko Sakkinen <jarkko@xxxxxxxxxx>

Just like normal memory, SGX memory can be overcommitted. SGX has its
own reclaim mechanism which kicks in when physical SGX memory (Enclave
Page Cache / EPC) is exhausted. That reclaim mechanism is relatively
rarely exercised and needs selftests to poke at it.

The amount of EPC on the system is determined by the BIOS and it varies
wildly between systems. It can be dozens of MB on desktops, or many GB
on servers.

To run in a reasonable amount of time, the selftest needs to know how
much EPC there is in the system.

Introduce a new debugfs file to export that information.

Acked-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
[reinette: Use as placeholder patch until other discussions complete]
Signed-off-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>

This could be replaced with the following two patches:

https://lore.kernel.org/linux-sgx/20210914030422.377601-1-jarkko@xxxxxxxxxx/T/#t


Thank you very much. I will replace this patch and update the kselftest changes to use the information from the new source.

Reinette