Intel SGX development
 help / color / mirror / Atom feed
From: "Accardi, Kristen C" <kristen.c.accardi@intel.com>
To: "linux-sgx@vger.kernel.org" <linux-sgx@vger.kernel.org>,
	"Luck, Tony" <tony.luck@intel.com>,
	"jarkko.sakkinen@intel.com" <jarkko.sakkinen@intel.com>,
	"Hansen, Dave" <dave.hansen@intel.com>
Cc: "Chatre, Reinette" <reinette.chatre@intel.com>
Subject: Re: Testing 5.17 bugfix material
Date: Mon, 24 Jan 2022 17:44:43 +0000	[thread overview]
Message-ID: <06fa9c6e691db71abec906ebce14167bb896ade2.camel@intel.com> (raw)
In-Reply-To: <53bf06e8-f523-83db-ed4d-039c34f634cd@intel.com>

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@linux.intel.com>
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@linux.intel.com>
---
 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


  parent reply	other threads:[~2022-01-24 17:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 19:57 Testing 5.17 bugfix material Dave Hansen
2022-01-22 19:15 ` Haitao Huang
2022-01-24 17:42   ` Jarkko Sakkinen
2022-01-24 17:55     ` Jarkko Sakkinen
2022-01-25  4:27       ` Haitao Huang
2022-01-22 23:41 ` Jarkko Sakkinen
2022-01-24 17:44 ` Accardi, Kristen C [this message]
2022-01-24 17:56   ` Jarkko Sakkinen
2022-01-24 20:59     ` Accardi, Kristen C
2022-01-25 12:06       ` Jarkko Sakkinen
2022-01-24 17:58 ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=06fa9c6e691db71abec906ebce14167bb896ade2.camel@intel.com \
    --to=kristen.c.accardi@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=jarkko.sakkinen@intel.com \
    --cc=linux-sgx@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox