From nobody Mon Dec 1 22:35:42 2025 Received: from LO0P265CU003.outbound.protection.outlook.com (mail-uksouthazon11022091.outbound.protection.outlook.com [52.101.96.91]) (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 B1C1620DD72 for ; Wed, 26 Nov 2025 17:17:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.96.91 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764177424; cv=fail; b=Tp6jp2YGnz974BEo/mUAIpFLx6jgu6KQ8KeVEFtQkmWM+2PzxcZET0iXVrBkhccyxUb2l5JeUslDvzjmcw+fciwPg4E8uAC65SPGXwZWnxSLm2eWrNaepsA69OaWFUdtq4IBiGA7aVtoE7HqyrwwW24WWekJaPAtGwMJCoz8piQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764177424; c=relaxed/simple; bh=0zjtdckSDh9Gca3JT59dvmS7ipv8ZTHx1Effg0aLzFk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=W8nJbOFuICmOgR9Tx9fwGKmH63txJbmAIKn7WjB1nP3U7lceA5l24fHnSdXz7BHXugyBbMbGw8wGL7LXEhRKgUioq9KXFPRLOzK+G8Y4xjF35IWm9Ye2ewVh0bAZEu/XmmGO6m2ngsvCU7sm/M2I/52Y8KGiPtWI0TMS1nvXNg0= 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.96.91 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=nUHNL/ZB/htOMcyzCEZGILhBFCcIENWX5XmYwhGHl2BtEI0wGeVmogk9pDmN4xdcHFmps9p85G8nB9h8pB0oxtx02OXCWdG3czPZrSSgrtIzMM6Po3DqoucTTT1f8O/ndIDnWGNfscSXJ3ZQfBDtPPzaq48IWOtpcUfF+T50SFXFAqA8GN9XZU8FqhV8GqKmg/NkTBfOHjp+y4pPmE5AuJf9pW7UrsBnGLwN4mkVGBRXfisqowC8GJ7B5LQJy2o+DCmVZNvZxwrwOy7TjE+dmG96YVPQvNcMmUte4waz8BTFuDgqTx6es/+xtzWM+GcFHzU1Vkk7b/QT7WHcdZIdDw== 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=XaS+OS70NmiRkMsBS1zPxCmTe0tuwRdybLzluAdBmlE=; b=xUDF1bJ50vAvXJmw9NboL/SGoUq/jZ21YXWcMWz7BtQ8QTK86FaaHPOHQaGL3JfPCWb0n5DiQsymF4PSXr7f29eODIniPH2UfxGRIZyLTZN+nC1ny7Ol1O98t5VllalD+FBt2lSzeWmFS1N1KmwRNMx6nLMYu2XlodshcVB53a1Qjf5XbGN7wdZdr05YgdToJwSpbOwLcayrOwneDi+u0QFKpoc7kQLojZknuN8PwzrAEDEHUiYzm/0aYZSW5gWGykR+VywwaLuiOyLDC6Ll0l8+LhAR57DqTXt//gu1euDkBrcOiZr53IwBnkMNBAhtfSkVHqOSLJzQxSqc3oK21w== 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 CWLP123MB6960.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:1e0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9366.13; Wed, 26 Nov 2025 17:17:00 +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.9366.009; Wed, 26 Nov 2025 17:17:00 +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 1/3] fs/resctrl: Add helpers to check io_alloc support and enabled state Date: Wed, 26 Nov 2025 12:16:50 -0500 Message-ID: <20251126171653.1004321-2-atomlin@atomlin.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251126171653.1004321-1-atomlin@atomlin.com> References: <20251126171653.1004321-1-atomlin@atomlin.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BL0PR0102CA0070.prod.exchangelabs.com (2603:10b6:208:25::47) 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_|CWLP123MB6960:EE_ X-MS-Office365-Filtering-Correlation-Id: 75cb23ac-0639-47d1-7ab2-08de2d0f9c7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?72gCg/Z0r9rgkhaiA8TUPZmMW6ThC2pXvgunGHs3CNtLoHI5biczaWGAia0U?= =?us-ascii?Q?Y9SDpxWXb8P+yv2DF7bUZFQMF2QcShaxDtwhANAOpSOagaEzUfDxPNfyWhoI?= =?us-ascii?Q?DFdDUeoaZH8hP85CEZO3p2bP97qrMM+Zfnchv2hXixlbiNDHcoU0cEQBcj3c?= =?us-ascii?Q?3DJa7oHDy0HC9/WzpKZLRxmcH4ihN0++AcDKmkj7wplT1+OknMDfEAqdVRvO?= =?us-ascii?Q?mr83wWQ8eHslXGxqzV8ixMsZQm5y7tDljWVIL0PRpnAo63ptBL4squJl4ZFt?= =?us-ascii?Q?UcF4sVWHMDn0V6panDmSLWbmdqcE1wMaDaouLJHNAaZl4XeRRQVfbJSoxDyC?= =?us-ascii?Q?givLSS6TfpShubItZrnIIb0LC9KsHoaz0exHG7AL2l9fWYN8Yf53APEuGmTN?= =?us-ascii?Q?P+SPprKsSt4pq4GS6Ce1bwevKzuBjSbey4VktsF8MoCtHpRXV9RRKqyY70cC?= =?us-ascii?Q?2FFb1dFr+qbm9mm9KQFW7xN8VqUgmjCP/4OfEiOams/UT+5nXGKpFe+pUpzq?= =?us-ascii?Q?pd9KMti/txtlBOa255JOSLDMfXpm8691WVjC9tgWdHdYZUEq8h50nozX/Vjd?= =?us-ascii?Q?EwiOnSXNd+jGw2nGFzLcJxQc922ZOGi3Qj4QaIXvT5ap89YBCTGlldN+j8qt?= =?us-ascii?Q?QXGWh7NVQQjEu5s0xx5Crm5Q4KVZGTH3D8pwds9sXRsgLxZadWZwMGGKWoSA?= =?us-ascii?Q?3TifCnow+1AYdLHf3xdox0zrRyCSCAg/c9/NZBdjNb+jqI/WBC76Hgi/lJUO?= =?us-ascii?Q?XGTsKN4/5XWJvmmWo8SkOLom2sLMTzfwO5lvQcMjS5uMWsa8EM8wz34GdbWg?= =?us-ascii?Q?J7d22fRVNhPLcAulEMufy9o4k3z3bdg4YTiG1Afrqg5bZNelBNt8JekvE02M?= =?us-ascii?Q?ldOM+3sMrRYaMlG/NRlgqaycB3EuEPDMqdWIoVPJQvm4UyHO+iEf3m7zGFRm?= =?us-ascii?Q?wPrm+KOIgoEmxlxV2d48a/YD+Hh5vrxVPBarTdFR84gnohsl9MK3sfyCyvfi?= =?us-ascii?Q?AHpQLmyw93e+jszrkU2ljEy4Y9xcTXfOvrarr2X7wImSmdTpaKzIRXB1TnI8?= =?us-ascii?Q?Xsaf1RijIQ1zGnI8ehMSIAhA1Ad6usE3OfAqL5Kw0jvGTr2IwMEnAT0EgE3Z?= =?us-ascii?Q?omCYQMpY1jTkHQcHGp6UQWaqeTaRDzYijhn6jV488B3Ax5ZJ/wUB+IV4k+ai?= =?us-ascii?Q?/4PAp2lbLoPvvHQG7lXYlSRfkpfJUHhxttWPz+cvQtlNO9C7BDrNBDh6jIEv?= =?us-ascii?Q?77H5+YYdzMXbEU8z2pfmj2RCm8o9g1zGB65R6LDUQGFxpB49VdsbI1g0tBPk?= =?us-ascii?Q?9jGqWIyCybzx55bFq+e32nMZwXPL6pei2B8M3SOK97eLF5vTvC5sGtVdpIGR?= =?us-ascii?Q?NeqXC7Sl7+CdVop2TIIqUHkweCkQhN+ygj6OOFySPHIS9DCAmUFsXc1S9hUj?= =?us-ascii?Q?kSVhAGajvBjgEyzV0JQKZ2reHHQpgu43?= 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)(376014)(7416014)(1800799024)(366016);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Gl5x+Y1ygGvzHDxU2klJas7GVL7F5maY8eRhQZ/wZxsEbaj4S31Klj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IQtcwW6+iodxwXlrOSWCvuihfZx26Ln3rnlGejj?= =?us-ascii?Q?XhSGXI43NmuU2fDF3C3TGVkqpQP6PIIf0XrB726HFfFuCkYOteN74leT8oh/?= =?us-ascii?Q?9bIiU0x3e6hj9HZhchvZHVY9ACQBfnya18TC6Bnm246U1dbpOGsY0p+Zi2eB?= =?us-ascii?Q?fsgFfLAPqlnp4quruG35cZPWTAzhNIU6U9UEK7k4/z3eqUY2l40RGKAgY23n?= =?us-ascii?Q?Jcwaig7LrWWMqQs6owdwtyKgUyd2ZclkU6jUXD2FaFqYzUAuNZmzLHz+kPKM?= =?us-ascii?Q?ppRSE5qGBa4/Twy4A1fgrGXOT/OFEjB1nZIZggjf5b/aku+lQXQDqgBe6U5+?= =?us-ascii?Q?Rqrj5v3HcTzNhr9JMW0RZ3wh4kUZjpdHFNEEafrIF3aBVEvm3tXLqW847Igz?= =?us-ascii?Q?2b+KCUWUzA4/hkhlz7tRcyMVR1NAl1W9OvC3mxNdnEjxdiNJcGZ7onI+nu2N?= =?us-ascii?Q?fFsonupuUSJhOCpgB8ZxfeUq3CQn+vBAXYCBSCFUkrfcgJD7eHjM+R4M3T3b?= =?us-ascii?Q?W+ZY+UWhB2yQjReusFIfG4Gxvc6BBqcbgnioIwwZHDIxrtBVZHIaHfcaeeTa?= =?us-ascii?Q?R+5eT/zuA5hpYNwwDYIhvqrR4vsT0vGATZEfIh+GI8++v6tZeTfJ3MX8oDnJ?= =?us-ascii?Q?uWHGv4TKbe1srZN1UcQSTdWei1on2TR01XkzPmJO?= X-OriginatorOrg: atomlin.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75cb23ac-0639-47d1-7ab2-08de2d0f9c7b X-MS-Exchange-CrossTenant-AuthSource: CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2025 17:17:00.8243 (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: KyEQSPgZfkfEaCxELbWuFRQoK3lyMHpCxGw/XCKl6m6Dzrh3YMBmc3eKsfmwzqJf7N0jYzmILX34Xp2onL3BMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWLP123MB6960 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..5f6f96d70e4a 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 +/* + * check_io_alloc_support() - 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 int check_io_alloc_support(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; +} + +/* + * check_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 int check_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 check_io_alloc_support(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 check_io_alloc_support(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 check_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 check_io_alloc_support(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 check_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 Mon Dec 1 22:35:42 2025 Received: from LO0P265CU003.outbound.protection.outlook.com (mail-uksouthazon11022082.outbound.protection.outlook.com [52.101.96.82]) (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 CAD5527056F for ; Wed, 26 Nov 2025 17:17:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.96.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764177428; cv=fail; b=XJLMxX2rh8fJnVtTNomfvFDjGQzIXkRyf86nagnqj6UDRqB3+2oRbKi8+Sbz5wDfw8EkrNsT28aqMB2rTgNnhYzGCsCsQEYr0rCbkd3LENhfFJVj+WyMMy3JygwYCH7xAQr0UcKB+iei0PigGJbl7FIeawFey7Q0paeUfC+71wY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764177428; c=relaxed/simple; bh=ZuXeCOJ42/hxVLhNwm9UnPetuv0DLGA2xSrc1BZCijM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=rG2M6rfxUFBAChmX3LzaCIbXLMh0Fru9EDuadC418JU1ugxoilpjlrIJ+w9dZnjKELrnplZTTa+5s8/vskfsIcGdcUxfRHsdOxY3gsy+FiuBnq6XiDtjOzeaeKmzg3/mvRl4AdkC/axSDRaZtC6+TUCKGEtoJnJY/KFgd106ILg= 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.96.82 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=ak7kFD++Zi4D1k0YpEnVrBct/kvIvyJIgq/Po0dWRmivqgywkoMfprs9142izfXkuB6+bVj0jbGf/IinSmJX/OTeQtW3xtUwsvrF4NY0ymzZLVqyj9lpTKgksjKGvcsY0Ex+S1nffB6UsGpoolc2oXMzVvce4bchliSMa/qixeMaHUtwLP3u+WyL0GxkenUfdSMZApCXiYopzM3LeQ/24d9Lpxy1u5/HPFHKOGyHCo3FPx4m8jMDenNyP1iGK2kwhyVxIxqr2QecNRAnb6rJtRlI5s3EsgOp3vWDNx5xeGG7zYW+7Cub/LoPcy6fOVWlQFnsddCCpjpYer8g2rbEnw== 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=jVIItaMRSaBi5njfTPl/XpeCIHhk6JF3PZQWnW5fhQe3mA+2ZxdgiQh93mL9q6BfZyRfa1TM6vufJPhfNp/LNM2brw2ghsy5OIjbct+JYM/36cC6jqP3Q9PLKgj+xX88846gYEq35C/RyVN+xH0CHUIGth/EIqcPxKGV4KkPA7Xjxs5ddF38EEhFBZTXGGLIx4mQXwQE+TTrS2wwvcF7U2N1VLXI7rI4MKmBZcROlrmpu7MmMKftYt/cIII2e/0zhEbPl4wsZjwQsvYKR5g5SdWiW9/CsVPimbEoiS/oP3c/6fzh+JNcUEzeEaPYnp1Cgy3TriEpBpb3t1639WwvBg== 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 CWLP123MB6960.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:1e0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9366.13; Wed, 26 Nov 2025 17:17:04 +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.9366.009; Wed, 26 Nov 2025 17:17:04 +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 2/3] fs/resctrl: Return -EINVAL for a missing seq_show implementation Date: Wed, 26 Nov 2025 12:16:51 -0500 Message-ID: <20251126171653.1004321-3-atomlin@atomlin.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251126171653.1004321-1-atomlin@atomlin.com> References: <20251126171653.1004321-1-atomlin@atomlin.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BLAPR03CA0013.namprd03.prod.outlook.com (2603:10b6:208:32b::18) 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_|CWLP123MB6960:EE_ X-MS-Office365-Filtering-Correlation-Id: d0761fac-3c70-4513-dd06-08de2d0f9ea1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?PC44GiQ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S23wURq95?= =?us-ascii?Q?vwUVmBZ/WIQKG2OoadfR4Ns2BfeRAt+bXSspNMiiZa61oYKAEdGR4vGm1K7y?= =?us-ascii?Q?Nt+CoaNB4oS97pde4WNvDejj0QMk/BYMcRycu4qQ02Oh/S9zAVqs9L9nkBTF?= =?us-ascii?Q?Hnh/PDrxLqPpMvrd1RB4iiZHsTbtLZG9LIDVjtpYQZhUwXJFFnCUMR+NkV4D?= =?us-ascii?Q?7ElnVNBVa5ABGlQhX5b20qIvFBlTSAKmxWEetUrcGZLRQZ08o3QsmYfqMFFb?= =?us-ascii?Q?Wr2w/mZqjrr9YnZFPXgyP/N3YPbyDVmYaJiH4sWTBJW1Uj1SPEqNMsih07+U?= =?us-ascii?Q?dUhu7IqkhfNGfCfacH8OL2XtpGi7KyTEio3TGq7+xYvnL2u013urcoI3UgW2?= =?us-ascii?Q?sEBmtfZ0y72nKW+UEHt2f/by9JRY/JfmmdV/Su/W6FmJfi+bJv4z62+MQHqp?= =?us-ascii?Q?otGiSf1eNBfsrCia1xGaai6N29ag378igIjI3CZQrdEzJJXddrGT6MRCZ997?= =?us-ascii?Q?r2ZnCFBW+YwqqhfJdxJVkYrdfApRxKFAmW+dAV6GU/taqKrhdqvK5HifY+Rj?= =?us-ascii?Q?ippXZMJ50v/tN5Dnpk5pQjaX5JTjkTxe?= 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)(376014)(7416014)(1800799024)(366016);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ha5soYIk5eaWuab6bHkzGUPI2wBM/BHllCd70Mwgfz1p8I7Crcbp8iaucTCy?= =?us-ascii?Q?Ny7LeJ66zZNCPRbt/0t2knobniuMHTZb5kogm8t/KWaMbej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qe9B8LrJ02UymrBED++oLNYa5QHrV?= =?us-ascii?Q?h4SkXjdfbPr5gx6WUs4UAMrPuWyhSE/lqj9xGHLB2Rkr0IAFJf1tWGAUywY4?= =?us-ascii?Q?nN77B1ajDdn8aMTfnIUT2YBEBzHdEeJiB5TUz37jrstdYieSZaM7HNAtUBuj?= =?us-ascii?Q?KLqG6t55YzvbQAnOnsHS+VetR/QLUBWWO0rYRSi4a6JUJy64Ur87v8zDhR7f?= =?us-ascii?Q?EDnkmmaHoBn04mQKfYQGQGgFYOfowVywrPJmyYsowUmK1QZpUq7d8fp+F3Oi?= =?us-ascii?Q?uIKX+9ARQ0JtDnezkP2N/323ZEOewe5GTPvmnh3mR+3PJaJTv/JFZmg/9MQR?= =?us-ascii?Q?ieyiRSQwEBaDoUwKWESPVxWIDSYthC4ZAJqxgpauyPp4Yiuw/CbiuEJd4nTy?= =?us-ascii?Q?g6VJVczJUqyzD9S64E62a4P57lpg3rkqtggXxDccWO3nzSwTqDynEBy16n5n?= =?us-ascii?Q?8FppkRTiI1+G5xx1BbmCEsTKlFsj+xD7Tt4EGRmyRoVc/he7VruCATbb8qGp?= =?us-ascii?Q?MfJnDc1gaSCWmvL5IhkqIBN0dfj5ayWz3Egfg6goQi/KeP43UFu6P6ObbD/R?= =?us-ascii?Q?JcBeBYArhNePJCeUDJYcTIiSBH9zfbl2esQ++iZa?= X-OriginatorOrg: atomlin.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0761fac-3c70-4513-dd06-08de2d0f9ea1 X-MS-Exchange-CrossTenant-AuthSource: CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2025 17:17:04.3407 (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: YXryqxnQ7RkLxUxD++r+UF7CzkAMav079+q1WZ/pU/ng74TS0zkkv87KZcdyDTr71Cku2w6gj7EV0SKcOUh66Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWLP123MB6960 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 Mon Dec 1 22:35:42 2025 Received: from CWXP265CU009.outbound.protection.outlook.com (mail-ukwestazon11021077.outbound.protection.outlook.com [52.101.100.77]) (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 89BA127815E for ; Wed, 26 Nov 2025 17:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.100.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764177432; cv=fail; b=uoE0rvlbfq9cD2F+iOIXBBiXm8QaFVe6zCyEkyHlJ+YPCoHm1rmHP/79yqtoIQPoGq5D8uIO/d7CfPksGk+PSIue/8JwoW6jm7wENlOY35yrr1x0AqqB+y5MVqEMdxQXzjSNJ3xeoy1R4C/6xhDIax32Nv9hBvgd8014EBV+HFg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764177432; c=relaxed/simple; bh=RKSuCCsFSAfKNfuJ9ek8HYfZbAZLWLiLabGr77nn3sE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=PeQk6aGRjFqLvfzpXR1u3agLK0zqOUQ9GsSwEI8VeV7UZTBb0k5Xr3GjrK1LlfmfOtJwabgpJ2SeVZHXo3OAYVOq7/yuVZyzLQq9kTHxjuKX1F+jlA/bz3t0BDdp9mFgijZOsW5qvUSgcxIyGIc1Rrtyh4lg9N7+bwMRtaCo/M8= 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.100.77 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=hKIu+uUZUxzOzIVfhJbzCazU3n6haAtHg/zq9t/HCaw7dXL2UNqZ/HRQPKfGhNdTpu06bFUszSbwn/oV2l98dtzLGY/PowClwEJtPxw2Od6N2t/b4FkfLy3dZ2vMviETFJ68Y/cA+9spxvpsFxh362fkT5z4/JtuzKLsaVPLol/J9JCZ+373vrQxpjhbHHLvz0LpycDIaBi7a6hKLcEAzpTcGXnwpFiVhPQlGBJwlb9dPHMxX3SE1X8xdy+jrfW8rKftpCIzpaiX5jr7Kpi+ZEvwuiY6UDSfM+v+yaUXBkPI4T6WN63/bb9a2JXm213ttn/dJssP0ArfI0MjxwNeHw== 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=90zHLNZi69qgzyPnAiAOJv5tQn7afZeTOdK1FTG6sL4=; b=mG+YxpCaJxr0r9eQ1aeOY26upVU2KnLrDSRselHMJq4BYFmh76YM/1WIwshRZa09MAXmJcTOStOTTV/BJuaawRncJv0Wq9cx1i0nbsY8U/JHEQ3zGtqFxR5kZDbQrchQhWkt180CAuOcgYmucnXVEsOEvp+0YeGL//VeQStID2+kp9ip5tYwye0vPaLe66wbcwG40JWUSEIDcgqfB1AF2q8sO/Si9URciD/yKR/pwx2ty3LhnF1oQMWKjuZ4G/G1dVyA+mB2gyIL6gINQKf0SVe8xRap2C2bYF0K/ZzVanq33n0QoLQTTXzMHp0J9snd9d8aMhXtKOfT8a9JL4QNRg== 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 CWLP123MB6960.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:1e0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9366.13; Wed, 26 Nov 2025 17:17:07 +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.9366.009; Wed, 26 Nov 2025 17:17:07 +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 3/3] x86/resctrl: Add "*" shorthand to set minimum io_alloc CBM for all domains Date: Wed, 26 Nov 2025 12:16:52 -0500 Message-ID: <20251126171653.1004321-4-atomlin@atomlin.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251126171653.1004321-1-atomlin@atomlin.com> References: <20251126171653.1004321-1-atomlin@atomlin.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BLAPR03CA0022.namprd03.prod.outlook.com (2603:10b6:208:32b::27) 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_|CWLP123MB6960:EE_ X-MS-Office365-Filtering-Correlation-Id: fee17615-4723-4724-9f8e-08de2d0fa0b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?js7qvbpPHz3jJBJT1oFT/9vv5LqFhpPya81JF6glwlSQu613elsitz41SJ/3?= =?us-ascii?Q?duvaXdj9hb30soILkudY977crb1wxKaTZd/NkfIk+UobltMQ7/pMhzQ9b27o?= =?us-ascii?Q?VRn13b8kerV9KGxPK0FceDOIj/uzGEsPreOSVVLR4ikl9nvnDQIYDcafoWN5?= =?us-ascii?Q?K4uLAxuznscCFncotP+KNgQli3kltwLIgY01fbpfnF3Q/SeLwsKqILSje5i5?= =?us-ascii?Q?+T5xK7CAfNy16bXlKKMK6LQ1gJnWMJPmrH4SzGr23dZxh2AtJipVzYH7Xnc8?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zVZEM8/HU24ZIi?= =?us-ascii?Q?Lk5z0ffwAUkBqLJXGIrk2EXdsY34+iVsYoUByJWwfIckQvC0K+HXu+rLPdGQ?= =?us-ascii?Q?2EwmGl3ArQK3k5++ndQojEZ06rDRwQ18AepAemXqz70vetwJkP8WCk/kuCtY?= =?us-ascii?Q?6flCmFG81Ei9dG4+1lc9+ntxgmQ3q8OQUdrAB972zQqUiwVLXM7HpC06B/z1?= =?us-ascii?Q?u0tPjugBT4EhQ6jPpc2r32hw3YZ0wXRzol8CHi3nQ6HNSAAAIJCSj44sOa+D?= =?us-ascii?Q?JWS8fraAEfJ8WQYFtNXzWV/crPcEgu+O?= 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)(376014)(7416014)(1800799024)(366016);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?pVEmUqZRSmZxPHhfU1muAC8m1mSlFvtoZQnTyfBGH5l/nbjQXLwVleBwXU27?= =?us-ascii?Q?IVAb7vTdyhY+Jq8S2c/UMKUJ5FHWNgv91FTfeaPrXteUgM3EzDGFBWxeHWgd?= =?us-ascii?Q?kqp0Onw82Lo8Dhv32vZFQDtNXvilPyVnvHxjz0lSmnOXqpKu7N6/eWf05fqx?= =?us-ascii?Q?qDknu49XcfAtawFj3CNnir/Lgin8ke82he7X5cDMIetYaSIdDKSwR5FiDzWj?= =?us-ascii?Q?TJU6AiZddwfYYBYqkjGYpK+8z6GXbK033TM5qvLTyHnUk+L/f49/RcnzGABl?= =?us-ascii?Q?r9ctHWOQQjlJ05mmHEi06EFjMol7C2JHnoc8x2XVO39eA1QZeCuq+cAYGMZX?= =?us-ascii?Q?9RAGviPfVjY0wx7ADjxStKztk5screIp/hfnKARKhZ5qrQLT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5R2Lz2i3ORhOTdTa/HM3yn9o6SXC28?= =?us-ascii?Q?+F9ogUri4j2e5GbRTVDDOhhE8AvueCeGI1Bi/0MVBlpLmw6ZxlpUYKs3fOZl?= =?us-ascii?Q?4DoFh4TDDyoSxBQhwg/JJX2/dOKrcKqwhU9Zz6P0cFQbwJDTJ/+e98yRgJOP?= =?us-ascii?Q?u2bATy+cxSQnhBwQkWH8h8nLkDIXy00L2mCbLFVcpJyQyIJ3I7Bj57AVjfcd?= =?us-ascii?Q?71jg7LU+HQAitbJ4U8K8ZfFM4gcpclbQxrQLyJHpxoh6rdyt2IAO7fETiJPY?= =?us-ascii?Q?nAJX1z2wfhXw3eccao02Ir6SwaPxLwP+oU3NJC88?= X-OriginatorOrg: atomlin.com X-MS-Exchange-CrossTenant-Network-Message-Id: fee17615-4723-4724-9f8e-08de2d0fa0b0 X-MS-Exchange-CrossTenant-AuthSource: CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2025 17:17:07.7965 (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: bvVYS0P5Yp/v1sV0rdhp+AyJfiYMiBU5pQjdbLFD7LbM0Gecbj/PVE+squOMR8O76TcT1b00+qhErJwLpTnmTQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWLP123MB6960 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 | 108 +++++++++++++++++----- fs/resctrl/internal.h | 13 +++ fs/resctrl/rdtgroup.c | 2 +- include/linux/resctrl.h | 30 +++++- 7 files changed, 155 insertions(+), 33 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 5f6f96d70e4a..b3abd781899f 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,29 +918,82 @@ int resctrl_io_alloc_cbm_show(struct kernfs_open_file= *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 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 *dom =3D NULL; + unsigned long out_val; + int ret; + + if (line[0] =3D=3D '*') { + ret =3D parse_domain_cbm(&line, &out_val, RDT_PARSE_CBM); + if (ret) + return ret; =20 + 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; + } next: if (!line || line[0] =3D=3D '\0') return 0; =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"); - return -EINVAL; - } + ret =3D parse_domain_cbm(&line, &out_val, RDT_PARSE_DOMAIN); + if (ret) + return ret; =20 dom =3D strim(dom); list_for_each_entry(d, &r->ctrl_domains, hdr.list) { - if (d->hdr.id =3D=3D dom_id) { + if (d->hdr.id =3D=3D out_val) { data.buf =3D dom; data.mode =3D RDT_MODE_SHAREABLE; data.closid =3D closid; @@ -935,12 +1003,8 @@ static int resctrl_io_alloc_parse_line(char *line, s= truct rdt_resource *r, * 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])); - } + if (resctrl_arch_get_cdp_enabled(r->rid)) + resctrl_sync_cdp_peer(s, d); goto next; } } @@ -982,6 +1046,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