[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9a74226ba3f76474c934cf366fc621cc933fbfbb.camel@kernel.org>
Date: Wed, 01 Sep 2021 07:30:07 +0300
From: Jarkko Sakkinen <jarkko@...nel.org>
To: Tony Luck <tony.luck@...el.com>,
Sean Christopherson <seanjc@...gle.com>,
Dave Hansen <dave.hansen@...el.com>
Cc: Cathy Zhang <cathy.zhang@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/6] x86/sgx: Add infrastructure to identify SGX EPC
pages
On Fri, 2021-08-27 at 12:55 -0700, Tony Luck wrote:
> X86 machine check architecture reports a physical address when there
> is a memory error. Handling that error requires a method to determine
> whether the physical address reported is in any of the areas reserved
> for EPC pages by BIOS.
>
> SGX EPC pages do not have Linux "struct page" associated with them.
>
> Keep track of the mapping from ranges of EPC pages to the sections
> that contain them using an xarray.
>
> Create a function sgx_is_epc_page() that simply reports whether an address
> is an EPC page for use elsewhere in the kernel. The ACPI error injection
> code needs this function and is typically built as a module, so export it.
>
> Note that sgx_is_epc_page() will be slower than other similar "what type
> is this page" functions that can simply check bits in the "struct page".
> If there is some future performance critical user of this function it
> may need to be implemented in a more efficient way.
>
> Signed-off-by: Tony Luck <tony.luck@...el.com>
> ---
> arch/x86/kernel/cpu/sgx/main.c | 10 ++++++++++
> arch/x86/kernel/cpu/sgx/sgx.h | 1 +
> 2 files changed, 11 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
> index 4a5b51d16133..261f81b3f8af 100644
> --- a/arch/x86/kernel/cpu/sgx/main.c
> +++ b/arch/x86/kernel/cpu/sgx/main.c
> @@ -20,6 +20,7 @@ struct sgx_epc_section sgx_epc_sections[SGX_MAX_EPC_SECTIONS];
> static int sgx_nr_epc_sections;
> static struct task_struct *ksgxd_tsk;
> static DECLARE_WAIT_QUEUE_HEAD(ksgxd_waitq);
> +static DEFINE_XARRAY(epc_page_ranges);
Maybe we could just call this "sgx_epc_address_space"?
/Jarkko
Powered by blists - more mailing lists