From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11010015.outbound.protection.outlook.com [52.101.201.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 530FA258EC2 for ; Thu, 18 Dec 2025 21:33:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.201.15 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766093589; cv=fail; b=KkzLlRwQbQ3Jt1WAsKBah+vRnrdCtk7yBV0v5KXprQRCBZK/B8ieJgxL5s0m7tiUjcx+uh6LOb8pj4UUyZ0cmTgd/YtkgUE7W4SLVJY+I5WKK9zogHLZEaRtcwX/JLmH8Qcxo6RzZphiZBkjhu2Icottftm9wcHn7QVc6xQAH6s= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766093589; c=relaxed/simple; bh=tjcgxUfzOLb6HppVr/O6Na8u6o0OnqN8fXrqyY5Qd6k=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=l5x5YapJLLKE4jvLdd5m1weL0BIsFlE9bLNAAi+Qbqc4648tAEIyayq6aZJ1F0sBkdL3al5SrpkLPv2SqT8NAa1BHy+nPwtUQaPJ+9LuAvkthWWEn4RWpvy//Xe0EkI9uZ+X3im/38J2VwHUmbKaOs6XdGLMkHz1uG7xlkrt4CY= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=VtqvAtUM; arc=fail smtp.client-ip=52.101.201.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="VtqvAtUM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Tp0TRpkWuyCkNJu41/fQU5PMK5wCQEOUe7BKIVsYBbWCBoyxW6qYSDjkup/7Y8M7Oz8mBEiU00M2m9BOGmn0/yu3ZrDdZV83/5eEv6GpxcEGKZJLlmOUhjzUGrh3KiTU3Pfva2eK3bU9663l0j+d1mmQ+Wy8tVrv8uEkGLWD2SPfg2hdB0D+7JGmzxqMzvLQ8XriQHDrWdjiJSoVsjNfIpXQLC3YqZWOKXJaiO8Rxeu6XH1aEhe6/YzSWw3LOvy0OqQ+IIuA79RYvEuFq2vMbeMSXQM8ZeexZZI6SRUstW4K9fIxmA1107/0SdZx88oeuZ1kZt0gXBx+jF2SV5HFkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Co1Q2/89h00lDuhaECPuRdGhWOosHrQWIsfr4FBXjzY=; b=Y+0gGbU0aAiiDmdSxoCsbaelh7oB7JzySlKUOJettgzfbSHND0imG/X95qa5A9p360ajy7qhzQ5ZHDlTfmbUn1QWF19YucqR9f3k2FmkPni8Xf2E1v6PeqwgTd5or3/seWY01InEZrxKqOfxPZfxpb734Jbr8AZm1BRV0meKcOuCxD5CapnxCrN6BROThhMw7WAhyf9Ph3vTATVG3eXQ1sUlBEEi/7mz5tGHTZ3IggrTZ2PpySx4tHspE31221Ej2YJ0ycWxcQGS32OPMWy64TsvyMA9zLRLwvV7vm056MaTLtcoeHVBbkEWeNlvSxwD7XTUBdklClcgRHG7zLbiBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Co1Q2/89h00lDuhaECPuRdGhWOosHrQWIsfr4FBXjzY=; b=VtqvAtUMz8+ifgqPvuI9ojMznd/TIbfNs16TOJ9/XcorgWOmY6pnLgM4tZEBJRIUFZY7I0lqmf2tKB6YOKqPpADFTrNovqPQrFvJp9A5oB6UvYV+WbyPOTYfl5Dwk9qlX4Mv4cPD+u8z8xPvYB5MTe7CixLNsVHdv+aV78+EsDU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from IA0PPF9A76BB3A6.namprd12.prod.outlook.com (2603:10b6:20f:fc04::bdc) by BY5PR12MB4276.namprd12.prod.outlook.com (2603:10b6:a03:20f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.13; Thu, 18 Dec 2025 21:32:59 +0000 Received: from IA0PPF9A76BB3A6.namprd12.prod.outlook.com ([fe80::8d61:56ca:a8ea:b2eb]) by IA0PPF9A76BB3A6.namprd12.prod.outlook.com ([fe80::8d61:56ca:a8ea:b2eb%8]) with mapi id 15.20.9434.001; Thu, 18 Dec 2025 21:32:59 +0000 Message-ID: <95d219be-c89b-431a-974a-2e2b653f98e4@amd.com> Date: Thu, 18 Dec 2025 15:32:56 -0600 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/3] x86/resctrl: Add "*" shorthand to set minimum io_alloc CBM for all domains To: Aaron Tomlin , tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com Cc: sean@ashe.io, linux-kernel@vger.kernel.org References: <20251215230257.1798865-1-atomlin@atomlin.com> <20251215230257.1798865-4-atomlin@atomlin.com> Content-Language: en-US From: "Moger, Babu" In-Reply-To: <20251215230257.1798865-4-atomlin@atomlin.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SN7PR04CA0195.namprd04.prod.outlook.com (2603:10b6:806:126::20) To IA0PPF9A76BB3A6.namprd12.prod.outlook.com (2603:10b6:20f:fc04::bdc) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA0PPF9A76BB3A6:EE_|BY5PR12MB4276:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bf5c46c-3d3c-456e-3d07-08de3e7d03e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|366016|376014|7053199007|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?B?V0g5dC9NVlFJenJuUk5jSUlZM204Tzc4cjgwV08vL2ZvNzZlYStuQUx3M2lw?= =?utf-8?B?WFAzdHh2N0tibGl3VXp5dkoxV2R1bTFUMGdIT3dOcURUMDdoVzFvRlE5MGtQ?= =?utf-8?B?cGNHckJKODVPQWg0MWRuTDQweGR3SFN1NWlCL2hZaVhCRTNXYWpkYTAwYWlW?= =?utf-8?B?SHZpOWQweXQwVjhubTRrS3dLVXQxbElxc0gzUk1nb2NaVmVRTTNjenl4NlFn?= =?utf-8?B?eFdWSWF5OFY1WjZhQUJUbDNFdFZKdnB5N3NiUDlsZmYyNFFVWHpyOVpSVlZy?= =?utf-8?B?Yy8yMWVrS0FUd0xUeUlNMHhvektjZEhQMDZ0SmZneStDRmFNaWtvSnVHZzZE?= =?utf-8?B?ZWRYRWJsOS9zY1Q1ZFZBdWJOSVQ5dHpBa2dtMEx5ZWds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G85cFYwL1hyVkVnZDkrZkJ4cTRTZGl6aE9BVm1jUTB4?= =?utf-8?B?Mm5XTEpnWFIzelRRb09KUUhGNi9IcGFYR25uYkVoVVJSQlRHV0daNFVhRVkw?= =?utf-8?B?MVlxd20wc1VTSHJYKy9EOWRIa1VLWkpBMEd0RjlKTzdEcnRTelhtVFhaSzQ5?= =?utf-8?B?ZUJndXF5TzFPN0R6R1l6M2hKZkx1UVk5TmFXSzBpMmVPVHdjTVMyeXJXa2Y2?= =?utf-8?B?YUd6K0pQOWxBNW8vSjcwL3h5U0Z5Y2F6ODZaN2NraGlEVENWNWxGSGVOSEVN?= =?utf-8?B?TFU4TVBybDllam56aUZITGNHSmpDb2ZqVm4wS3Z1bWFMaGJjaiszT1Y1bTlD?= =?utf-8?B?TFlTS1VHbTZpUi9wSFFXZTZCaUo3VnFGdVlMZmRpRU5MbXZBUVlwNjRNeUgx?= =?utf-8?B?ZFVMQXNvamtmcGZ4eThGc0ZLQ0d3ZHZsZVBhdyt4RUNhbnBnUXBzUTBKa1Np?= =?utf-8?B?cG5SQ0dEOTZOZzlzUmZRUXMyTXNmRlROWWdjSVl5dk5wNjYwY2V3bXcwQlpT?= =?utf-8?B?STFrUWdlYkpGRHduZktrd1I2cjk5WmZQMTQ2Z1huQWhzM0JtcmgwZjd2MFlh?= =?utf-8?B?Tk95a3RsckJvVk81cjdzVGRBNm5vbi96d1Y1c1FDL3BiNnF2UGZZNE5MYUs5?= =?utf-8?B?bmJiUzczVWlIR1ZFbUhOVmlVcTFoNWQ1TWdBU2Vuc0h0dENXbkdBMnJsbExo?= =?utf-8?Q?VE9rxWAquGEwl5U75i+s3n+U8PIKjI=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA0PPF9A76BB3A6.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(366016)(376014)(7053199007)(921020);DIR:OUT;SFP:1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kejVGT2ZBZVkrRWNzUk5hWTU1?= =?utf-8?B?OEdIa0c4Y0daQjU1ZnlCSWJqN1VCeFpVNXREUmxEbDFxbDhkM054TTIwRWlT?= =?utf-8?B?MWgwVnA5WDFMMzYvK1ZOd0VkVm81UWlab09VY0o1VEU3NjI1WkZRWDV0d0Zk?= =?utf-8?B?SVdtV2hiMlloTEcwM0RqR05xOXRnN3lvQSt4VkNXY01GVXRZQUUwdXhuU3Y0?= =?utf-8?B?TkVJN0tpZE5YeWlPeENabmtURmFReEM2cEtRdmdaTzN4aXlmVk5zNVJrdGRU?= =?utf-8?B?bEJQRXdkY3VRYmgxa2xuY05kMWN6VkFPcFpwUm40K296ZUdETEtocG1IdWNu?= =?utf-8?B?bm1nbHNadXRFR29JRkxQU1FwNHNYVmZ0bVgxbE5Ob3NLMjYwNUtNWkdUWERu?= =?utf-8?Q?8/Jw=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bf5c46c-3d3c-456e-3d07-08de3e7d03e3 X-MS-Exchange-CrossTenant-AuthSource: IA0PPF9A76BB3A6.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2025 21:32:59.3517 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NQ/k5s8GjTAAs4cONZ5/HhgjYgOCvUPcA9hB7HiaRs4ImNqPj6UoAYa0PPQvIXYO X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4276 Hi Aaron, On 12/15/2025 5:02 PM, Aaron Tomlin wrote: > This patch introduces a special domain ID selector "*" for io_alloc_cbm > that allows setting the CBM of each cache domain to its minimum number > of consecutive bits in a single operation. For example, writing "*=0" to > /sys/fs/resctrl/info/L3/io_alloc_cbm programs each domain's CBM to the > hardware-defined minimum, greatly simplifying automation and management > tasks. The user is required to specify the correct minimum stored in > /sys/fs/resctrl/info/L3/min_cbm_bits. > > Signed-off-by: Aaron Tomlin > --- > Documentation/filesystems/resctrl.rst | 10 ++ > arch/x86/kernel/cpu/resctrl/core.c | 2 +- > arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 23 ++-- > fs/resctrl/ctrlmondata.c | 141 ++++++++++++++++------ > fs/resctrl/internal.h | 13 ++ > fs/resctrl/rdtgroup.c | 2 +- > include/linux/resctrl.h | 30 ++++- > 7 files changed, 174 insertions(+), 47 deletions(-) > > diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst > index 8c8ce678148a..9c128c8fba86 100644 > --- a/Documentation/filesystems/resctrl.rst > +++ b/Documentation/filesystems/resctrl.rst > @@ -215,6 +215,16 @@ related to allocation: > # cat /sys/fs/resctrl/info/L3/io_alloc_cbm > 0=00ff;1=000f > > + Set each CBM to their minimum number of consecutive bits. > + > + A special value "*" is required to represent all cache IDs. > + The user should specify the correct minimum stored in > + /sys/fs/resctrl/info/L3/min_cbm_bits. > + > + Example:: > + > + # echo "*=0" > /sys/fs/resctrl/info/L3/io_alloc_cbm > + > When CDP is enabled "io_alloc_cbm" associated with the CDP_DATA and CDP_CODE > resources may reflect the same values. For example, values read from and > written to /sys/fs/resctrl/info/L3DATA/io_alloc_cbm may be reflected by > diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c > index 3792ab4819dc..44aea6b534e0 100644 > --- a/arch/x86/kernel/cpu/resctrl/core.c > +++ b/arch/x86/kernel/cpu/resctrl/core.c > @@ -276,7 +276,7 @@ static void rdt_get_cdp_config(int level) > > static void rdt_set_io_alloc_capable(struct rdt_resource *r) > { > - r->cache.io_alloc_capable = true; > + r->cache.io_alloc.io_alloc_capable = true; > } > > static void rdt_get_cdp_l3_config(void) > diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c > index b20e705606b8..0f051d848422 100644 > --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c > +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c > @@ -57,14 +57,19 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) > hw_dom = resctrl_to_arch_ctrl_dom(d); > msr_param.res = NULL; > for (t = 0; t < CDP_NUM_TYPES; t++) { > - cfg = &hw_dom->d_resctrl.staged_config[t]; > - if (!cfg->have_new_ctrl) > - continue; > - > - idx = resctrl_get_config_index(closid, t); > - if (cfg->new_ctrl == hw_dom->ctrl_val[idx]) > - continue; > - hw_dom->ctrl_val[idx] = cfg->new_ctrl; > + if (resctrl_should_io_alloc_min_cbm(r)) { > + idx = resctrl_get_config_index(closid, t); > + hw_dom->ctrl_val[idx] = apply_io_alloc_min_cbm(r); > + } else { > + cfg = &hw_dom->d_resctrl.staged_config[t]; > + if (!cfg->have_new_ctrl) > + continue; > + > + idx = resctrl_get_config_index(closid, t); > + if (cfg->new_ctrl == hw_dom->ctrl_val[idx]) > + continue; > + hw_dom->ctrl_val[idx] = cfg->new_ctrl; > + } > > if (!msr_param.res) { > msr_param.low = idx; > @@ -123,7 +128,7 @@ int resctrl_arch_io_alloc_enable(struct rdt_resource *r, bool enable) > { > struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); > > - if (hw_res->r_resctrl.cache.io_alloc_capable && > + if (hw_res->r_resctrl.cache.io_alloc.io_alloc_capable && > hw_res->sdciae_enabled != enable) { > _resctrl_sdciae_enable(r, enable); > hw_res->sdciae_enabled = enable; > diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c > index d2f9a4f2d887..a36b9055a1be 100644 > --- a/fs/resctrl/ctrlmondata.c > +++ b/fs/resctrl/ctrlmondata.c > @@ -688,7 +688,7 @@ int resctrl_io_alloc_show(struct kernfs_open_file *of, struct seq_file *seq, voi > > mutex_lock(&rdtgroup_mutex); > > - if (r->cache.io_alloc_capable) { > + if (r->cache.io_alloc.io_alloc_capable) { > if (resctrl_arch_get_io_alloc_enabled(r)) > seq_puts(seq, "enabled\n"); > else > @@ -712,13 +712,31 @@ static bool resctrl_io_alloc_closid_supported(u32 io_alloc_closid) > return io_alloc_closid < closids_supported(); > } > > +/** > + * resctrl_sync_cdp_peer - Mirror staged configuration to the CDP peer type > + * > + * @s: resctrl schema > + * @d: resctrl control domain > + * > + * The caller must ensure CDP is enabled for the resource and must be > + * called under the cpu hotplug lock and rdtgroup mutex > + */ > +static void resctrl_sync_cdp_peer(struct resctrl_schema *s, struct rdt_ctrl_domain *d) > +{ > + enum resctrl_conf_type peer_type; > + > + peer_type = resctrl_peer_type(s->conf_type); > + memcpy(&d->staged_config[peer_type], > + &d->staged_config[s->conf_type], > + sizeof(d->staged_config[0])); > +} > + > /* > * Initialize io_alloc CLOSID cache resource CBM with all usable (shared > * and unused) cache portions. > */ > static int resctrl_io_alloc_init_cbm(struct resctrl_schema *s, u32 closid) > { > - enum resctrl_conf_type peer_type; > struct rdt_resource *r = s->res; > struct rdt_ctrl_domain *d; > int ret; > @@ -731,11 +749,8 @@ static int resctrl_io_alloc_init_cbm(struct resctrl_schema *s, u32 closid) > > /* Keep CDP_CODE and CDP_DATA of io_alloc CLOSID's CBM in sync. */ > if (resctrl_arch_get_cdp_enabled(r->rid)) { > - peer_type = resctrl_peer_type(s->conf_type); > list_for_each_entry(d, &s->res->ctrl_domains, hdr.list) > - memcpy(&d->staged_config[peer_type], > - &d->staged_config[s->conf_type], > - sizeof(d->staged_config[0])); > + resctrl_sync_cdp_peer(s, d); > } > > ret = resctrl_arch_update_domains(r, closid); > @@ -903,49 +918,103 @@ int resctrl_io_alloc_cbm_show(struct kernfs_open_file *of, struct seq_file *seq, > return ret; > } > > +/** > + * parse_domain_cbm - Parse "domain=cbm" and return either side > + * > + * @line_ptr: Pointer to the input string > + * @out_val: Output from parsed value (either domain ID or CDM) > + * @which: Selector for which side to parse > + * > + * It is assumed that *line_ptr and *out_val are valid. > + * > + * Return: 0 on success and advance *line_ptr to point past the > + * delimiter, EINVAL on parsing error > + */ > +static inline int parse_domain_cbm(char **line_ptr, unsigned long *out_val, > + enum resctrl_kv_sel which) > +{ > + char *rhs, *lhs, *tok; > + unsigned int base; > + > + rhs = *line_ptr; > + > + lhs = strsep(&rhs, "="); > + if (!lhs || !rhs) > + goto err; > + > + if (which == RDT_PARSE_DOMAIN) { > + tok = lhs; > + base = 10; > + } else { > + tok = rhs; > + base = 16; > + } > + tok = strim(tok); > + > + if (kstrtoul(tok, base, out_val)) > + goto err; > + > + *line_ptr = rhs; > + return 0; > +err: > + rdt_last_cmd_puts("Invalid domain=cbm: missing '=' or non-numeric value\n"); > + return -EINVAL; > +} > + > static int resctrl_io_alloc_parse_line(char *line, struct rdt_resource *r, > struct resctrl_schema *s, u32 closid) > { > - enum resctrl_conf_type peer_type; > struct rdt_parse_data data; > struct rdt_ctrl_domain *d; > - char *dom = NULL, *id; > - unsigned long dom_id; > + char *cbm = NULL; > + unsigned long out_val; > + int ret; > > -next: > - if (!line || line[0] == '\0') > - return 0; > + if (line[0] == '*') { > + ret = parse_domain_cbm(&line, &out_val, RDT_PARSE_CBM); > + if (ret) > + return ret; > > - dom = strsep(&line, ";"); > - id = strsep(&dom, "="); > - if (!dom || kstrtoul(id, 10, &dom_id)) { > - rdt_last_cmd_puts("Missing '=' or non-numeric domain\n"); > + if (out_val == r->cache.min_cbm_bits) { > + r->cache.io_alloc.io_alloc_min_cbm = true; > + return 0; > + } > + rdt_last_cmd_puts("Invalid io_alloc min CBM\n"); > return -EINVAL; > } > > - dom = strim(dom); > - list_for_each_entry(d, &r->ctrl_domains, hdr.list) { > - if (d->hdr.id == dom_id) { > - data.buf = dom; > - data.mode = RDT_MODE_SHAREABLE; > - data.closid = closid; > - if (parse_cbm(&data, s, d)) > - return -EINVAL; > - /* > - * Keep io_alloc CLOSID's CBM of CDP_CODE and CDP_DATA > - * in sync. > - */ > - if (resctrl_arch_get_cdp_enabled(r->rid)) { > - peer_type = resctrl_peer_type(s->conf_type); > - memcpy(&d->staged_config[peer_type], > - &d->staged_config[s->conf_type], > - sizeof(d->staged_config[0])); > + while (line && line[0] != '\0') { > + bool found = false; > + > + cbm = strsep(&line, ";"); > + ret = parse_domain_cbm(&cbm, &out_val, RDT_PARSE_DOMAIN); > + if (ret) > + return ret; > + > + cbm = strim(cbm); > + list_for_each_entry(d, &r->ctrl_domains, hdr.list) { > + if (d->hdr.id == out_val) { > + data.buf = cbm; > + data.mode = RDT_MODE_SHAREABLE; > + data.closid = closid; > + if (parse_cbm(&data, s, d)) > + return -EINVAL; > + /* > + * Keep io_alloc CLOSID's CBM of CDP_CODE and CDP_DATA > + * in sync. > + */ > + if (resctrl_arch_get_cdp_enabled(r->rid)) > + resctrl_sync_cdp_peer(s, d); > + found = true; > + break; > } > - goto next; > } > + > + if (!found) > + return -EINVAL; > } > > - return -EINVAL; > + return 0; > } Can't we just simplify to this patch without adding new data structures? diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index f7608121f5e3..d113d8a3ee02 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -874,6 +874,7 @@ static int resctrl_io_alloc_parse_line(char *line, struct rdt_resource *r, struct rdt_ctrl_domain *d; char *dom = NULL, *id; unsigned long dom_id; + bool update_all; next: if (!line || line[0] == '\0') @@ -881,14 +882,18 @@ static int resctrl_io_alloc_parse_line(char *line, struct rdt_resource *r, dom = strsep(&line, ";"); id = strsep(&dom, "="); - if (!dom || kstrtoul(id, 10, &dom_id)) { + update_all = false; + + if (id && *id == '*') { + update_all = true; + } else if (!dom || kstrtoul(id, 10, &dom_id)) { rdt_last_cmd_puts("Missing '=' or non-numeric domain\n"); return -EINVAL; } dom = strim(dom); list_for_each_entry(d, &r->ctrl_domains, hdr.list) { - if (d->hdr.id == dom_id) { + if (update_all || (d->hdr.id == dom_id)) { data.buf = dom; data.mode = RDT_MODE_SHAREABLE; data.closid = closid; What do you think? thanks Babu