Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs/resctrl: Add "*" shorthand to set io_alloc CBM for all domains

Configuring the io_alloc_cbm interface requires an explicit domain ID for each
cache domain. On systems with high core counts and numerous cache clusters,
this requirement becomes cumbersome for automation and management tasks that
aim to apply a uniform policy.

Introduce a wildcard domain ID selector "*" for the io_alloc_cbm interface.
This enables users to set the same Capacity Bitmask (CBM) across all cache
domains in a single operation.

Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Babu Moger <babu.moger@amd.com>
Tested-by: Babu Moger <babu.moger@amd.com>
Link: https://patch.msgid.link/20260325001159.447075-3-atomlin@atomlin.com

authored by

Aaron Tomlin and committed by
Borislav Petkov (AMD)
d2bf45d0 d06b8e7c

+25 -4
+8
Documentation/filesystems/resctrl.rst
··· 215 215 # cat /sys/fs/resctrl/info/L3/io_alloc_cbm 216 216 0=00ff;1=000f 217 217 218 + An ID of "*" configures all domains with the provided CBM. 219 + 220 + Example on a system that does not require a minimum number of consecutive bits in the mask:: 221 + 222 + # echo "*=0" > /sys/fs/resctrl/info/L3/io_alloc_cbm 223 + # cat /sys/fs/resctrl/info/L3/io_alloc_cbm 224 + 0=0;1=0 225 + 218 226 When CDP is enabled "io_alloc_cbm" associated with the CDP_DATA and CDP_CODE 219 227 resources may reflect the same values. For example, values read from and 220 228 written to /sys/fs/resctrl/info/L3DATA/io_alloc_cbm may be reflected by
+17 -4
fs/resctrl/ctrlmondata.c
··· 954 954 struct resctrl_schema *s, u32 closid) 955 955 { 956 956 enum resctrl_conf_type peer_type; 957 + unsigned long dom_id = ULONG_MAX; 957 958 struct rdt_parse_data data; 958 959 struct rdt_ctrl_domain *d; 960 + bool update_all = false; 959 961 char *dom = NULL, *id; 960 - unsigned long dom_id; 961 962 962 963 next: 963 964 if (!line || line[0] == '\0') 964 965 return 0; 965 966 967 + if (update_all) { 968 + rdt_last_cmd_puts("Configurations after global '*'\n"); 969 + return -EINVAL; 970 + } 971 + 966 972 dom = strsep(&line, ";"); 967 973 id = strsep(&dom, "="); 968 - if (!dom || kstrtoul(id, 10, &dom_id)) { 974 + 975 + if (dom && !strcmp(id, "*")) { 976 + update_all = true; 977 + } else if (!dom || kstrtoul(id, 10, &dom_id)) { 969 978 rdt_last_cmd_puts("Missing '=' or non-numeric domain\n"); 970 979 return -EINVAL; 971 980 } 972 981 973 982 dom = strim(dom); 974 983 list_for_each_entry(d, &r->ctrl_domains, hdr.list) { 975 - if (d->hdr.id == dom_id) { 984 + if (update_all || d->hdr.id == dom_id) { 976 985 data.buf = dom; 977 986 data.mode = RDT_MODE_SHAREABLE; 978 987 data.closid = closid; ··· 997 988 &d->staged_config[s->conf_type], 998 989 sizeof(d->staged_config[0])); 999 990 } 1000 - goto next; 991 + if (!update_all) 992 + goto next; 1001 993 } 1002 994 } 995 + 996 + if (update_all) 997 + goto next; 1003 998 1004 999 rdt_last_cmd_printf("Invalid domain %lu\n", dom_id); 1005 1000 return -EINVAL;