Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1135580rwb; Fri, 13 Jan 2023 08:19:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXvML5+7ZLk5sr979C94WmtOGS6jQYr/E034GBlgVHXtCcZC396HyafQhiIkbm4MsAVpSpGN X-Received: by 2002:a05:6a20:a016:b0:b5:e461:48b4 with SMTP id p22-20020a056a20a01600b000b5e46148b4mr25032416pzj.22.1673626798325; Fri, 13 Jan 2023 08:19:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673626798; cv=pass; d=google.com; s=arc-20160816; b=JpOYD09gZIILNWKaRRIfS9BS7OLRJDp6tcVjqZG2r098ZK9m/rpHl5RJMf1awNDuxA 8roMmhV/xOW9fBuwTBQVO+rOICuvvkaxDCF2qj1fQ3w+O0KtZunDVC7ZT1HJPV6kJrH2 atJSIfRJazqQpOEyJCmkJvO8TPhULlmVHpmy9p7TGP+6kj1CBSK0uWV46sBLzixTAIXY zMwq1K2YnKA+TBiCRIVQ6ty5kzRwI07MPdB1QgnOYOLqfvN9NXjSWXK5ZMPmaDvpI+x9 kTfp2vS6Y8o5flZrzgWTvyjGO5A6t/bsfb1yiGXZtvoYYqCnNaylOd9i0UyrnzwNUm2F wmNQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DQNTH4Z2Sw0lgrMlDRMmOQNP2fkgpMeiK7taVTU/oGc=; b=Ad1Qlk39X4FrjtVI4eslgTEBlF6FoP6L7fvQicGi/S0a/+J8EnPXBUjK0ld6IlCsR6 fBz7Vvv27xjpvo+gHuBU5OGJZZox4YHDFnhydfNSIj2Z77/QYmmCRTj8/wudbdOzbG4i Sees9le6NNszqvFsLB1H/fGthCYyNDttJVUFBj/X+ImMjkyoPAhQE8zJdDHiI8xq8KFa mB5sY6VLRZS60gsUvgDzYD9/EnLK/xW9GcKXPj1XsOQj8WuAhnzFczkqdj/yf/mjWH8O 70gGw1UOrClKOgBiCvXqiKMvHjI8qnz9Qa83asGHKKN6u5eIBeQksaQdep8KvtkuPcIS s5jw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=cMczKoWv; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a6540cb000000b004980040167fsi21036298pgp.642.2023.01.13.08.19.47; Fri, 13 Jan 2023 08:19:58 -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=cMczKoWv; 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 S229844AbjAMPvD (ORCPT + 51 others); Fri, 13 Jan 2023 10:51:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbjAMPt7 (ORCPT ); Fri, 13 Jan 2023 10:49:59 -0500 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2084.outbound.protection.outlook.com [40.107.95.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9789077AE8; Fri, 13 Jan 2023 07:42:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZwSM2RY4InuhR2crlwyeKJpD67djAJNmf5WaAnFT7/wVDtwWKujT178cP+CfYME9BTKZzJ5nqdakZjpzzOkgdzNZCvDMstgL0cZRqMLI0Qi+fZsTBlyTgg6d1WIwT8bKFglnR7++Oy7hXhur7Zt342O1zC/4nwil/oM8KB7PVbxiHLmeN6dS0/NVT8tGV6XqupE57I3i60Q8bJlwhqOx1jwo0daeK5nfmxQ8/HNZEezkFEH8bxYPmXiNwRhS/ejjN1Qf2fKfW19Tn12/cd0c/GoX/zjRuabO2B1MNlsc00VzjfgWyub34YKd6YH68gp9Uz3CUn7vcL3CagjMCeDPXg== 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=DQNTH4Z2Sw0lgrMlDRMmOQNP2fkgpMeiK7taVTU/oGc=; b=O8t3eMXgGldQ+fJ0ozIyKaQ+76excW2tZcoSQVGrhBeOMbr7jX+rvevZCSL/M7pkj7ShpWOOPVPuQjZKPEP+cOyFmHv3N2M1g6y6ci+nZbGodWhF0aWBpZh4fzmPE2a6e2Ec04aOYJ0EFAMxFj3AMwk7nmz/aAUraFPz3hmYNT2JfziuWw6tOQWE6O8POJZowLzSwlKxTKEQTM+GuIUlvDOaSi9kAJVEnoQVlcY6dVMlizsWJjf6hi6ajXXEX/40tobxbqnMAC63GhfUvGr9NXxmjKBdSBUb1025qSRfXkwZPgxHnCNQO+KKcsdikkkUPQBs6lK7h2QJ00QhQ9DwEA== 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 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=DQNTH4Z2Sw0lgrMlDRMmOQNP2fkgpMeiK7taVTU/oGc=; b=cMczKoWvKc3U6ruVh5fgpzi8hVxcxHwYqw9jZl68DkacdDymt5aevWxDG8CuUaksFFZ+bU6nMrmcUAnOBCKHI1Q8R84+XKYngb13cSyJaShrD4Q9ar8fu+cboVbogAgI+6oBhRDBsNjd4+eamxDVjbVOh76O6v49tSNn+3MawTQ= Received: from DS7PR03CA0016.namprd03.prod.outlook.com (2603:10b6:5:3b8::21) by PH7PR12MB8055.namprd12.prod.outlook.com (2603:10b6:510:268::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.19; Fri, 13 Jan 2023 15:42:53 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b8:cafe::e3) by DS7PR03CA0016.outlook.office365.com (2603:10b6:5:3b8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.16 via Frontend Transport; Fri, 13 Jan 2023 15:42:53 +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 DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Fri, 13 Jan 2023 15:42:53 +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.2375.34; Fri, 13 Jan 2023 09:21:11 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 10/13] x86/resctrl: Add interface to read mbm_local_bytes_config Date: Fri, 13 Jan 2023 09:20:36 -0600 Message-ID: <20230113152039.770054-11-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113152039.770054-1-babu.moger@amd.com> References: <20230113152039.770054-1-babu.moger@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT044:EE_|PH7PR12MB8055:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f04a65d-55d6-4861-e0e7-08daf57cd584 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ci42xNTibkAgEkpqf5nnV1k2YzT1QZ1UtIgu4rcpE3R/ocqG/lW9XYUnFlY6W1t3I/nm67k5rPu+nkS1OmCxY2wfOuWy1v46UEDuk56WNytX9SoL3BwK0sJelOBIFA9FPbvsQqBTjENmqzt5g/VC+5rCbXThwkWqSYB93zVlhEoTAoFIOLUWUd/oFVtWBIYSQRnpOW2KexUpfR4QO0ZrWc1lDwxHU11gB8P2b/6x1X4NQSXAbuuxzzCysqtcV5lYl2KKjZISn6HZPZZFttbQ4dM1/IGIt8Ifj8DQN6PVc8ez5Gmare2k0OS3baRObDaMeSztTmfhdvwiWcJlZxdh9zUu8TJ79gectXfqVLfvldx1Yla0J5RI+TfscfGyXKtpyNwT1Lp48Q+Px2PyoNOvV0N7Eob3FjpssrzcoyO3lqWZwA1mJYCBGaaH39dF9HqqYHtvWU2dX5L8xtCGlHIEtCXrg8H+9pwsxsf6XZXN+z4OhRCas+b14sS021KZ5lQmLRT2sTjJvjpwQ3mzZPJmCYYO6KrKoME6IdJsYsy9/xMXgRf4QjOX3Kk/+R/9ri5rGyoaPtFT/NhgDmiNAyRo4IxfZkQxnIqEc03ECC4VL5s4yLNdj/maf8cjYy70aOi+d9wcunh4x4j41K5PhhGrO87pQK/ZvPp6/taotCld2HtL3uTOU3iBEOXFA9om106pQwTghWuaSd3GIv9VvoFnzTN9W0tqVBhkI6ZvkJ7TTDE= 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)(376002)(346002)(136003)(39860400002)(396003)(451199015)(36840700001)(40470700004)(46966006)(2906002)(110136005)(40460700003)(5660300002)(7416002)(7406005)(316002)(54906003)(44832011)(36756003)(2616005)(1076003)(82310400005)(36860700001)(336012)(83380400001)(426003)(47076005)(7696005)(86362001)(26005)(40480700001)(16526019)(81166007)(356005)(186003)(82740400003)(478600001)(8936002)(8676002)(6666004)(70206006)(70586007)(4326008)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 15:42:53.2570 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f04a65d-55d6-4861-e0e7-08daf57cd584 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: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8055 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 The 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 configured with 0x15 on domains 0 to 3. Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger --- 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 0ff45e34d83c..28c65008fce1 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -805,8 +805,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 cd4e668e5019..ad3c7014adf6 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, -- 2.34.1