On Mon, 2022-01-24 at 19:56 +0200, Jarkko Sakkinen wrote: > On Mon, Jan 24, 2022 at 05:44:43PM +0000, Accardi, Kristen C wrote: > > On Fri, 2022-01-21 at 11:57 -0800, Dave Hansen wrote: > > > Hi Everyone, > > > > > > There are a few SGX fixes that have showed up in the last week or > > > so, > > > mostly around RAS and fixing the backing storage issues. Could > > > folks > > > please give this branch a good thrashing? > > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/daveh/devel.git/log/?h=x86/sgx > > > > > > I'm planning to send this bunch up to Linus after 5.17-rc1 comes > > > out. > > > > > > Kristen, I really dug into the changelogs of your two patches to > > > make > > > it > > > more clear that they are bugfix and stable@ material. I'd > > > appreciate > > > some additional eyeballs there. > > > > There's a bug in the calculation for the available backing bytes, > > pointed out by Haitao and team. Here's a fix applied to your tree. > > > > From 2ebcf0e70b1235224410e08c983e357d5ac3c435 Mon Sep 17 00:00:00 > > 2001 > > From: Kristen Carlson Accardi <kristen@xxxxxxxxxxxxxxx> > > Date: Mon, 24 Jan 2022 09:28:56 -0800 > > Subject: [PATCH] x86/sgx: fixup for available backing pages > > calculation > > > > Remove improper parentheses from calculation for available backing > > bytes. Without this fix, the result will be incorrect due to > > rounding. > > > > Signed-off-by: Kristen Carlson Accardi <kristen@xxxxxxxxxxxxxxx> > > --- > > arch/x86/kernel/cpu/sgx/main.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/x86/kernel/cpu/sgx/main.c > > b/arch/x86/kernel/cpu/sgx/main.c > > index 7ed6a1b10c21..10a6af89bf64 100644 > > --- a/arch/x86/kernel/cpu/sgx/main.c > > +++ b/arch/x86/kernel/cpu/sgx/main.c > > @@ -922,7 +922,7 @@ static bool __init sgx_page_cache_init(void) > > return false; > > } > > > > - available_backing_bytes = total_epc_bytes * > > (sgx_overcommit_percent / 100); > > + available_backing_bytes = total_epc_bytes * > > sgx_overcommit_percent / 100; > > atomic_long_set(&sgx_nr_available_backing_pages, > > available_backing_bytes >> PAGE_SHIFT); > > > > return true; > > -- > > 2.20.1 > > > > So what about sgx_reclaim_pages() having no return value that Haitao > pointed out? I'm taking a look at that, and testing, and will send a separate fix.