linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Reinette Chatre <reinette.chatre@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 11:06:52 -0700	[thread overview]
Message-ID: <eb41bbbe-8563-7b6d-3883-61ab43b0b10f@intel.com> (raw)
In-Reply-To: <6df03c54cc8b533de4389b663ec9e4803ced1beb.1635447301.git.reinette.chatre@intel.com>

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.

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.

You can even just steal the code from sgx_page_cache_init() to do it.

Would that work, or am I missing something?

  reply	other threads:[~2021-10-29 18:06 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 [this message]
2021-10-29 19:03     ` Reinette Chatre
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=eb41bbbe-8563-7b6d-3883-61ab43b0b10f@intel.com \
    --to=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=reinette.chatre@intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).