From nobody Wed Dec 10 20:11:19 2025 Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazon11013011.outbound.protection.outlook.com [40.93.201.11]) (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 DA2C721C9F9; Thu, 13 Nov 2025 00:58:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.201.11 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762995520; cv=fail; b=j03Y9adedIKlsWbzvCRKDVaaRry50aWYHmZj5W7mi9Uh6uY01Eh4Te8WqA8S9MNFoL9OYy7jD1a34Z9uyMhX0OyoxPqorpPysx6lB5AnrQnPhNEIB8Kl6kfDJUxDHOxkKjUabjRenNnkFNZQftJP4qUTgUh7X0B8Do/BvmcicA4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762995520; c=relaxed/simple; bh=Tn1nxpfJZQ9q27VFLrDqqekEmX3wj6jOjuY7pb9pPm8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K9AEoGNoJ4aGHDi+o2oWoqVKjGk0q48lhFs4esWNfsXnk0YPBEYNzbJH5e4P512evTQifxEUOTCS1dgBEzxCDuoOWbObgT195hZ9bMELb3txlSdHfpJxm4I/rXLfts8/f7Beft+qrD8vbCEMOpZmISOk2XrlUVDIQmDD12Nhazc= 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=LOsz0ttr; arc=fail smtp.client-ip=40.93.201.11 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="LOsz0ttr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DyyZ1q6JGxwmmsUfJYZt7YmQOTmEecbtdCEcRyNawlySuc0UIW1qorh3BeAbhJi3ubPemQ4suY9r0P/WaQocRYLEnqDxX7iLJsttcsDXDK3MCRLa+deUEzT7rrmbcqWgbg36VnJhXH8JkTKxs9HDBesdCHJKa9Xw66yFcbmS6+DO8mpSN3NNS/UmMYcCOwJKDcLbesdiefU+T9+x/F2/6o+w+XkLr1u8P5buV3oKGHzV9Z8pTqYbkRcJRnaxhE2VrxGvQxuA0fRSR0vxXoHQDahp1yuqsLlVz8aMN3E4DL5kvVSWyEIjAJEAmpDN1MQytvwFr1glpEw5oaBPtLiYow== 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=NqUzxlwcF4qvJ/d9wQ/PDxPDxMKgei5Ggeo+NxnW9pE=; b=Uhs+GV/lPW5hTCV35Uh9B6YaglNIYSP6Kxa7Ni/Q5Ce/4Uc7BIxlwcqxl4dohkdP7Kwrdo29XQncbS86AqiablBWgW+2BwK+p3Vr4hMMhQ1N/fGc4DaOPPZAyB9LLReWQGPEW8YBzXyYnl9YT3vL1FEnx2SUwBlztJXLMI+AG29Su5GNQ6G9HRfdXOb5eiSISus9w91b3hKUKepKZoKZ6s5TEDCMs35NyuASvq+Fn+NQyKF9DJ3EnbCpYLca8PPQkOjQnRaEE+gz+Jh383c53zbcRAFgsRavFg5a+X+cNrD38t0WdGNF0Ne/gO87pfITTMzv4lxRqs0YDY8YVk/wqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) 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=NqUzxlwcF4qvJ/d9wQ/PDxPDxMKgei5Ggeo+NxnW9pE=; b=LOsz0ttrwHOSWSSO+UgD+Ua2Lyy6YnsB5N308tMWZRRpSb07Y26LMwtkgI5NOQs9J/FRrKLGnN7Wguw1XJ3Kp5FgSEVPtw6xrXKJkI6BrlrHLYggkutfv70jpkLFM02NE9NmBnstmKJVllACqlumwjLcmEKIhKDbPZKfzF92jgw= Received: from CH5PR04CA0013.namprd04.prod.outlook.com (2603:10b6:610:1f4::13) by PH7PR12MB7820.namprd12.prod.outlook.com (2603:10b6:510:268::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9320.16; Thu, 13 Nov 2025 00:58:33 +0000 Received: from CH1PEPF0000AD7F.namprd04.prod.outlook.com (2603:10b6:610:1f4:cafe::2) by CH5PR04CA0013.outlook.office365.com (2603:10b6:610:1f4::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9320.17 via Frontend Transport; Thu, 13 Nov 2025 00:58:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by CH1PEPF0000AD7F.mail.protection.outlook.com (10.167.244.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9320.13 via Frontend Transport; Thu, 13 Nov 2025 00:58:32 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Wed, 12 Nov 2025 16:58:30 -0800 From: Babu Moger To: , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 05/10] fs/resctrl: Introduce interface to display "io_alloc" support Date: Wed, 12 Nov 2025 18:57:31 -0600 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD7F:EE_|PH7PR12MB7820:EE_ X-MS-Office365-Filtering-Correlation-Id: 59d84e65-0658-4eca-e502-08de224fc490 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?tTZxYLH0sSbT4sF7mv0nz/iYkxwJEAJLyGMmXOaTM/gmN+HkK4BnnKqzfcO3?= =?us-ascii?Q?BHiLO7v/9dRwUellDwSJu2tW4+D8MJKYfYBoVBkkikOnhwwL7mc8BxfJETtn?= =?us-ascii?Q?VTp0moHz73s9Er2uHtp8aODZcKb8nXAo9nNYt3DbouRNkK+ifS60W+6tWh3s?= =?us-ascii?Q?Cd2vsQZtgdcZ//2PmPZAZBfBEeF2b/Sqpfurlby1i2vtJQ2F5z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DiyaY5aH5k0PObUP5F5vLHcviYPo5XJI8L0ggR/y?= =?us-ascii?Q?iLrpR8x825I4l6F+cdDg9Gjvu2dzUSCtjLLgpOWJlgcUTBcfVQHwsGJw723w?= =?us-ascii?Q?VRx9f8wPq5to9BLa0lE2tv2dMBg78QFaGYZQKR0Xfn/bWffQY6gFdvCiBMQH?= =?us-ascii?Q?yjnXOKwHxWWue0TvnsH6P7CTmPpY3Iv7WVRUcXF+4x2YGZY2S2Mxm80VBr4b?= =?us-ascii?Q?a1fte5ttX0tPOMu5V5mXUSlWJ/EiwymFGj3DqTakLjdUqtLbA5IP3jNEtuIs?= =?us-ascii?Q?+507ehXKlHHsC8L/rrQBY4vAs/q66S2Sjwupsp2VRPHOxijX3WHYJx9gFRYa?= =?us-ascii?Q?Dx6WflS+4UvMeC9DoqhZLNgAayZwC+WdrIfl5YrcXQuQ/byVrnlFxgQelQck?= =?us-ascii?Q?Jwt7dUxWDmAlLsg/2K3VAZJIQYPQ3h/BtvXWbKeTSqCQ8LjAYGPI6/9paynS?= =?us-ascii?Q?X2B5Kfin6Cb9/aMrryw=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2025 00:58:32.8240 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 59d84e65-0658-4eca-e502-08de224fc490 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD7F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7820 Content-Type: text/plain; charset="utf-8" Introduce the "io_alloc" resctrl file to the "info" area of a cache resource, for example /sys/fs/resctrl/info/L3/io_alloc. "io_alloc" indicates support for the "io_alloc" feature that allows direct insertion of data from I/O devices into the cache. Restrict exposing support for "io_alloc" to the L3 resource that is the only resource where this feature can be backed by AMD's L3 Smart Data Cache Injection Allocation Enforcement (SDCIAE). With that, the "io_alloc" file is only visible to user space if the L3 resource supports "io_alloc". Doing so makes the file visible for all cache resources though, for example also L2 cache (if it supports cache allocation). As a consequence, add capability for file to report expected "enabled" and "disabled", as well as "not supported". Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- v12:No changes. v11:Added Reviewed-by: tag. v10:Changelog update. Removed the h/w specific details from this patch and will add to the ne= xt patch. v9: Minor user doc(resctrl.rst) update. v8: Updated Documentation/filesystems/resctrl.rst. Moved resctrl_io_alloc_show() to fs/resctrl/ctrlmondata.c. Added prototype for rdt_kn_parent_priv() in fs/resctrl/internal.h so, it can be uses in other fs/resctrl/ files. Added comment for io_alloc_init(). v7: Updated the changelog. Updated user doc for io_alloc in resctrl.rst. Added mutex rdtgroup_mutex in resctrl_io_alloc_show(); v6: Added "io_alloc_cbm" details in user doc resctrl.rst. Resource name is not printed in CBM now. Corrected the texts about it in resctrl.rst. v5: Resolved conflicts due to recent resctrl FS/ARCH code restructure. Updated show_doms() to print the resource if only it is valid. Pass NUL= L while printing io_alloc CBM. Changed the code to access the CBMs via either L3CODE or L3DATA resourc= es. v4: Updated the change log. Added rdtgroup_mutex before rdt_last_cmd_puts(). Returned -ENODEV when resource type is CDP_DATA. Kept the resource name while printing the CBM (L3:0=3Dfff) that way I dont have to change show_doms() just for this feature and it is consistant across all the schemata display. v3: Minor changes due to changes in resctrl_arch_get_io_alloc_enabled() and resctrl_io_alloc_closid_get(). Added the check to verify CDP resource type. Updated the commit log. v2: Fixed to display only on L3 resources. Added the locks while processing. Rename the displat to io_alloc_cbm (from sdciae_cmd). --- Documentation/filesystems/resctrl.rst | 15 +++++++++++++++ fs/resctrl/ctrlmondata.c | 21 +++++++++++++++++++++ fs/resctrl/internal.h | 1 + fs/resctrl/rdtgroup.c | 22 ++++++++++++++++++++++ 4 files changed, 59 insertions(+) diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesyst= ems/resctrl.rst index d7a51cae6b26..108995640ca5 100644 --- a/Documentation/filesystems/resctrl.rst +++ b/Documentation/filesystems/resctrl.rst @@ -137,6 +137,21 @@ related to allocation: "1": Non-contiguous 1s value in CBM is supported. =20 +"io_alloc": + "io_alloc" enables system software to configure the portion of + the cache allocated for I/O traffic. File may only exist if the + system supports this feature on some of its cache resources. + + "disabled": + Resource supports "io_alloc" but the feature is disabled. + Portions of cache used for allocation of I/O traffic cannot + be configured. + "enabled": + Portions of cache used for allocation of I/O traffic + can be configured using "io_alloc_cbm". + "not supported": + Support not available for this resource. + Memory bandwidth(MB) subdirectory contains the following files with respect to allocation: =20 diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index 0d0ef54fc4de..78a8e7b4ba24 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -676,3 +676,24 @@ int rdtgroup_mondata_show(struct seq_file *m, void *ar= g) rdtgroup_kn_unlock(of->kn); return ret; } + +int resctrl_io_alloc_show(struct kernfs_open_file *of, struct seq_file *se= q, void *v) +{ + struct resctrl_schema *s =3D rdt_kn_parent_priv(of->kn); + struct rdt_resource *r =3D s->res; + + mutex_lock(&rdtgroup_mutex); + + if (r->cache.io_alloc_capable) { + if (resctrl_arch_get_io_alloc_enabled(r)) + seq_puts(seq, "enabled\n"); + else + seq_puts(seq, "disabled\n"); + } else { + seq_puts(seq, "not supported\n"); + } + + mutex_unlock(&rdtgroup_mutex); + + return 0; +} diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h index cf1fd82dc5a9..a18ed8889396 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -426,6 +426,7 @@ int mbm_L3_assignments_show(struct kernfs_open_file *of= , struct seq_file *s, voi =20 ssize_t mbm_L3_assignments_write(struct kernfs_open_file *of, char *buf, s= ize_t nbytes, loff_t off); +int resctrl_io_alloc_show(struct kernfs_open_file *of, struct seq_file *se= q, void *v); =20 #ifdef CONFIG_RESCTRL_FS_PSEUDO_LOCK int rdtgroup_locksetup_enter(struct rdtgroup *rdtgrp); diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 0320360cd7a6..6d89160ebd11 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -1947,6 +1947,12 @@ static struct rftype res_common_files[] =3D { .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_thread_throttle_mode_show, }, + { + .name =3D "io_alloc", + .mode =3D 0444, + .kf_ops =3D &rdtgroup_kf_single_ops, + .seq_show =3D resctrl_io_alloc_show, + }, { .name =3D "max_threshold_occupancy", .mode =3D 0644, @@ -2138,6 +2144,20 @@ static void thread_throttle_mode_init(void) RFTYPE_CTRL_INFO | RFTYPE_RES_MB); } =20 +/* + * The resctrl file "io_alloc" is added using L3 resource. However, it res= ults + * in this file being visible for *all* cache resources (eg. L2 cache), + * whether it supports "io_alloc" or not. + */ +static void io_alloc_init(void) +{ + struct rdt_resource *r =3D resctrl_arch_get_resource(RDT_RESOURCE_L3); + + if (r->cache.io_alloc_capable) + resctrl_file_fflags_init("io_alloc", RFTYPE_CTRL_INFO | + RFTYPE_RES_CACHE); +} + void resctrl_file_fflags_init(const char *config, unsigned long fflags) { struct rftype *rft; @@ -4408,6 +4428,8 @@ int resctrl_init(void) =20 thread_throttle_mode_init(); =20 + io_alloc_init(); + ret =3D resctrl_mon_resource_init(); if (ret) return ret; --=20 2.34.1