Re: [RFC PATCH 3/7] resctrl: Add a devices file for external requester assignment

Drew Fustini <[email protected]>
Newsgroups org.kernel.vger.linux-doc,dev.linux.lists.iommu,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <anvYGuNF3MC//Q94@x1>
On Tue, Jul 14, 2026 at 09:06:53PM +0800, Zhanpeng Zhang wrote:
> Do not overload the resctrl tasks file with architecture-specific
> non-PID tokens. The tasks ABI remains a list of task IDs, while the new
> devices file carries external requesters assigned to a resctrl group.
> 
> Add architecture hooks for assigning and showing those external
> objects, and reject group removal, reparenting, or pseudo-lock setup
> while devices are still assigned. The teardown path performs a
> best-effort reset to the default group.
> 
> The devices file is an assignment interface only. It does not describe
> a new resource schema or domain; resource allocation and monitoring
> policy remain described by the existing schemata and info files.
> 
> Signed-off-by: Zhanpeng Zhang <[email protected]>
> ---
>  Documentation/filesystems/resctrl.rst |  26 ++++
>  arch/Kconfig                          |   6 +
>  fs/resctrl/rdtgroup.c                 | 206 +++++++++++++++++++++++++-
>  include/linux/resctrl.h               |  45 ++++++
>  4 files changed, 280 insertions(+), 3 deletions(-)
[..]
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index af2cbab14497..2e424c911049 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
[..]
> @@ -2067,6 +2236,16 @@ static struct rftype res_common_files[] = {
>  		.seq_show	= rdtgroup_tasks_show,
>  		.fflags		= RFTYPE_BASE,
>  	},
> +#ifdef CONFIG_ARCH_HAS_RESCTRL_DEVICES
> +	{
> +		.name		= "devices",
> +		.mode		= 0644,
> +		.kf_ops		= &rdtgroup_kf_single_ops,
> +		.write		= rdtgroup_devices_write,
> +		.seq_show	= rdtgroup_devices_show,
> +		.fflags		= RFTYPE_BASE,

Once CONFIG_ARCH_HAS_RESCTRL_DEVICES is built in, the file shows up in
every resctrl group directory, even on hardware whose IOMMU does not
implement QOSID. I think it would be better to make fflags zero so
rdtgroup_add_files() skips it, and enable it at runtime from
resctrl_init().

Thanks,
Drew
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.