From nobody Tue Dec 16 21:27:06 2025 Received: from CWXP265CU010.outbound.protection.outlook.com (mail-ukwestazon11022105.outbound.protection.outlook.com [52.101.101.105]) (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 22DB0328244 for ; Mon, 15 Dec 2025 23:03:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.101.105 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765839792; cv=fail; b=BqdrAOYRP0RPdIxxiJs5YEvk1C24+HpLkHKVy6gFz6H+Fdz5PvHjtArovzo13YrL/CATbHhm0IKpkN9EqQUA40881s/DhoMl73qdgv3uWj85A0uKCdOEM5zevd31l3WGeF1C7bkfSZiIUnGI4TuTi0J5AkukC8MXBIaqmxgLDOo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765839792; c=relaxed/simple; bh=enZX1Rq/78GCFdmHNhTQaNxXQGv6bg0+XmHqg6eK2i4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=RFrPaHDw7z+90bLqrD77jNJUPeTChHJ5w7e+kFgGDG6VZpdT9N/KdssY02XZMzmodeRJoDV0Tm9vWT8j2hllGXbaRQ0ckoyfGfNL7GWnJfpgjA07VQKDLDtlor4676DTgJ8S/85sGXApXBq2lBfduVcFhIGvt5bm3wpyYDTKKEo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomlin.com; spf=pass smtp.mailfrom=atomlin.com; arc=fail smtp.client-ip=52.101.101.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=atomlin.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UmotDBU4CzQgoLeXveM7cJuqIORYB+kXSL+Y9EqRE68rUOdt3x5cfes2T4UDpFDtUIMBbT/1+HPsyR/fsbUiBCFHRwLXME6X8LsHldDmfxXSEP9/ljjFJhIJpayjktq6LOPWKB1pwHDxefBnRrlpTRl8Io2lDQKtXRxiq6Q6sBpDur6kAVG4mdzvPv8hfuY0uGGrwLTJGu8A7ZetanUZbun/AgQG94iLdxLAxbAwo2QhTDZ93UNf5SBOAc6n0MiqC3nm9lJ+SwAhnaPCzLVMijSXIKljjbwlawYtUQq83cRBwZfddEo6dN2tXVdukHdjRMAQ6nS8BQ57tVSrSi2Y5A== 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=6FCpJpkJje3OqOvqjnNIWMG78fYepFUcNy2tqcISvvA=; b=lGSv1aVKQyo2uu7izzdP+WXlw+5ViCAe7cwsuGBKNazUZRgIitOJue6XzG7PV3VNgF4wiI4jdFsR7XLkEDqZamT95Ww6g0wnmKC1fjTKyI5wUkGm1S5EaGrcA3f28fU2uDiorurvGy11xCA3FBvwniLKTnm84wtXziacSHWknGxzk4QjZOYTQCf4/vDUii+KSfQQMDqFLcSelUWHbLfWRJixCoY4K/G/rGzosbVS/7QQ+ZHy/NwzYeR72V7xCBjvLzb2AV/Cgi3vEaiXuBWP4Xgwl3Hw9Xbsc4imH4U8PHMCg1bkhsYOG0fEWqr4ZKB7h2BFNsHcgDH1kTDwRfucgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=atomlin.com; dmarc=pass action=none header.from=atomlin.com; dkim=pass header.d=atomlin.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=atomlin.com; Received: from CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:70::10) by LO0P123MB6302.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:291::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.13; Mon, 15 Dec 2025 23:03:08 +0000 Received: from CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM ([fe80::de8e:2e4f:6c6:f3bf]) by CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM ([fe80::de8e:2e4f:6c6:f3bf%5]) with mapi id 15.20.9412.011; Mon, 15 Dec 2025 23:03:08 +0000 From: Aaron Tomlin To: 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: dave.martin@arm.com, atomlin@atomlin.com, sean@ashe.io, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] fs/resctrl: Add helpers to check io_alloc support and enabled state Date: Mon, 15 Dec 2025 18:02:55 -0500 Message-ID: <20251215230257.1798865-2-atomlin@atomlin.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215230257.1798865-1-atomlin@atomlin.com> References: <20251215230257.1798865-1-atomlin@atomlin.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BN0PR04CA0146.namprd04.prod.outlook.com (2603:10b6:408:ed::31) To CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:70::10) 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: CWLP123MB3523:EE_|LO0P123MB6302:EE_ X-MS-Office365-Filtering-Correlation-Id: c9d525f9-8bc6-470a-fbb5-08de3c2e1c69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ys8NEDK2wTccFWkB6dmuw/yqR+/4oat2ym7E/CuUPL1Hv9bjQywAxxYr5L5/?= =?us-ascii?Q?YenaX1uVEfPnwCwJfiWM8Xb9XV3iWIFHmHVzd5Tiha/sW0Okc6rHNKXCzxK/?= =?us-ascii?Q?cZqG0nhJnOIP3oKXDujzzgDvlzktKAcCpobQY+rfZYsrcJed/0Bt5aFUPPwc?= =?us-ascii?Q?Ux6jDIvd0hSX8O9Yw8d4DcznFouEkdeA8uWkxOcf/eROAExW9easOtsCwbZV?= =?us-ascii?Q?vsuYLaP7DJrMYfbUr5zFopIza1nqGKfO7hGLgLmkJgatNGriuDCCviBE0sGn?= =?us-ascii?Q?VdDxjPwd/qzjgCrh7IBcHsQ5Opho6XMm8dc3TL6n23kLXJtZH/hiPGgMUPNA?= =?us-ascii?Q?7N50ai/sgTkBplw4LuPc+TsciA7tea8vfURs4IJUvmG6cJlmVbM+poxOV6Y4?= =?us-ascii?Q?NhHWwN8dDSujtMHicspM1sU3/LWaqsyxVSmqemLZz9jCqJtnAmmuh7g7cRSn?= =?us-ascii?Q?myRzqIr6rcxK3JhVRZxou/kVDRytOMxiyXtIKTL/4QjeKgtKilOfPioA973D?= =?us-ascii?Q?vcRqqgFfx0JSmabQN1n2qt6iZY3J3wBWur+QT3bbVqk0FQvax+jFLH1kb/3r?= =?us-ascii?Q?hcIKu0aX/cgU8bSY9U+RCIy7crc7+gjjruWdb3IvuTl0foZwxaGp++V3iogd?= =?us-ascii?Q?GED9SlRBFSfxtZc1Xy/3DDpoDUqNzOVuuw8cCJ6Pulr6qwZdgQQGkRXa1vVQ?= =?us-ascii?Q?gOSdlRDuMMzzkFsbLHrG7Ebz3IVWxX/IvYur7EEcnHDxahkEarEG53vXHzxq?= =?us-ascii?Q?/Z5Vb9e4y67CjN49LrUqVgKaAc1aO/60LijXMHUv36vman3JmKGf8b/VXKYy?= =?us-ascii?Q?8C9YIvffjv1wkWlsMbxtq8lpzY0XZtDesKngG+e8cV83WH+MaVeuiU8iq5oL?= =?us-ascii?Q?9YlXXkNcJWGwExNWgrABftl6Y//Fs3j4c8acYDJUJ10+UhpJtSiQa/RUnqas?= =?us-ascii?Q?hIDTuwCosOSEEZONFQFCnwK2BCnRmPbO7iQ+5BPOD1+PeLxYZBGIt+4JRGBM?= =?us-ascii?Q?AX6pZKJBhgK52c7a1B78tHn5S7hq8dyGl6r7JVRCOvUpsFRqwDv9dJexvnUA?= =?us-ascii?Q?ap8CMsiO5rvDhdoXFsLmNTfDbuLL1Nn5D1oRuZ/YdHXx9tHoppXCzZ8y5t5Z?= =?us-ascii?Q?J3qHYAOgfF81GpohnBcf/9TUBlPmyydnBqo1ItcDPkhVtroiicn8woCo2+Dh?= =?us-ascii?Q?chfTjVsj0jxz44iHkKgjG7kzsnBNdxnyU94G5w48F8LpTkWm7SoHfvE3Gjk7?= =?us-ascii?Q?Ci6CFDeK+zTkcQGU84Nry6Efa8zj9W5ZeXiFU/0QzthYRYo5q2cKCp1627vM?= =?us-ascii?Q?yH/iDn/YyWc6mHDkbnTkhpNUxn5GLjfHb/b2m7iVxUKoQso7oG0pOxkCIANB?= =?us-ascii?Q?uykaa/gLkUa4MqVhkGpBGswKPkZuxIj/Xo18D55yckhGjjl4//xbQ80OP6b7?= =?us-ascii?Q?yE3U0Ei2RgkyJD1LwCRvbyv0tcSpofkl?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?x1mSudgcQczb/xOLKpMvA2Z3EuSCUoXPPo2IN1b+LrtRAGSG2sWeZ3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2F/6TwKKtKYZMwEXRlQ1dV85mVcssJL9UE6sd0Ddk7?= =?us-ascii?Q?VhE16shtl4nYWLfcEyoiCEgByCcpUC2MMuwhwzSYxyrArWwVZTx/z8M4kUHa?= =?us-ascii?Q?RMFOzBsI6WvOizXxhrsCW9MgBkCLQaPvXvSnEvVs198QjSU7HIuDBygmYNpk?= =?us-ascii?Q?BZddJQb+VnyDnPgB3o4HvXCuuhQ2t55x3oSfvpZAd5jpV3XFq9r/4pDXv5d/?= =?us-ascii?Q?mXzYXrimDxO1bGb3D1Awpbk04ygdGhhPEjX/OZuCp6QTKjKxOovcR67ubpZ5?= =?us-ascii?Q?dWZ0+ay83ogiCHSQD8UzHMx0zZodwX3XJHLKKxnXH8TLHVYIoZwx5KJK1hgG?= =?us-ascii?Q?J4sK7SAAiunrn04o1OWV+4p/EUChbBLCipLrUkJlFjkILHPhm1kBdxlcOYcW?= =?us-ascii?Q?Vu+aRbHy6na7nBsQMvQtqcwmRzjp1eQJaY3bPZzajFlQp1zUazaMBGr1xUJV?= =?us-ascii?Q?BAW9nU9bNmjvTXE6deZQUFvWNT+xZPQfxvZZa2rpG0S8nn0PgM1mjI9/t2mU?= =?us-ascii?Q?FYJSgX/DwEdH7qLHcQ7pwOFBwc+7oI2fvo1/UDpebcTdw7cmh/g0TZTb4sy7?= =?us-ascii?Q?YZe0nRy/Br+LoSXCCmgs4uvtHN82WG6IZV6BgX3Yu7z+Ze5COZkyf5t12pIz?= =?us-ascii?Q?XaubbW/wtO2j4g1TpbUzrLI/9lR8vb+RCDNb1wGW?= X-OriginatorOrg: atomlin.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9d525f9-8bc6-470a-fbb5-08de3c2e1c69 X-MS-Exchange-CrossTenant-AuthSource: CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2025 23:03:07.9222 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e6a32402-7d7b-4830-9a2b-76945bbbcb57 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OQCj4SQw987r41JQJm84pzZnCIpbKBIs5fsEToEII70nkx5N6oWYPdHZ6gcLdCjwjz0RGQl+Np1YN2LGkGH63g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P123MB6302 Content-Type: text/plain; charset="utf-8" This patch introduces two helpers to validate io_alloc support and whether it is enabled. This reduces code duplication, clarifies intent, and preserves existing semantics and messages. Signed-off-by: Aaron Tomlin --- fs/resctrl/ctrlmondata.c | 74 +++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 20 deletions(-) diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index b2d178d3556e..d2f9a4f2d887 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -758,6 +758,50 @@ u32 resctrl_io_alloc_closid(struct rdt_resource *r) return resctrl_arch_get_num_closid(r) - 1; } =20 +/* + * resctrl_io_alloc_supported() - Establish if io_alloc is supported + * + * @s: resctrl resource schema. + * + * This function must be called under the cpu hotplug lock + * and rdtgroup mutex + * + * Return: 0 on success, negative error code otherwise. + */ +static inline int resctrl_io_alloc_supported(struct resctrl_schema *s) +{ + struct rdt_resource *r =3D s->res; + + if (!r->cache.io_alloc.io_alloc_capable) { + rdt_last_cmd_printf("io_alloc is not supported on %s\n", s->name); + return -ENODEV; + } + + return 0; +} + +/* + * resctrl_io_alloc_enabled() - Establish if io_alloc is enabled + * + * @s: resctrl resource schema + * + * This function must be called under the cpu hotplug lock + * and rdtgroup mutex + * + * Return: 0 on success, negative error code otherwise. + */ +static inline int resctrl_io_alloc_enabled(struct resctrl_schema *s) +{ + struct rdt_resource *r =3D s->res; + + if (!resctrl_arch_get_io_alloc_enabled(r)) { + rdt_last_cmd_printf("io_alloc is not enabled on %s\n", s->name); + return -EINVAL; + } + + return 0; +} + ssize_t resctrl_io_alloc_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off) { @@ -777,11 +821,9 @@ ssize_t resctrl_io_alloc_write(struct kernfs_open_file= *of, char *buf, =20 rdt_last_cmd_clear(); =20 - if (!r->cache.io_alloc_capable) { - rdt_last_cmd_printf("io_alloc is not supported on %s\n", s->name); - ret =3D -ENODEV; + ret =3D resctrl_io_alloc_supported(s); + if (ret) goto out_unlock; - } =20 /* If the feature is already up to date, no action is needed. */ if (resctrl_arch_get_io_alloc_enabled(r) =3D=3D enable) @@ -839,17 +881,13 @@ int resctrl_io_alloc_cbm_show(struct kernfs_open_file= *of, struct seq_file *seq, =20 rdt_last_cmd_clear(); =20 - if (!r->cache.io_alloc_capable) { - rdt_last_cmd_printf("io_alloc is not supported on %s\n", s->name); - ret =3D -ENODEV; + ret =3D resctrl_io_alloc_supported(s); + if (ret) goto out_unlock; - } =20 - if (!resctrl_arch_get_io_alloc_enabled(r)) { - rdt_last_cmd_printf("io_alloc is not enabled on %s\n", s->name); - ret =3D -EINVAL; + ret =3D resctrl_io_alloc_enabled(s); + if (ret) goto out_unlock; - } =20 /* * When CDP is enabled, the CBMs of the highest CLOSID of CDP_CODE and @@ -928,17 +966,13 @@ ssize_t resctrl_io_alloc_cbm_write(struct kernfs_open= _file *of, char *buf, mutex_lock(&rdtgroup_mutex); rdt_last_cmd_clear(); =20 - if (!r->cache.io_alloc_capable) { - rdt_last_cmd_printf("io_alloc is not supported on %s\n", s->name); - ret =3D -ENODEV; + ret =3D resctrl_io_alloc_supported(s); + if (ret) goto out_unlock; - } =20 - if (!resctrl_arch_get_io_alloc_enabled(r)) { - rdt_last_cmd_printf("io_alloc is not enabled on %s\n", s->name); - ret =3D -EINVAL; + ret =3D resctrl_io_alloc_enabled(s); + if (ret) goto out_unlock; - } =20 io_alloc_closid =3D resctrl_io_alloc_closid(r); =20 --=20 2.51.0 From nobody Tue Dec 16 21:27:06 2025 Received: from CWXP265CU010.outbound.protection.outlook.com (mail-ukwestazon11022129.outbound.protection.outlook.com [52.101.101.129]) (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 DA88D2E7179 for ; Mon, 15 Dec 2025 23:03:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.101.129 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765839800; cv=fail; b=JL+m9tm6zA8BrCj/FgH9HJ7HyUmdwqaOC1GvBlEGvHtHSdWnUybiYS6t5WoLSQhpqg+QvpHuyIZadk79WlfNRbHexaJldD4mp35GYU/xJykQ9UdlmAKN/dJplB/Yu5Xnc031YoJ6aaAGneKriC0eEJqUu27QmaTz5eVy7xAbRaw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765839800; c=relaxed/simple; bh=ZuXeCOJ42/hxVLhNwm9UnPetuv0DLGA2xSrc1BZCijM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=oOWcosqK8z3SFguqK1GsX9Jrl8WphKVbZDVsk/uQL/T7ZX6TEycZ82+NrSKs25ci0Xl65ffCFNDATvRzXRsIRZG/LO7AuyrAIcUxG207OwWHL12+ch0jb9IONJjtriz3ZR7HR3Qrmhw+rKssJ2hF0x26WKb7elHybC92jx+ZZcU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomlin.com; spf=pass smtp.mailfrom=atomlin.com; arc=fail smtp.client-ip=52.101.101.129 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=atomlin.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=M9STUNHbawE8rY2PU41nU2bL1aBnoYDTXV2G5dq5MpO/9etYSbdcSptYVOluEzY5yWreDsN20TOS4z2wCQ/62Sc42PTniDCipEENL/Qinvg/+4DANs2Df/3mAvaZm98gDs4bwqkawfqAblcCFjKrHdeH+rT7/rklgiEsxwBFIJlpKYUsv2Lhe+qnOVTHRQHA0VdYJNSnZgZg8+/nrCKFg4djuqP4VT+J2SkuWSSc6zxb67QQiuWbnCqpefjryzE8p56zR+6AfM/VR4RhkRLxtnNaP6jRVmmz2znWVovwtnHbHlOmP5U1W+CG7amiFQrRdC9Qjqb4ri6uG3spXugfrw== 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=+Pyz6fyVGVYC1f6yfvl2+opqbPF6e8dX7Nhdc0VwJt4=; b=KT3izYssFFEVUsV1E2kpnghl1k3gbWRrfnDr8OKH6DTrSBB5r8nWhPVTznRc2ATK7mITxcYqpMwQ+MbT8UcADv3ZZYnEQ1LVfQXzkJwT053zWptH1MQbalcRh1ne6SkiUKX9yY1zypn+/btwWO4aGumLppIDA4dXC5eH89RZM3Ki1U7KyyovFpHnzEdxrbYcuWyn2LwrkbG0fQ1h3AxeWfZysZJe0EOBnBQkvLCWn1xfxc7E7g5yVzTwiQ8a7mTbXoIwS7nFA5DX6UuIjPWgNisjwKlpsoh0QpNfwsLyp6C7aDIwb68lvbZCDC1F/6xhSwN4H03usenidX7QSkeAOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=atomlin.com; dmarc=pass action=none header.from=atomlin.com; dkim=pass header.d=atomlin.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=atomlin.com; Received: from CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:70::10) by LO0P123MB6333.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:288::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.13; Mon, 15 Dec 2025 23:03:12 +0000 Received: from CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM ([fe80::de8e:2e4f:6c6:f3bf]) by CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM ([fe80::de8e:2e4f:6c6:f3bf%5]) with mapi id 15.20.9412.011; Mon, 15 Dec 2025 23:03:12 +0000 From: Aaron Tomlin To: 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: dave.martin@arm.com, atomlin@atomlin.com, sean@ashe.io, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] fs/resctrl: Return -EINVAL for a missing seq_show implementation Date: Mon, 15 Dec 2025 18:02:56 -0500 Message-ID: <20251215230257.1798865-3-atomlin@atomlin.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215230257.1798865-1-atomlin@atomlin.com> References: <20251215230257.1798865-1-atomlin@atomlin.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BN1PR10CA0014.namprd10.prod.outlook.com (2603:10b6:408:e0::19) To CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:70::10) 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: CWLP123MB3523:EE_|LO0P123MB6333:EE_ X-MS-Office365-Filtering-Correlation-Id: e5fef6eb-77be-40c5-b66e-08de3c2e1eec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6j2dJH+jWc65TusorbpTb6REJ9b1Wv/wLsr3vqdUwC3Adv1SeWbcvemCNbBP?= =?us-ascii?Q?feq+gawa+67/w+Rvk9x8qG1/SdsW9Pcv8aifz3qh4hSlrzWi5rxNf0KANDDr?= =?us-ascii?Q?gzJoTs3svd2NPbSzG1rxwfRLcGzjs/UuOgBvUdLLnvOKuJHQxlGgvCw76Pmi?= =?us-ascii?Q?jauxvbqRYxsIzJq1YGd23+ml1q0LFepDSPRF9nU47HDM5CeEAsdivSRWEBfw?= =?us-ascii?Q?YTppZb9lWHFcAJlB0d+z5jYvlhqHVVcxw73z/j92yRj+oXFF6ld1Poc7JGio?= =?us-ascii?Q?Ic26qNlVOUtTOLGyR7znnfwic2WqEyV58M/DiW1KmRRlv9AhiQGQY08YeLSm?= =?us-ascii?Q?inOV7DeAxxecXVuCccewggHhg7ztx7rs7GI7ikUXMXIdLF8xdBhhTWX9c24E?= =?us-ascii?Q?iK9up3+D+mU94IHywZu8VIKHatQAKHs5xGtI/SMZiRxnIs1A4W7EuyrJlUKA?= =?us-ascii?Q?Jc4LMdf5k5LA2eoDFOMENo8bVFUhNsluWD8PvcdJ7N5sz5VlnXY6N56MtbaT?= =?us-ascii?Q?34z2QEduj43ADTLthLEoLbEvu0BsW/Jg/8/LDRT4ULzCGkAkC1vKMv2CNHwy?= =?us-ascii?Q?2750F+RbImGMXyb/cvi2PGaHzncsfmQbsGgOeNy5NFLffoRrEP0PLDOuXolg?= =?us-ascii?Q?J98ZatS0eXUEyD+zJl8pGCBtsq/WsHnsqNGxQYZVxGjGAk2QNwzF7YK3r4Q1?= =?us-ascii?Q?0yX4WmC5OZaOdbiq9notre8GTLM7s/dzGjwH+aJZTj+uzgybTDhxsqijvuPI?= =?us-ascii?Q?pWg9ND6LiNHZ3c8uqz1FWKDIihMk2NMMK7CuuqMi8lhcwR6Kws4PMIE2yvA8?= =?us-ascii?Q?uAbKFofYwjNyMG/rmYSfi74FLCPDCTQ6X3ACtcjo9ThGYaBTuXQiom7g6Zqz?= =?us-ascii?Q?QkYE6vHF2Du88R8x6MdikXSPiyCt1tuTdCeqc3VgzJ7lAzX5S4Eu+n1Xv0/b?= =?us-ascii?Q?UyH/7Gp547rKbxv7nlmBoAzwCqzFcQ1+5GhQ0TheoKRjF3jqCO0mox0/4d1j?= =?us-ascii?Q?Y73gFOkYtDvdveeFcyuyDHhM+/bFWsw91w7QMbDCLie5bAIyLNnN0QKdcA+n?= =?us-ascii?Q?WGJWUC8K50kvVdDAjrvmT/tzvaDHE+f5F7mLweS71Sgfp0jFyXkLBHmd0bL+?= =?us-ascii?Q?WBsWWiYOTEhSTZpZWcpr3f8DsslcYTLpv5zuelsICHl92R0v2Y1byy6q/VfS?= =?us-ascii?Q?yNpsqn4fgozTgv/VjdoCXucCGvOn8TQJ2LI76CgCIIt/GA9TgEGVQO6RKqVt?= =?us-ascii?Q?pvXccRJ5ZkIurqVrEcFwVCKacXkFExWuD7K7P4nd3aQiCI7bbKWdOuVsozxp?= =?us-ascii?Q?+WE6Z2aIqgkPXHhF1mntNBBM0xw88AsnrWr+iaSpGGEQH2Ncx1Re4csIsd58?= =?us-ascii?Q?ke9KFOU4Z6xjY1v+4CAlnDx0jec4MbcmtGrc6UTXvR9cWQnKV0svPaex23pU?= =?us-ascii?Q?AuZWlJsDJP4me33y+7CLe9mLyTumT9L1?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?oR8hedxctMudwOYMpp9eXX2e/x5OlYjS34FZSRfNvo5796X7P467T9vjJaYn?= =?us-ascii?Q?yRYwyi2TWxsf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=?us-ascii?Q?lbl6gygLjmjuqDIzApqIDzh2cySCQyrzaU/oTsI6MLs1o3JjafNmMG5Ou7cw?= =?us-ascii?Q?rhX2fB14WPjcpV5CPrOKlcNDlRJPrECwgCS004MobN3UoyfN3c4T/wdA6B05?= =?us-ascii?Q?nf/lzd/v/Y8u+sH91RGnotL3yRhMzpVWetfehOKvAphHQqEZNh8HJn0sQXQn?= =?us-ascii?Q?y3admWvpDikZepi6IIMHF3yLw/MEWQdhAEGdc5PnXsobXIX8IR0Xd5FtV3Rq?= =?us-ascii?Q?jD8z9exqTGgsAlYzE33iYGKefqjq+I3xGYWYi+4LoC15taiXTZUnvYGFOsI2?= =?us-ascii?Q?973T5QunqbVaVv1rpjUtqIi9wbsMUbv+77tlIdwO1PoAFcXlQ6P8jxHXhz84?= =?us-ascii?Q?EdjfTdxsOM++FfQ+HXLW1RfLyUUo3TGDf/Jbh4sTdHfE7B25FSstfEWclJUW?= =?us-ascii?Q?SNkI/kMDSgSY0lQ3ROjJT0IWh2mao3ctnMLz63dSt9AwXOH6tXNsq60tgHtj?= =?us-ascii?Q?DuHN1ZwtAfgZ6Wy48avkuF/rC128ia8VteA4Zk8sTVQO/xN8cZUXnCbeLVWw?= =?us-ascii?Q?OTZmEhSEC3XRhkmkN4NPs6vjxCq8qu/iRxG2McN0YFi47iku2jaZdp0nl38o?= =?us-ascii?Q?xFdxaunNl8fJIkJbzQqlOVGVSfutJDpgMYfzANsV?= X-OriginatorOrg: atomlin.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5fef6eb-77be-40c5-b66e-08de3c2e1eec X-MS-Exchange-CrossTenant-AuthSource: CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2025 23:03:12.3563 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e6a32402-7d7b-4830-9a2b-76945bbbcb57 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ANyFTa2CftFVBErIzQ5S2q9HHKwgTslhKtX7+njq13TQqD3sdVvPoD+gHPNBILhdf9/MD91vRKqy9UQEBCEmVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P123MB6333 Content-Type: text/plain; charset="utf-8" The rdtgroup_seqfile_show() function, which is the sequence file handler for reading data from resctrl files, previously returned 0 (success) if the file's associated rftype did not define a .seq_show implementation. This behavior is incorrect and confusing, as a read operation that does not define a display function should be treated as an error. This patch change the function to return -EINVAL if the file type handler (i.e., rft->seq_show) is NULL, providing proper feedback that the operation is invalid for that file. Signed-off-by: Aaron Tomlin --- fs/resctrl/rdtgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 8e39dfda56bc..e1dc63b2218f 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -314,7 +314,8 @@ static int rdtgroup_seqfile_show(struct seq_file *m, vo= id *arg) =20 if (rft->seq_show) return rft->seq_show(of, m, arg); - return 0; + + return -EINVAL; } =20 static ssize_t rdtgroup_file_write(struct kernfs_open_file *of, char *buf, --=20 2.51.0 From nobody Tue Dec 16 21:27:06 2025 Received: from CWXP265CU010.outbound.protection.outlook.com (mail-ukwestazon11022129.outbound.protection.outlook.com [52.101.101.129]) (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 D8E19324B33 for ; Mon, 15 Dec 2025 23:03:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.101.129 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765839803; cv=fail; b=Q7kzchGuvtcrQJ6x70RDGzawo68iRMw9pKEADdunaOIHO5D//P8be/tmomoSS/pdYgqa6kHTc4wCE2Bl8la5Y1IYQYDpJkj7OhFCkH/xgoiUNWol2VKiqwzL0N2woFG1UGpwNbT90iv+vQ2nvPHni+2Nl1y0X2bSxey5Gq4yHHE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765839803; c=relaxed/simple; bh=vJW5C4TVbx16enXhLAiDp7ChtgmQm9zXavnRzxUvSsQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=SXm8MiSwqr8zRy4x4BaRM+sOb19+7JaiuxheqmGouEckaJEeGsPzwp/ddAeemTOqKvIJowIJLI7aVESs1d8+qsg8l6hE+ialg9Wxw2M4b8re3hmPeeNqDpzJnuE9Cdcme+792kf4mumlbPgIFrZnOE6/9XP29NMzzci79gKNbU0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomlin.com; spf=pass smtp.mailfrom=atomlin.com; arc=fail smtp.client-ip=52.101.101.129 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=atomlin.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GOQ4tG5VzajXE9TZZ15uYn66NOdvOaT2UhWTV5p1zuS9kjHIN7H+DXeR+IDWE8CfYndRlT44YW/Vw6qxZ3A4oAmcCM4Vdze45JhnmdkY+2GmTxqROup9AbHn7A3f3WwDLs4SGY0WSt3HnC0HAjsbC/qihUgYrUPctgFX2fwCujHXh+9Jc7q5JaqTQBMExO4q6PUG1UoHTg1GonmOdI67IZmXwlvDTKCQNxhYfANIqT9H0ccMe81LYMDoSndvo1GDx+5H0LXU7x5dpmMQafxQIkzcn/Vtcx2EQvEYPZMy9Mw45zC6PcZKSt9jlrCCkcHC4W1j6XopJSccGp51DQnXOQ== 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=cwI5xpfxw549GHf7Kz5+52hvmHiF0/F0tfeZPdv0DYg=; b=EFogj0wFUDSe2o0bTU8pyIhMevVbnvDB/GiKJra5X9Fv6gpiNGEOPRxMkrEliz4yjJ9AMd7iNtrV1jJjLmqtqsq386NIPU79irgNiYvlrThP0B+/AXegIYh3uuet97kKJI+aCpQutAXqzWpWgr+DvIz9RD7vs1o6tHkCfjn6fqaE/FfuwJdj7y+YfBaqMmD75f30oeW3mPRK+s9KCMhgn8nFWL3i8Qa1gmv+B6EzTGBCXc7RBTr+/Ai+AshWBy2fUrbCPCqBDmm2agqODk6QJPwvX+rd53a7AlzdcgbTcCJ3nbrc7wsQJjPQE72RVyuhAOv6bUmfrp/bi7E/t4sRHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=atomlin.com; dmarc=pass action=none header.from=atomlin.com; dkim=pass header.d=atomlin.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=atomlin.com; Received: from CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:70::10) by LO0P123MB6333.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:288::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.13; Mon, 15 Dec 2025 23:03:17 +0000 Received: from CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM ([fe80::de8e:2e4f:6c6:f3bf]) by CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM ([fe80::de8e:2e4f:6c6:f3bf%5]) with mapi id 15.20.9412.011; Mon, 15 Dec 2025 23:03:17 +0000 From: Aaron Tomlin To: 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: dave.martin@arm.com, atomlin@atomlin.com, sean@ashe.io, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] x86/resctrl: Add "*" shorthand to set minimum io_alloc CBM for all domains Date: Mon, 15 Dec 2025 18:02:57 -0500 Message-ID: <20251215230257.1798865-4-atomlin@atomlin.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215230257.1798865-1-atomlin@atomlin.com> References: <20251215230257.1798865-1-atomlin@atomlin.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BN9PR03CA0102.namprd03.prod.outlook.com (2603:10b6:408:fd::17) To CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:70::10) 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: CWLP123MB3523:EE_|LO0P123MB6333:EE_ X-MS-Office365-Filtering-Correlation-Id: ae82fa46-9dbf-4667-67b9-08de3c2e21b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?q+sVnaigiVoBoPe2jkGEb0jXJkhnCTw79mkOHflypiOVY5RTUYAHfpElTdnc?= =?us-ascii?Q?+5HiR7FWZqQCcw/5w4Xcea8ds7oL9t0ehu07DmNXQqSGMS7mTa0365vKXlwZ?= =?us-ascii?Q?KL38O87rHPbLtmMAdmEuaFqfpzMg+mi3bsK3F2gd8Y8Il1HCwLQVLOjHpROQ?= =?us-ascii?Q?ydb29b8LzEg4qzGfRaTmq/aDuw1suJbBzJur8DZuY7lYgxxGb2BeXJo31rql?= =?us-ascii?Q?9AGcf2Hkiw0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/a?= =?us-ascii?Q?Ei7mxQmXZwSRO4vepUcv6nGcxkKKuc438FHpiQqnisT/7RODjwwA0I008Ep0?= =?us-ascii?Q?kyKAEt6rghdnU3o41+VOzjF1xSoRzi4hgxLjoRwt0KDNh4MSbCTkkkUbOCKn?= =?us-ascii?Q?BE7uh3hg4CDsUGqEd73jupr4xq7LdqTkYrPUg+33+AW7G2/6lt7XbLofA1MX?= =?us-ascii?Q?jaCsNXtnJbL2/aARz+k3fOkbG0gCeCe/EjEi0VtdNL2CkHg6tO+jhIIlGf16?= =?us-ascii?Q?bOc5p3GFqNyMBwpOux/0oRUmg4P6evdjqn8QQLW063rRTBb0EwleoVAAaq+B?= =?us-ascii?Q?A1Qdx9fzdq+gbCOYQl5XPuAXOwGCBHpq?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?wUeyZuq4W06lMpeV0hplC/d2vKuuXyWzDk6041umPLFP+/820+/giUL/Um3D?= =?us-ascii?Q?bCw4Bs3Eyw0mYGy2hgRf5tk7HnK8MRVfoPcodIMDtQaUT4a6QXZvfupdnvkg?= =?us-ascii?Q?F55bwrm7/DpdwjLAwkVcFqJEvu3wErKoDpN0YhCIGNVCM4jSDR92kgsk/Fyj?= =?us-ascii?Q?yJL/6fw0+NaG3vo1NyFLdNIfP0NjLHm9Hrt5mPSK43HBo3VkHd3DiP7S8ZjL?= =?us-ascii?Q?LZ6g85gvq6Zp6F4hC+myUjM26hIafNpId0YKDlSen4FFG+9OXrrVxvaYmN/k?= =?us-ascii?Q?S645ZcGhPI122e4lovKibC/2hYNhs2qNv1XVa1j2OVR0qvtIRlgEsjYgZ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30hkUft4yCfWBD7bf6GbJ/JhmgUvY6a1bByQXRCZF?= =?us-ascii?Q?8ez5Prt3vHUvOcHzrpKr1Z/Jxu0EUt7H0wVumorIsYlAvAZ03PWNaTh72UJw?= =?us-ascii?Q?lcBDx6sL8epInAaC7SawiJI4XVWAwvvvFDKF69I2RK9RzbRFHK80dEz7UG/0?= =?us-ascii?Q?aAbFPkuCKYEiePAyw4BLk1YBK6IHkedmWVAedKFnTJXTXs6V8Fio/OK79K5R?= =?us-ascii?Q?hUySgmWfqult0T4oejymH4PMJLB4yD5sMUYS7XoAImp24Y3BP/bdMElmNu4B?= =?us-ascii?Q?L4e10xWaLttbdq1spOPagujBqLVL61GtTAoAeFv2fV89OqsvnMAQYKBFXLkU?= =?us-ascii?Q?JF2mfAzX2/LFi3KzYd2V+T/7/Uwf3o9POEMTb+9n?= X-OriginatorOrg: atomlin.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae82fa46-9dbf-4667-67b9-08de3c2e21b6 X-MS-Exchange-CrossTenant-AuthSource: CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2025 23:03:17.0735 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e6a32402-7d7b-4830-9a2b-76945bbbcb57 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CJdtTtgd7TDTIESHYsCTyQYPcD2/7MNTn2kgDb5g4DSS7SCkqw4kAPvBfJS7qsTdpzTRTC3PvEkhzrUknwXc+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P123MB6333 Content-Type: text/plain; charset="utf-8" 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 "*=3D0" 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/filesyst= ems/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=3D00ff;1=3D000f =20 + 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 "*=3D0" > /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/resct= rl/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) =20 static void rdt_set_io_alloc_capable(struct rdt_resource *r) { - r->cache.io_alloc_capable =3D true; + r->cache.io_alloc.io_alloc_capable =3D true; } =20 static void rdt_get_cdp_l3_config(void) diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cp= u/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 =3D resctrl_to_arch_ctrl_dom(d); msr_param.res =3D NULL; for (t =3D 0; t < CDP_NUM_TYPES; t++) { - cfg =3D &hw_dom->d_resctrl.staged_config[t]; - if (!cfg->have_new_ctrl) - continue; - - idx =3D resctrl_get_config_index(closid, t); - if (cfg->new_ctrl =3D=3D hw_dom->ctrl_val[idx]) - continue; - hw_dom->ctrl_val[idx] =3D cfg->new_ctrl; + if (resctrl_should_io_alloc_min_cbm(r)) { + idx =3D resctrl_get_config_index(closid, t); + hw_dom->ctrl_val[idx] =3D apply_io_alloc_min_cbm(r); + } else { + cfg =3D &hw_dom->d_resctrl.staged_config[t]; + if (!cfg->have_new_ctrl) + continue; + + idx =3D resctrl_get_config_index(closid, t); + if (cfg->new_ctrl =3D=3D hw_dom->ctrl_val[idx]) + continue; + hw_dom->ctrl_val[idx] =3D cfg->new_ctrl; + } =20 if (!msr_param.res) { msr_param.low =3D idx; @@ -123,7 +128,7 @@ int resctrl_arch_io_alloc_enable(struct rdt_resource *r= , bool enable) { struct rdt_hw_resource *hw_res =3D resctrl_to_arch_res(r); =20 - if (hw_res->r_resctrl.cache.io_alloc_capable && + if (hw_res->r_resctrl.cache.io_alloc.io_alloc_capable && hw_res->sdciae_enabled !=3D enable) { _resctrl_sdciae_enable(r, enable); hw_res->sdciae_enabled =3D 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 =20 mutex_lock(&rdtgroup_mutex); =20 - 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(); } =20 +/** + * 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_ctr= l_domain *d) +{ + enum resctrl_conf_type peer_type; + + peer_type =3D 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 =3D s->res; struct rdt_ctrl_domain *d; int ret; @@ -731,11 +749,8 @@ static int resctrl_io_alloc_init_cbm(struct resctrl_sc= hema *s, u32 closid) =20 /* Keep CDP_CODE and CDP_DATA of io_alloc CLOSID's CBM in sync. */ if (resctrl_arch_get_cdp_enabled(r->rid)) { - peer_type =3D 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); } =20 ret =3D resctrl_arch_update_domains(r, closid); @@ -903,49 +918,103 @@ int resctrl_io_alloc_cbm_show(struct kernfs_open_fil= e *of, struct seq_file *seq, return ret; } =20 +/** + * parse_domain_cbm - Parse "domain=3Dcbm" 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 =3D *line_ptr; + + lhs =3D strsep(&rhs, "=3D"); + if (!lhs || !rhs) + goto err; + + if (which =3D=3D RDT_PARSE_DOMAIN) { + tok =3D lhs; + base =3D 10; + } else { + tok =3D rhs; + base =3D 16; + } + tok =3D strim(tok); + + if (kstrtoul(tok, base, out_val)) + goto err; + + *line_ptr =3D rhs; + return 0; +err: + rdt_last_cmd_puts("Invalid domain=3Dcbm: missing '=3D' or non-numeric val= ue\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 =3D NULL, *id; - unsigned long dom_id; + char *cbm =3D NULL; + unsigned long out_val; + int ret; =20 -next: - if (!line || line[0] =3D=3D '\0') - return 0; + if (line[0] =3D=3D '*') { + ret =3D parse_domain_cbm(&line, &out_val, RDT_PARSE_CBM); + if (ret) + return ret; =20 - dom =3D strsep(&line, ";"); - id =3D strsep(&dom, "=3D"); - if (!dom || kstrtoul(id, 10, &dom_id)) { - rdt_last_cmd_puts("Missing '=3D' or non-numeric domain\n"); + if (out_val =3D=3D r->cache.min_cbm_bits) { + r->cache.io_alloc.io_alloc_min_cbm =3D true; + return 0; + } + rdt_last_cmd_puts("Invalid io_alloc min CBM\n"); return -EINVAL; } =20 - dom =3D strim(dom); - list_for_each_entry(d, &r->ctrl_domains, hdr.list) { - if (d->hdr.id =3D=3D dom_id) { - data.buf =3D dom; - data.mode =3D RDT_MODE_SHAREABLE; - data.closid =3D 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 =3D 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] !=3D '\0') { + bool found =3D false; + + cbm =3D strsep(&line, ";"); + ret =3D parse_domain_cbm(&cbm, &out_val, RDT_PARSE_DOMAIN); + if (ret) + return ret; + + cbm =3D strim(cbm); + list_for_each_entry(d, &r->ctrl_domains, hdr.list) { + if (d->hdr.id =3D=3D out_val) { + data.buf =3D cbm; + data.mode =3D RDT_MODE_SHAREABLE; + data.closid =3D 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 =3D true; + break; } - goto next; } + + if (!found) + return -EINVAL; } =20 - return -EINVAL; + return 0; } =20 ssize_t resctrl_io_alloc_cbm_write(struct kernfs_open_file *of, char *buf, @@ -982,6 +1051,8 @@ ssize_t resctrl_io_alloc_cbm_write(struct kernfs_open_= file *of, char *buf, goto out_clear_configs; =20 ret =3D resctrl_arch_update_domains(r, io_alloc_closid); + if (resctrl_should_io_alloc_min_cbm(r)) + r->cache.io_alloc.io_alloc_min_cbm =3D false; =20 out_clear_configs: rdt_staged_configs_clear(); diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h index bff4a54ae333..3846737992bb 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -143,6 +143,19 @@ enum rdt_group_type { RDT_NUM_GROUP, }; =20 +/** + * enum resctrl_kv_sel - Selector for "domain=3Dcbm" key/value parsing + * @RDT_PARSE_DOMAIN: Parse the left-hand side (domain ID) + * @RDT_PARSE_CBM: Parse the right-hand side (CBM value) + * + * Used by parsers of key/value pairs formatted as "domain=3Dcbm" to indic= ate + * which token should be extracted and converted. + */ +enum resctrl_kv_sel { + RDT_PARSE_DOMAIN, + RDT_PARSE_CBM, +}; + /** * enum rdtgrp_mode - Mode of a RDT resource group * @RDT_MODE_SHAREABLE: This resource group allows sharing of its allocati= ons diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index e1dc63b2218f..83ce3bafa5cb 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2196,7 +2196,7 @@ static void io_alloc_init(void) { struct rdt_resource *r =3D resctrl_arch_get_resource(RDT_RESOURCE_L3); =20 - if (r->cache.io_alloc_capable) { + if (r->cache.io_alloc.io_alloc_capable) { resctrl_file_fflags_init("io_alloc", RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE); resctrl_file_fflags_init("io_alloc_cbm", diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 54701668b3df..9e75959565dc 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -215,7 +215,10 @@ struct resctrl_cache { unsigned int shareable_bits; bool arch_has_sparse_bitmasks; bool arch_has_per_cpu_cfg; - bool io_alloc_capable; + struct { + bool io_alloc_capable; + bool io_alloc_min_cbm; + } io_alloc; }; =20 /** @@ -415,6 +418,31 @@ static inline bool resctrl_is_mbm_event(enum resctrl_e= vent_id eventid) eventid <=3D QOS_L3_MBM_LOCAL_EVENT_ID); } =20 +/** + * apply_io_alloc_min_cbm() - Apply minimum io_alloc CBM + * + * @r: resctrl resource + * + * Return: Minimum number of consecutive io_alloc CBM bits to be set. + */ +static inline u32 apply_io_alloc_min_cbm(struct rdt_resource *r) +{ + return r->cache.min_cbm_bits; +} + +/** + * resctrl_should_io_alloc_min_cbm() - Should the minimum io_alloc + * CBM be applied + * @r: resctrl resource + * + * Return: True if the minimum number of consecutive + * bits to be set in the io_alloc CBM should be applied. + */ +static inline bool resctrl_should_io_alloc_min_cbm(struct rdt_resource *r) +{ + return r->cache.io_alloc.io_alloc_min_cbm; +} + u32 resctrl_get_mon_evt_cfg(enum resctrl_event_id eventid); =20 /* Iterate over all memory bandwidth events */ --=20 2.51.0