[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200625205505.GD15394@linux.intel.com>
Date: Thu, 25 Jun 2020 23:55:05 +0300
From: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To: Borislav Petkov <bp@...en8.de>
Cc: x86@...nel.org, linux-sgx@...r.kernel.org,
linux-kernel@...r.kernel.org, Jethro Beekman <jethro@...tanix.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
akpm@...ux-foundation.org, andriy.shevchenko@...ux.intel.com,
asapek@...gle.com, cedric.xing@...el.com, chenalexchen@...gle.com,
conradparker@...gle.com, cyhanish@...gle.com,
dave.hansen@...el.com, haitao.huang@...el.com,
josh@...htriplett.org, kai.huang@...el.com, kai.svahn@...el.com,
kmoy@...gle.com, ludloff@...gle.com, luto@...nel.org,
nhorman@...hat.com, npmccallum@...hat.com, puiterwijk@...hat.com,
rientjes@...gle.com, tglx@...utronix.de, yaozhangx@...gle.com
Subject: Re: [PATCH v33 09/21] x86/sgx: Add __sgx_alloc_epc_page() and
sgx_free_epc_page()
On Thu, Jun 25, 2020 at 07:06:48PM +0200, Borislav Petkov wrote:
> On Thu, Jun 18, 2020 at 01:08:31AM +0300, Jarkko Sakkinen wrote:
> > Add __sgx_alloc_epc_page(), which iterates through EPC sections and borrows
> > a page structure that is not used by anyone else. When a page is no longer
> > needed it must be released with sgx_free_epc_page(). This function
> > implicitly calls ENCLS[EREMOVE], which will return the page to the
> > uninitialized state (i.e. not required from caller part).
> >
> > Acked-by: Jethro Beekman <jethro@...tanix.com>
> > Co-developed-by: Sean Christopherson <sean.j.christopherson@...el.com>
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@...el.com>
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
> > ---
> > arch/x86/kernel/cpu/sgx/main.c | 61 ++++++++++++++++++++++++++++++++++
> > arch/x86/kernel/cpu/sgx/sgx.h | 3 ++
> > 2 files changed, 64 insertions(+)
> >
> > diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
> > index c5831e3db14a..b776d249289f 100644
> > --- a/arch/x86/kernel/cpu/sgx/main.c
> > +++ b/arch/x86/kernel/cpu/sgx/main.c
> > @@ -83,6 +83,67 @@ static bool __init sgx_page_reclaimer_init(void)
> > return true;
> > }
> >
> > +static struct sgx_epc_page *__sgx_alloc_epc_page_from_section(struct sgx_epc_section *section)
> > +{
> > + struct sgx_epc_page *page;
> > +
> > + if (list_empty(§ion->page_list))
> > + return NULL;
> > +
> > + page = list_first_entry(§ion->page_list, struct sgx_epc_page, list);
> > + list_del_init(&page->list);
>
> <---- newline here.
>
> > + return page;
> > +}
>
> Otherwise looks good; nice comments.
Thanks!
>
> Thx.
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
/Jarko
Powered by blists - more mailing lists