Re: [PATCH v3 2/3] mm: Change ghes code to allow poison of non-struct pfn

Ira Weiny
2025-10-21T17:11:10Z

ankita@ wrote:
> From: Ankit Agrawal <ankita@nvidia.com>
>
> The GHES code allows calling of memory_failure() on the PFNs that pass the
> pfn_valid() check. This contract is broken for the remapped PFNs which
> fails the check and ghes_do_memory_failure() returns without triggering
> memory_failure().
>
> Update code to allow memory_failure() call on PFNs failing pfn_valid().
>
> Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
> ---
> drivers/acpi/apei/ghes.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index a0d54993edb3..bc4d0f2b3e9d 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -505,12 +505,6 @@ static bool ghes_do_memory_failure(u64 physical_addr, int flags)
> return false;
>
> pfn = PHYS_PFN(physical_addr);
> - if (!pfn_valid(pfn) && !arch_is_platform_page(physical_addr)) {

Tony,

I'm not an SGX expert but does this break SGX by removing
arch_is_platform_page()?

See:

40e0e7843e23 ("x86/sgx: Add infrastructure to identify SGX EPC pages")
Cc: Tony Luck <tony.luck@intel.com>

Ira