From patchwork Thu Dec 1 15:37:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp330060wrr; Thu, 1 Dec 2022 07:38:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf7P+b1HK9wPXrrUhGmtVAJxtm0IL/m9GNjid4HVhyFA8herenavRrn/4EONi/yrUTpesBRI X-Received: by 2002:a63:1763:0:b0:476:d5be:4511 with SMTP id 35-20020a631763000000b00476d5be4511mr33695717pgx.139.1669909099952; Thu, 01 Dec 2022 07:38:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909099; cv=pass; d=google.com; s=arc-20160816; b=HLDQwrCUz/wGP0ZcPv3dRg06DS4/vIjwsSV4DsGTTwjBhTLBS/+j3Fe+h0McnD2olh s6z/P5lSvyn8Wwx3ka87tU4hHkau9wN4HEJ9quDaBUgHsikP0MvGstoBBUm6buGsd6Mu ReQWu2hQd4YKMj0as9T1xyyYz2Yfe1vlgEP4qe8v8qFkmbun36bpHMpxkVhRUmzxwt0A KehAuBTNrAn+w0nLVzF/1JEWbVbgSm5iHXbooob9jec78va/Wxry3kGvkHNYBCI4EAfO JIEiWo2ehq0UUgrrutG2jHPqSaI/L+tK8lrMsxUyR58xZRnaBirIpFDrUzuhvS3StZex Q6BQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=vSPaLBPKryxvsIaZH6p9iqxAa87bzU1121Sb7imypRc=; b=ndRrBEiAkyxR95ldmGwmApPiBHzvGlHtDMTGjnczpk2AMwmD7QM+8t6g8CjjdOtDnl O9ZK8TqtlCNy222OAsOmL2uBm8nvEMQSfRoz0pHGC7qsDdcqf8FVNolTs/ypr2E9TVB7 ViffPkcUgXXsfyfn7fzAJkmDitmrLRD+lYU3yGZl5VW6+uc2bjQsriepP9Xu2IsJlhkw +dkI5vONnZ+zSb14tFZSzMKUn50HUnPjrrqxSygxTy55hAgZ6u07t3DZ0RrJp3rz8Q8u VKzVqT3VdrRraYfNHA1FxSvdoTzqhd2JC2EumbBjzzKo1Jd4fomD9oZrPyNPRMrZgoMh RAZQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HMPODTE4; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a17090a4d4600b00200e221e9a0si7384570pjh.149.2022.12.01.07.38.04; Thu, 01 Dec 2022 07:38:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HMPODTE4; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232093AbiLAPhg (ORCPT + 99 others); Thu, 1 Dec 2022 10:37:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232215AbiLAPhK (ORCPT ); Thu, 1 Dec 2022 10:37:10 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2043.outbound.protection.outlook.com [40.107.243.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A46BAAD33A; Thu, 1 Dec 2022 07:37:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MLVcNHJBEWbd8Ykguqn8+WTInqtGeIO2QCqHmfYu0a3SayBoJvmrPwzpKq3fY2zzPiTUyeBb14rXnavIONycpgMVYRFgBLSdsFWn2KO7KSpQ1Ky5PgPKHcdNG3LRTBgZ9DYTDMRYdNvHTUz99UlWY8JiqOHUjHDntI1w8jhlw6stBcrA36nQzbZ5YHEaWmXU9teLTvuOdqoV+5M1yMeU12rm8Bo8QYBIE9v/ia4m+8B0uKeZdzIfpYlBYrDqIny7UPLWMtaSvrTlz5nBQfB+U9nk6g/TNJO/3z72ABo/+zKBpFuOY1SCSeKntiw8sg0gcSTNJRKRFzVt3o9siT5kXA== 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=vSPaLBPKryxvsIaZH6p9iqxAa87bzU1121Sb7imypRc=; b=nT/wI/oiMsnxeUDBX8K83dwguKEVgubhtk1LDBjD9CRT6YJYCj4AOTTVAcQyKY5wxFWB43yFzlO4Lvlf+/CfkBKfJFjNEN40HOIYr6I+YNCUg6QGLsALyrj2AvrY9hHaT8/y+xxDZhbmL/KURFQ+/knZNjnTKwA7SDGCDfcQsx+a1H8j6B0NLMOEXmnxFEd8buPXa8jCDOUEBN6p8L1rTNGoHdpAPq7txXf3biWoUI4lfQtW4JTRGRqZbXWr9OJ8ksoENt5TSQKvIDJK2GGsvu/urRJo4476ukh+1YMFAiIG+V3M4z1BZreeYZG1nmdW6Wln3oXkiqEpDMBfmWvaaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de 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 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=vSPaLBPKryxvsIaZH6p9iqxAa87bzU1121Sb7imypRc=; b=HMPODTE4rX1djMJZBr2eJr/6/cqVYHu1jYG/TJo/HE1GIaIF7WxRYCdi683J8BJXZiA248lKMR2T7FpEpth5eU9Zf8mRVeXaDQ1wa2oa93rOJ7V+k05q9QLPIXoK5I1lb06W1E9BjpkFdzn3Lsdfc4QSBYAWy+qtLJe3r23lysU= Received: from MW4PR03CA0128.namprd03.prod.outlook.com (2603:10b6:303:8c::13) by PH7PR12MB5595.namprd12.prod.outlook.com (2603:10b6:510:135::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Thu, 1 Dec 2022 15:37:07 +0000 Received: from CO1NAM11FT086.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8c:cafe::66) by MW4PR03CA0128.outlook.office365.com (2603:10b6:303:8c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:37:07 +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 CO1NAM11FT086.mail.protection.outlook.com (10.13.175.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:37:06 +0000 Received: from [127.0.1.1] (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.2375.34; Thu, 1 Dec 2022 09:37:03 -0600 Subject: [PATCH v9 09/13] x86/resctrl: Add sysfs interface to read mbm_local_bytes_config From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:37:03 -0600 Message-ID: <166990902305.17806.9650262646704189221.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] 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: CO1NAM11FT086:EE_|PH7PR12MB5595:EE_ X-MS-Office365-Filtering-Correlation-Id: 22b6a6fc-6583-4775-b801-08dad3b1e76d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O+RMWiRyPI/z+ApWlB10AviGXU5NlO47iiW2GMKj2AC2ikqODVLv7HCv91fC0CY9cS+6JQ4Z7NbUFgj6vYyWw8TLCCSzKIC3arFCpPgCq3P2HIbQkHdh1Su9CzMT0RzKaQilKGAP/sbOBjOKLEwwfv46hYleYLg7PpnnAla9pEIOkvvXaIzCpN7e4MjZqT8Qg1TtFwFBOeTBqMTMNJKHMCP6blmrjFyOtVvPAxfM3y2/GeP643tv27IcHxACadtmf6Z51Qfy8oEJMWom2c4tKEiGlp/aS2Fi7hsQwqq0r7yrDhbe8Yf+xa/k2vlt8hfsZUazXOJT/F+ppphrPDB2A+uj66Ok5yCyVIuzdmcnq27JakSuWENcK93gU9qdp5y2an/zaNVi+5NejSixCbqvNA+S819o6K3MVm48syM2olEiUZbNdiYs8YwxWwGGps+1UNN5TC9N34SULTFDJ7AI0Wd0YUta7swZGDfseSc+yY5iZ9gmJBvF9VbLT12Gv3k4v2jXJRt5yC3gmrBkJDZsj6Kzyx0ROT7jNp+p1g+MvfbUEh8BAgErujXX6s9usbc0+s1Cx6/au1WV7izTqyIHy7eMsfsMGUKDhSJZLq0lUBpJCRlj6Mqb7zAdybKwMbcztyIqF6GiwSdTSxhUJreKqXeJn8TKh2Bguo53gcS8hB1qMY4PkMBo8VQ8rM5UpVTjVasR12ocPkZL9qQkxwoTP+JT9nd2axaWJ3pvWxfqdAkKkl5b0X1pkl885EbZtFfjD3nUGQN2G/itVMsLXuCq0Q== 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:(13230022)(4636009)(7916004)(376002)(136003)(396003)(39860400002)(346002)(451199015)(36840700001)(40470700004)(46966006)(41300700001)(5660300002)(82740400003)(426003)(16526019)(40460700003)(40480700001)(16576012)(54906003)(110136005)(356005)(316002)(47076005)(81166007)(70206006)(336012)(70586007)(86362001)(4326008)(478600001)(82310400005)(33716001)(103116003)(9686003)(83380400001)(26005)(186003)(8676002)(7406005)(44832011)(2906002)(7416002)(8936002)(36860700001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:37:06.9246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22b6a6fc-6583-4775-b801-08dad3b1e76d 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: CO1NAM11FT086.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5595 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751026604067630288?= X-GMAIL-MSGID: =?utf-8?q?1751026604067630288?= The current event configuration can be viewed by the user by reading the configuration file /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config. The event configuration settings are domain specific and will affect all the CPUs in the domain. Following are the types of events supported: ==== =========================================================== Bits Description ==== =========================================================== 6 Dirty Victims from the QOS domain to all types of memory 5 Reads to slow memory in the non-local NUMA domain 4 Reads to slow memory in the local NUMA domain 3 Non-temporal writes to non-local NUMA domain 2 Non-temporal writes to local NUMA domain 1 Reads to memory in the non-local NUMA domain 0 Reads to memory in the local NUMA domain ==== =========================================================== By default, the mbm_local_bytes_config is set to 0x15 to count all the local event types. For example: $cat /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config 0=0x15;1=0x15;2=0x15;3=0x15 In this case, the event mbm_local_bytes is currently configured with 0x15 on domains 0 to 3. Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- arch/x86/kernel/cpu/resctrl/monitor.c | 4 +++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index 2afddebc8636..7c8a3a745041 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -788,8 +788,10 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r) mbm_total_event.configurable = true; mbm_config_rftype_init("mbm_total_bytes_config"); } - if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) + if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) { mbm_local_event.configurable = true; + mbm_config_rftype_init("mbm_local_bytes_config"); + } } l3_mon_evt_init(r); diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index e93b1c206116..580f3cce19e2 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1507,6 +1507,16 @@ static int mbm_total_bytes_config_show(struct kernfs_open_file *of, return 0; } +static int mbm_local_bytes_config_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct rdt_resource *r = of->kn->parent->priv; + + mbm_config_show(seq, r, QOS_L3_MBM_LOCAL_EVENT_ID); + + return 0; +} + /* rdtgroup information files for one cache resource. */ static struct rftype res_common_files[] = { { @@ -1611,6 +1621,12 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .seq_show = mbm_total_bytes_config_show, }, + { + .name = "mbm_local_bytes_config", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = mbm_local_bytes_config_show, + }, { .name = "cpus", .mode = 0644,