Re: [PATCH 6/8] nitro_enclaves: Expose CPU pool state under sysfs

"Arnd Bergmann" <[email protected]>
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Thu, Jul 30, 2026, at 14:53, Alexander Graf wrote:

> +static ssize_t total_show(struct device *dev, struct device_attribute *attr,
> +			  char *buf)
> +{
> +	ssize_t ret;
> +
> +	mutex_lock(&ne_cpu_pool.mutex);
> +	ret = sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&ne_cpu_pool.pool_cpus));
> +	mutex_unlock(&ne_cpu_pool.mutex);
> +
> +	return ret;
> +}
> +static DEVICE_ATTR_RO(total);
> +
> +static ssize_t used_show(struct device *dev, struct device_attribute *attr,
> +			 char *buf)
> +{
> +	ssize_t ret;
> +
> +	mutex_lock(&ne_cpu_pool.mutex);
> +	ret = sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&ne_cpu_pool.claimed_cpus));
> +	mutex_unlock(&ne_cpu_pool.mutex);
> +
> +	return ret;
> +}
> +static DEVICE_ATTR_RO(used);

The names are a bit inconsistent: you have pool/claimed for the internal
structure but total/used for the ABI. It might help to pick one set of
names here.

      Arnd
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.