[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YTsAjCZQ6AaWDjD1@kroah.com>
Date: Fri, 10 Sep 2021 08:51:56 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Jarkko Sakkinen <jarkko@...nel.org>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
"Rafael J. Wysocki" <rafael@...nel.org>, linux-sgx@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 1/3] x86/sgx: Report SGX memory in
/sys/devices/system/node/node*/meminfo
On Fri, Sep 10, 2021 at 03:17:24AM +0300, Jarkko Sakkinen 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 SGX_MemTotal field to /sys/devices/system/node/node*/meminfo,
> showing the total SGX memory in each NUMA node. The total memory for
> each NUMA node is calculated by adding the sizes of contained EPC
> sections together.
>
> Introduce arch_node_read_meminfo(), which can optionally be rewritten by
> the arch code, and rewrite it for x86 so it prints SGX_MemTotal.
>
> Signed-off-by: Jarkko Sakkinen <jarkko@...nel.org>
> ---
> v4:
> * A new patch.
> arch/x86/kernel/cpu/sgx/main.c | 14 ++++++++++++++
> arch/x86/kernel/cpu/sgx/sgx.h | 6 ++++++
> drivers/base/node.c | 10 +++++++++-
> 3 files changed, 29 insertions(+), 1 deletion(-)
Where is the Documentation/ABI/ update for this new sysfs file?
>
> diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
> index 63d3de02bbcc..4c6da5f4a9d4 100644
> --- a/arch/x86/kernel/cpu/sgx/main.c
> +++ b/arch/x86/kernel/cpu/sgx/main.c
> @@ -717,6 +717,7 @@ static bool __init sgx_page_cache_init(void)
> }
>
> sgx_epc_sections[i].node = &sgx_numa_nodes[nid];
> + sgx_numa_nodes[nid].size += size;
>
> sgx_nr_epc_sections++;
> }
> @@ -790,6 +791,19 @@ int sgx_set_attribute(unsigned long *allowed_attributes,
> }
> EXPORT_SYMBOL_GPL(sgx_set_attribute);
>
> +ssize_t arch_node_read_meminfo(struct device *dev,
> + struct device_attribute *attr,
> + char *buf, int len)
> +{
> + struct sgx_numa_node *node = &sgx_numa_nodes[dev->id];
> +
> + len += sysfs_emit_at(buf, len,
> + "Node %d SGX_MemTotal: %8lu kB\n",
> + dev->id, node->size);
Wait, that is not how sysfs files work. they are "one value per file"
Please do not have multiple values in a single sysfs file, that is not
acceptable at all.
thanks,
greg k-h
Powered by blists - more mailing lists