From: Reinette Chatre <reinette.chatre@intel.com>
To: Dave Hansen <dave.hansen@intel.com>, <jarkko@kernel.org>,
<linux-sgx@vger.kernel.org>, <shuah@kernel.org>,
<dave.hansen@linux.intel.com>
Cc: <seanjc@google.com>, <linux-kselftest@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 03/15] x86/sgx: Add an attribute for the amount of SGX memory in a NUMA node
Date: Fri, 29 Oct 2021 12:03:32 -0700 [thread overview]
Message-ID: <78a1bdf6-a5f0-0305-5e43-c1f9290d9b79@intel.com> (raw)
In-Reply-To: <eb41bbbe-8563-7b6d-3883-61ab43b0b10f@intel.com>
Hi Dave,
On 10/29/2021 11:06 AM, Dave Hansen wrote:
> On 10/28/21 1:37 PM, Reinette Chatre wrote:
>> The amount of SGX memory on the system is determined by the BIOS and it
>> varies wildly between systems. It can be from dozens of MB's on desktops
>> or VM's, up to many GB's on servers. Just like for regular memory, it is
>> sometimes useful to know the amount of usable SGX memory in the system.
>>
>> Add an attribute for the amount of SGX memory in bytes to each NUMA
>> node. The path is /sys/devices/system/node/node[0-9]*/sgx/size.
>> Calculate these values by summing up EPC section sizes for each node
>> during the driver initalization.
>
> For now, can we just make the selftests read the SGX CPUID section
> leaves? It's not as precise as knowing how much the kernel actually
> decided to use, but it's good enough for a selftest. It also means we
> can merge something without having to worry about long-term ABI.
Yes, we can do that.
>
> This is also why I once suggested that we first make the selftests
> depend on some debugfs file that would be short-lived. But, if we use
> CPUID, we don't even need to mess with debugfs.
My apologies, this was not intended to avoid your suggestion. V1 did use
the debugfs solution as you suggested as placeholder but after the
debufs solution evolved the tests were adapted to follow those changes
instead of sticking with the debugfs solution as proposed in
https://lore.kernel.org/lkml/6f3cc681e10877e639b882eaabf1a5e21bd2fc94.camel@kernel.org/
> You can even just steal the code from sgx_page_cache_init() to do it.
>
> Would that work, or am I missing something?
>
I do think that will work. The selftests are only interested in the
total SGX memory (as opposed to memory per numa node as exposed with the
current interface) and that can be obtained via CPUID. I will adapt the
oversubscription test case to obtain its needed info via CPUID.
Thank you very much
Reinette
next prev parent reply other threads:[~2021-10-29 19:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 20:37 [PATCH V2 00/15] selftests/sgx: Oversubscription, page permission, thread entry Reinette Chatre
2021-10-28 20:37 ` [PATCH V2 01/15] selftests/x86/sgx: Fix a benign linker warning Reinette Chatre
2021-10-29 0:26 ` Dave Hansen
2021-10-29 14:56 ` Sean Christopherson
2021-10-29 17:09 ` Reinette Chatre
2021-10-29 17:11 ` Dave Hansen
2021-10-28 20:37 ` [PATCH V2 02/15] x86/sgx: Rename fallback labels in sgx_init() Reinette Chatre
2021-10-29 17:59 ` Dave Hansen
2021-10-28 20:37 ` [PATCH V2 03/15] x86/sgx: Add an attribute for the amount of SGX memory in a NUMA node Reinette Chatre
2021-10-29 18:06 ` Dave Hansen
2021-10-29 19:03 ` Reinette Chatre [this message]
2021-10-28 20:37 ` [PATCH V2 04/15] selftests/sgx: Assign source for each segment Reinette Chatre
2021-10-28 20:37 ` [PATCH V2 05/15] selftests/sgx: Make data measurement for an enclave segment optional Reinette Chatre
2021-10-28 20:37 ` [PATCH V2 06/15] selftests/sgx: Create a heap for the test enclave Reinette Chatre
2021-10-28 20:37 ` [PATCH V2 07/15] selftests/sgx: Dump segments and /proc/self/maps only on failure Reinette Chatre
2021-10-28 20:37 ` [PATCH V2 08/15] selftests/sgx: Encpsulate the test enclave creation Reinette Chatre
2021-10-28 20:37 ` [PATCH V2 09/15] selftests/sgx: Move setup_test_encl() to each TEST_F() Reinette Chatre
2021-10-28 20:37 ` [PATCH V2 10/15] selftests/sgx: Add a new kselftest: unclobbered_vdso_oversubscribed Reinette Chatre
2021-10-28 20:37 ` [PATCH V2 11/15] selftests/sgx: Provide per-op parameter structs for the test enclave Reinette Chatre
2021-10-28 20:37 ` [PATCH V2 12/15] selftests/sgx: Rename test properties in preparation for more enclave tests Reinette Chatre
2021-10-28 20:37 ` [PATCH V2 13/15] selftests/sgx: Add page permission and exception test Reinette Chatre
2021-10-29 3:08 ` Jarkko Sakkinen
2021-10-28 20:37 ` [PATCH V2 14/15] selftests/sgx: Enable multiple thread support Reinette Chatre
2021-10-28 20:37 ` [PATCH V2 15/15] selftests/sgx: Add test for multiple TCS entry Reinette Chatre
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=78a1bdf6-a5f0-0305-5e43-c1f9290d9b79@intel.com \
--to=reinette.chatre@intel.com \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=jarkko@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
/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
all inboxes | Powered by JetHome®