Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp504373lqb; Fri, 24 May 2024 05:26:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBM8P7JyUXugXbRWB5gplus61B8q55Tq4J7I4xghDkmOlYsR3d/SyST+SsmLESuRkxi34c3m45uryWJreRYe1utvy6iD54q6l4a+AUiQ== X-Google-Smtp-Source: AGHT+IErjgUO87P4WU2DKMfpDvoMmG4KZD3ilfQhtzVUPoWOIzu9M+xVGu+MVnJrU0BXJuuJb3BC X-Received: by 2002:a50:cd43:0:b0:574:f83d:b282 with SMTP id 4fb4d7f45d1cf-57843c4337cmr4365785a12.2.1716553584342; Fri, 24 May 2024 05:26:24 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57852496a45si795441a12.456.2024.05.24.05.26.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 05:26:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188677-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=EaYAypOI; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-188677-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188677-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E70D71F22D02 for ; Fri, 24 May 2024 12:26:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C8BF886AC8; Fri, 24 May 2024 12:25:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="EaYAypOI" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2051.outbound.protection.outlook.com [40.107.93.51]) (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 37ACF86641; Fri, 24 May 2024 12:25:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.51 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716553504; cv=fail; b=kJV6zH3AbsiuSEMdk/8sPJYM1QsKYzWTIduTRMlM7QX7UP9A9IiljwB0a6ddpjvgviQRKEj4oTjE7iOqA/OZszaMf63lWim2Jh4C+GfdOLRS5x7gRTIrZn9IvvYGPgPhJB0MoiQiOmwMOTkHwKTQRqZKFtfAxNMv45Hq3+/Dagg= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716553504; c=relaxed/simple; bh=Sy0o7OKV9TwXYaAOITt5m3IrokHc82nhnFX1BtYREmQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ba+g0nxcqmWD9B5tThszb3pzSl22q/o6ixgFtdLBr7BPMDfAnwwyYHv7y6+tzfGa5+g1hssMAWTz7CTx05FSYNTOTRWziabTDvFIDdWDu62uoM1nS1UwjExKc4Wrd0l9rQ2SdIGr6YZfvFCT9O8+WdRWvbDzQiXzR4MUj5gTlfg= 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=EaYAypOI; arc=fail smtp.client-ip=40.107.93.51 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EA30TzN9Lk9Css60yuE9yuvgDTkxC86vRLNz4PC7a2rSPSglScCjeKLv/bpPoHWx6eX3tZjt8HOybiR813P1VgTVNnDXG6M+NCI4NX8jmB/ln1dLYkfo72NaBlrmbzMkQny/8gO8FhyWHe+LxmPz3hI4/TweduewfCWLmT9hYFIDHoLz6QYumXzxXiTeJAjJ5neLZy+nnklFGIwSOFX2cb4vmUfQ18rvmAqwPsTtQU2R2tkEm4g37WYX86fgY8BTPF0KPo6UTdDflGi1nVPm8sZ5taMbXtN0KzGuzLmzqFl7gBWLz4O+bbXclmkuDNmG+uaGCilYM980YmZem6FPSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=rpiA1ns0tP4/JeEE5F3LV8xqPrgtkmMxjnFtl//7eFw=; b=m+AgYxcODdWpx3JMUnUYOO+MqyXv/KCtHc6JE+ywYJQiYC36a17IY3ZJ8/MC+867HAHTlE+BSo7UGGYDs+4stgsvG/s1zAJH1IRq4MKpSSOAOs4+4PmVSLE3H40ap5JDcpwDKSNyXUrd2cMnh718t+p+kzQsANDrRM+JnKr9jytFLdx26sM/pWMnn+0frY+ta3IGGcgeFiTpZJhT55xC1I5/1gY+qFg0rFY90Iv8TwPLEwGqZ/Awu9whB9YFt98bjW+MLOO0+Lvdf2UudaXb1F/mByVV9ODOHbfNbQIfuPIChHVpz1E8e7IqyIPI7kf5q8VBUNk7PHRd34/6yqP+tg== 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=rpiA1ns0tP4/JeEE5F3LV8xqPrgtkmMxjnFtl//7eFw=; b=EaYAypOIuXpIxE/0FgeC5dfOq8+jZkZ/DPK+XhAr/ZLe6RqvqfHjuiW/EPqgfz6OvXgArhiat1iP6g4WskoN6hRjEmRkCE0eaVtW8A3iMXoCwzn1dJ1QUmHkHTC3LCO3oInGhHHV4FPNI+vhYTZrxSquiLqfMFtSzb9I3cZZJqI= Received: from BYAPR21CA0010.namprd21.prod.outlook.com (2603:10b6:a03:114::20) by PH7PR12MB5734.namprd12.prod.outlook.com (2603:10b6:510:1e1::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22; Fri, 24 May 2024 12:24:56 +0000 Received: from CO1PEPF000044EE.namprd05.prod.outlook.com (2603:10b6:a03:114:cafe::eb) by BYAPR21CA0010.outlook.office365.com (2603:10b6:a03:114::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.5 via Frontend Transport; Fri, 24 May 2024 12:24:55 +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 CO1PEPF000044EE.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7611.14 via Frontend Transport; Fri, 24 May 2024 12:24:55 +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.35; Fri, 24 May 2024 07:24:53 -0500 From: Babu Moger To: , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 08/19] x86/resctrl: Introduce the interface to display monitor mode Date: Fri, 24 May 2024 07:23:27 -0500 Message-ID: <3b9ef8bc03c1004794a087537c6f2f051760402d.1716552602.git.babu.moger@amd.com> 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: 8bit Content-Type: text/plain 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: CO1PEPF000044EE:EE_|PH7PR12MB5734:EE_ X-MS-Office365-Filtering-Correlation-Id: 801b6850-356c-4117-b0de-08dc7bec854f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|376005|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?UWg8KhlMf/iAxIo750FL8ZnCZk39adeyPgSJvThLcuNwOmtGOiqO+5O77ur3?= =?us-ascii?Q?A8d/3nG2u1HUzsfVd3iW1u5mqa+e9rug7EFb7PRpU3y/UEHjKbFHTqlHN8UG?= =?us-ascii?Q?j7aEmSMhOl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-ascii?Q?vvDUjSg6bQgrkxOkKdhFs7K9/SphSBfB8LNd6L4eKbbcwZgHf88d12mXCav6?= =?us-ascii?Q?aBkYeH1Akdosec8g13aL515wdsyUop4vwQ6Kw17jy3YSikKVtJ5UeWK5eD7u?= =?us-ascii?Q?dMvSesgYMg987rG5rgZ9icSIlWgUVNBVbxtwRtGrvkYpOoB8rq5+oT0jUzGF?= =?us-ascii?Q?rax0AdKLMPiqBeQge96oku5DmCXEh+t7lq3IvEO64WBX2zgb4plPIjAtXXzn?= =?us-ascii?Q?w1arsbALgGnPe4/ypVEYbYwd8QoJwpGrM9yM4GnBeM1mRjYgHxUUc2kejOJi?= =?us-ascii?Q?eKUkieMctMPRrgt9sU0PMeRdNiEb9PgC3Pp5i/d1sIdL8VKb0pQhT/WeWhPe?= =?us-ascii?Q?HD30SWzf0d7G1xkP5vqZ4BmVafDw?= 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:(13230031)(1800799015)(7416005)(376005)(36860700004)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2024 12:24:55.7139 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 801b6850-356c-4117-b0de-08dc7bec854f 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: CO1PEPF000044EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5734 The ABMC feature provides an option to the user to assign a hardware counter to an RMID and monitor the bandwidth as long as it is assigned. ABMC mode is enabled by default when supported. System can be one mode at a time (Legacy monitor mode or ABMC mode). Provide an interface to display the monitor mode on the system. $cat /sys/fs/resctrl/info/L3_MON/mbm_assign [abmc] legacy Signed-off-by: Babu Moger --- v4: Fixed the checks for legacy and abmc mode. Default it ABMC. v3: New patch to display ABMC capability. --- Documentation/arch/x86/resctrl.rst | 10 ++++++++++ arch/x86/kernel/cpu/resctrl/monitor.c | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 7ab8172ef208..ab3cde61a124 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -261,6 +261,16 @@ with the following files: Available when ABMC feature is supported. The number of ABMC counters available for configuration. +"mbm_assign": + Available when ABMC feature is supported. Reports the list of assignable + monitoring features supported. The enclosed brackets indicate which + feature is enabled. + :: + + cat /sys/fs/resctrl/info/L3_MON/mbm_assign + [abmc] + mbm_legacy + "max_threshold_occupancy": Read/write file provides the largest value (in bytes) at which a previously used LLC_occupancy diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index e75a6146068b..b1d002e5e93d 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -1071,6 +1071,7 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r) if (rdt_cpu_has(X86_FEATURE_ABMC)) { r->abmc_capable = true; + resctrl_file_fflags_init("mbm_assign", RFTYPE_MON_INFO); /* * Query CPUID_Fn80000020_EBX_x05 for number of * ABMC counters diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 9148d1234ede..3071bbb7a15e 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -856,6 +856,23 @@ static int rdtgroup_num_cntrs_show(struct kernfs_open_file *of, return 0; } +static int rdtgroup_mbm_assign_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdt_resource *r = of->kn->parent->priv; + struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); + + if (hw_res->abmc_enabled) { + seq_puts(s, "[abmc]\n"); + seq_puts(s, "mbm_legacy\n"); + } else { + seq_puts(s, "abmc\n"); + seq_puts(s, "[mbm_legacy]\n"); + } + + return 0; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1913,6 +1930,12 @@ static struct rftype res_common_files[] = { .seq_show = mbm_local_bytes_config_show, .write = mbm_local_bytes_config_write, }, + { + .name = "mbm_assign", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_mbm_assign_show, + }, { .name = "cpus", .mode = 0644, -- 2.34.1