From nobody Mon Oct 6 03:16:30 2025 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2068.outbound.protection.outlook.com [40.107.95.68]) (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 A478F24886C; Fri, 25 Jul 2025 18:35:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753468546; cv=fail; b=oJuGayPj1wx0YGIEAHWkxndcgHNuj4K0TROJ9rqQlosOD8hqslTFK+pZOx5wNmG2/63T+nJvCsekzeqZTkoB/KXf1euW35yxDt68ztj/PZJhR871YDVXP1FcSULVZhCI8ljhebq2O4fd2mgy7pJeV50csje98E3VxTp3wCI83nQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753468546; c=relaxed/simple; bh=ztjT5IHH+3hpBhLIlID60K78MV/GmgVMRXLGtGo2iUM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YOtlQ8PbNq1YLO1IJrMzR0AY6NPqoxh8OF1T5zlIjJEeQF9ZbZsqiOGWtaNMAH70t/E6f/Vu5mVt2o7nuB10iIAhfaNs2qdJlK+a+kJDYW3ELa88Qofg3UMnwxY4BwQlNxYInJRWJMScsE0fz9qvi78Pgp3+/QgO2QUTpR8jHwU= 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=CGYH/BsS; arc=fail smtp.client-ip=40.107.95.68 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="CGYH/BsS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Lt8Rva0wdZEFLPaQwEUZirEXauK1n2fWGBR/daG2CZj4bFRONvOzkllEWYA7eP4BMq2gccqq08/XvIT1naskHHwxV66aGzbKSpe1lXNagOWgZnZOsqTcSTPr9EQMCIhfdjEZ2ouwyKyAnxir7YKQU6XGdbKoejdEjfhUps40Wdnhilb8iTjD9FU5iQ1VOyBMD/ivJtPyLZrBrzxdrrwsmp4nUz8ljqW/o5uaZBRyryvs0qUlUUIikDapS+qOPvRdrDJkINFYrDyu6n5qMuYh3mwqFuoJWqO7MbPrtKgszZugCVePx2aInOFq1AcKhhixoz+YZjxUuKr83nHHWDKQJw== 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=+d+xGTA/oscjHZ2ge0bwl2gNA7vk1ivfQKwPJe4URPU=; b=M7MxT9Qtcf6A2+Ha29vMl6THAky4MnoWNbIQdeauDUA04KFLvVKn2bJ5ipMGAG9GxDZdWhW5A7vNWL4jaMeBRF7jFj2fG7pruhCLoQbX1aKLFu5o8T3NqXqfHQmN4/sYmK/vdCoIjwxR94P7IGpOfJvkuziCEl5XtYjdiD+R+TAtyhH7s4fsKok5x0T+X7SqkhjsO8Rn0Fs7ChLB2IX0wMF0Bd86vjCX7zYbqNqotXiI2tRotsiigOg9ne76X2fFf7csABzpH08w3yIXn/0x8WKB88U6pOxE7QBCwEJS2QAqJw1hBKydZP6gfenLqpB8gXHkO9Q9mtdC8mebwuiGeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=+d+xGTA/oscjHZ2ge0bwl2gNA7vk1ivfQKwPJe4URPU=; b=CGYH/BsSLK7syPSXqKVO0blGHvOl8TPCpJYjLS91wtOTuw79jm62CrALs9Agm2Vy1fgcmBg4Yz9MyiL5IMb7Pke8F/Tf/75AhJSYBZgswrZWqn+rvZuiB1NwzQHX0CxvBPceStwdXAjlO0QjNUFE0cVTvTQ/KUTfgV6KdO1yN/w= Received: from SJ0PR03CA0145.namprd03.prod.outlook.com (2603:10b6:a03:33c::30) by PH0PR12MB5677.namprd12.prod.outlook.com (2603:10b6:510:14d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8964.21; Fri, 25 Jul 2025 18:35:38 +0000 Received: from CY4PEPF0000EE3C.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::3b) by SJ0PR03CA0145.outlook.office365.com (2603:10b6:a03:33c::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8964.23 via Frontend Transport; Fri, 25 Jul 2025 18:35:38 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE3C.mail.protection.outlook.com (10.167.242.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8964.20 via Frontend Transport; Fri, 25 Jul 2025 18:35:37 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Jul 2025 13:35:35 -0500 From: Babu Moger To: , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v16 31/34] fs/resctrl: Disable BMEC event configuration when mbm_event mode is enabled Date: Fri, 25 Jul 2025 13:29:50 -0500 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE3C:EE_|PH0PR12MB5677:EE_ X-MS-Office365-Filtering-Correlation-Id: 92118b7c-1d7b-4845-553c-08ddcbaa0ccc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?B?aUs0NmZPNkhjRjB1TlplMFJEZzMxMlhJV1lzQVhpVytRVGY5Z2RMZUg4Yno4?= =?utf-8?B?Q2lSaXkrMk9vcHVxM21qREx4cW9PNUZPRlo0NFB1SzlsU2w2S1pacmdzN2li?= =?utf-8?B?ZFNwTmQrbTdpVTFJWmZ6c0xsRzE3WTQxMlRCL3V0WXBDMDNOVlFFOHVaa2dr?= =?utf-8?B?emVJODNkWmZHZ2R6TUhtQm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0xYd0JOK1V2eis0SXg5c3o0?= =?utf-8?B?ZFIwM3NwUnVORkNVYUFPL2ZWcnBySjNDWnpPWjJVY0FKZWlLdVh0ZlpjZHB1?= =?utf-8?Q?OpmZSg?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2025 18:35:37.5202 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92118b7c-1d7b-4845-553c-08ddcbaa0ccc 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE3C.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5677 The BMEC (Bandwidth Monitoring Event Configuration) feature enables per-domain event configuration. With BMEC the MBM events are configured using the mbm_total_bytes_config or mbm_local_bytes_config files in /sys/fs/resctrl/info/L3_MON/ and the per-domain event configuration affects all monitor resource groups. The mbm_event counter assignment mode enables counters to be assigned to RMID (i.e a monitor resource group), event pairs, with potentially unique event configurations associated with every counter. There may be systems that support both BMEC and mbm_event counter assignment mode, but resctrl supporting both concurrently will present a conflicting interface to the user with both per-domain and per RMID, event configurations active at the same time. The mbm_event counter assignment provides most flexibility to user space and aligns with Arm's counter support. On systems that support both, disable BMEC event configuration when mbm_event mode is enabled by hiding the mbm_total_bytes_config or mbm_local_bytes_config files when mbm_event mode is enabled. Ensure mon_features always displays accurate information about monitor features. Suggested-by: Reinette Chatre Signed-off-by: Babu Moger --- v16: Added new comment in resctrl_bmec_files_show() about kernfs_find_and_g= et failure. Added the parameter to resctrl_bmec_files_show() to pass the kernfs_no= de. v15: Updated the changelog. Moved resctrl_bmec_files_show() inside rdtgroup_mkdir_info_resdir(). Removed the unnecessary kernfs_get() call. v14: Updated the changelog for change in mbm_assign_modes. Added check in rdt_mon_features_show to hide bmec related feature. v13: New patch to hide BMEC related files. --- fs/resctrl/rdtgroup.c | 44 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 2d2b91cd1f67..1aeac350774d 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -1150,7 +1150,8 @@ static int rdt_mon_features_show(struct kernfs_open_f= ile *of, if (mevt->rid !=3D r->rid || !mevt->enabled) continue; seq_printf(seq, "%s\n", mevt->name); - if (mevt->configurable) + if (mevt->configurable && + !resctrl_arch_mbm_cntr_assign_enabled(r)) seq_printf(seq, "%s_config\n", mevt->name); } =20 @@ -1799,6 +1800,41 @@ static ssize_t mbm_local_bytes_config_write(struct k= ernfs_open_file *of, return ret ?: nbytes; } =20 +/* + * resctrl_bmec_files_show() =E2=80=94 Controls the visibility of BMEC-rel= ated resctrl + * files. When @show is true, the files are displayed; when false, the fil= es + * are hidden. + * Don't treat kernfs_find_and_get failure as an error, since this functio= n may + * be called regardless of whether BMEC is supported or the event is enabl= ed. + */ +static void resctrl_bmec_files_show(struct rdt_resource *r, struct kernfs_= node *l3_mon_kn, + bool show) +{ + struct kernfs_node *kn_config; + char name[32]; + + if (!l3_mon_kn) { + sprintf(name, "%s_MON", r->name); + l3_mon_kn =3D kernfs_find_and_get(kn_info, name); + if (!l3_mon_kn) + return; + } + + kn_config =3D kernfs_find_and_get(l3_mon_kn, "mbm_total_bytes_config"); + if (kn_config) { + kernfs_show(kn_config, show); + kernfs_put(kn_config); + } + + kn_config =3D kernfs_find_and_get(l3_mon_kn, "mbm_local_bytes_config"); + if (kn_config) { + kernfs_show(kn_config, show); + kernfs_put(kn_config); + } + + kernfs_put(l3_mon_kn); +} + static int resctrl_mbm_assign_mode_show(struct kernfs_open_file *of, struct seq_file *s, void *v) { @@ -2492,6 +2528,12 @@ static int rdtgroup_mkdir_info_resdir(void *priv, ch= ar *name, ret =3D resctrl_mkdir_event_configs(r, kn_subdir); if (ret) return ret; + /* + * Hide BMEC related files if mbm_event mode + * is enabled. + */ + if (resctrl_arch_mbm_cntr_assign_enabled(r)) + resctrl_bmec_files_show(r, kn_subdir, false); } } =20 --=20 2.34.1