From patchwork Fri Nov 4 20:00:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 15778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp610273wru; Fri, 4 Nov 2022 13:03:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cWqgBoSILaf5afFnleetPpTfaZZP+4N65Fn27H8tcK3UOc/CfMnGHAyYvGWBH1W4KN5Ec X-Received: by 2002:aa7:9ece:0:b0:56c:5afe:67f7 with SMTP id r14-20020aa79ece000000b0056c5afe67f7mr37290447pfq.55.1667592206178; Fri, 04 Nov 2022 13:03:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592206; cv=pass; d=google.com; s=arc-20160816; b=QsbhCbwfc7rhJ2VZ+elD31QkLZOA0PeND/h2DrkjfOoHdPGktKJpZaRYeDP33xd4o7 unL5wKFEInsD4mCsx7ElUT0QCfrywFFBFfXN0ikSLfkndee2Q8hsE8sQXjj9CZfTG+m5 4y7Lc456zT6H+BXBQ5F9Di1prRo22sFD2kCMUsxXGkbUXHqgGCfAIulrfHznMjJav2jv TDJMsA4r/R5zZl1EjDbji1oUQq4q8hk+23KECxFnMNH1rSZYf4iwHdMSDVeAc/Yd/nwZ Q0nI8HifTI0X8Qv7Z2zUqCf7oWT+WSrfESLOJ2Vb0ki0HcwtjdE3M4i/p4HRIjAU6CCV lW0A== 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=sKb9tDfP1LbvSJvk9qh0dWDguSRtNWle59XvPJKlnR8=; b=RUEs1CJ8n4Cu8ndovtHysJhBe9Io2kfHNPj1ojFl/0kSKJCDgKf6sesrL6rA4g7n0G Y0omRPyJFhlzXNtMXI8rpYXZoDdAa4MIHmRhkBjMDiHOQwVxRg12avOHVzDh1QFf7VJy 224VTaVExTgyhAnHCV5zoMqS4cuinmGS+11KPB684adpfDFRz6NkPmcgL/x6692CV0JO 5BU7JT0vTJHQZqkZ9ofzRY/qqdNo9an/8oi2ZyJggR7qoRD8olWHGZWmhGdg7MIUBdq2 h7dgvvklqJFYluthDbTG53Pjfm5qUyjQI9dHTagk/VatRs7Nud1Y3wWAJKMaLpZmx2va 02MQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Qq+6dIuv; 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 k15-20020aa788cf000000b0052c56cea553si33385pff.352.2022.11.04.13.03.13; Fri, 04 Nov 2022 13:03:26 -0700 (PDT) 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=Qq+6dIuv; 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 S229694AbiKDUBR (ORCPT + 99 others); Fri, 4 Nov 2022 16:01:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbiKDUAz (ORCPT ); Fri, 4 Nov 2022 16:00:55 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2088.outbound.protection.outlook.com [40.107.92.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C72D4AF28; Fri, 4 Nov 2022 13:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CFNmaKNojYHCrrMbMVr8Y6C4gGPgxIfYlTQSFHzuOb2TN9dpSRGWwMBz8NlQl1GFSH5X13M9jJggXxF48am98qcDAQn8vE6cIMoDS+cYcgp54kIKs6fzC8LSgEUo7LwwyRYaBmItIfyInlJOUdylLyl+tPZXhgIonQUJLpNDoMBQ+NwishB33l3V/BPJ/L9bvLl64ZPbc7901dmYD0Xmz3nLHbdwnkO/KP2gx8OCTaYYdvS4iSjHlfkVxdzDeelSPnMII4iYUcSAHzz5m9veG4c5803X8XbMIhAEaWXqx54o+FY9z49TinA+ONpixG/wO//0vsDpf/99wXojUq79Gg== 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=sKb9tDfP1LbvSJvk9qh0dWDguSRtNWle59XvPJKlnR8=; b=GKYqXVp1iShoWGG2gFJ7zcC7UNno7IYqokmJFsKLxBTRGcU2z8yGAA0YR0ApY1d8NTKAPiQECTgsLXWxqO1q8CC5KSD/CRB6fwgvcw8rfY89mRHsQ6Ce8NSZpu6wm4AoIdOTSOPfe45SkT57wNPXV2LwO4yQ3YCGxgYagJOF3URAsAaFG8btlE672HaKCpcchc9drI2SQmuYclu/NHwILai6g+maNx6lFOCIgvKygkdHKPeXBkeaoIGiY/2pARut817Ow1OYCoU0tclsDC/RKc4OLID7MlvHAF1JadM9VJieAuwiXJMuRoi4ARZlUIRWcKwz1kKsaxy2aoUW2sX6WQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.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 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=sKb9tDfP1LbvSJvk9qh0dWDguSRtNWle59XvPJKlnR8=; b=Qq+6dIuvMRWDF5pXrGCxAPpyIDITipJTUb3zZxhCJNu3R6MV416N0kxNa8qXY/8XkRtVGqEcxwwzM5CWAbphikoexhtET0A42b3J34y/Iav3h6kpMm+zpnDQkdDkhK621bFMzp+gVQET7Wa9sfYaPOs2IlxXcKCtQ+5nvkQ92eo= Received: from DS7PR03CA0043.namprd03.prod.outlook.com (2603:10b6:5:3b5::18) by SA1PR12MB7126.namprd12.prod.outlook.com (2603:10b6:806:2b0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.16; Fri, 4 Nov 2022 20:00:50 +0000 Received: from DM6NAM11FT066.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b5:cafe::ae) by DS7PR03CA0043.outlook.office365.com (2603:10b6:5:3b5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.18 via Frontend Transport; Fri, 4 Nov 2022 20:00:50 +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 DM6NAM11FT066.mail.protection.outlook.com (10.13.173.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:00:50 +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.31; Fri, 4 Nov 2022 15:00:48 -0500 Subject: [PATCH v8 07/13] x86/resctrl: Introduce data structure to support monitor configuration From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:00:43 -0500 Message-ID: <166759204323.3281208.9744810874584175730.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 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: DM6NAM11FT066:EE_|SA1PR12MB7126:EE_ X-MS-Office365-Filtering-Correlation-Id: 6fc93470-ef2d-410e-8565-08dabe9f45d5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wpDlkeVRmiKXFkSd9vU/Xo8qxiBVjXfl/a6bUI7P3gilK+/5oSuVi3XEUBbXXLjL8rzewLWgKiSz5rwTDd2UMvbKxAeMtItj2ZN0KQuOE96hsHjRLiE6Qfl6yrrKyNGgp5M8Mj2RMT6To7OkaBLROKXzit4I9ggznfamktyItiO8034FnWM+xkB7QQ1c92k9uKuDsuIZO6x/wPOafEeKrWmQoWAFTUzWmbXw8Cu+TXDlHH0XVloxCuQQr8XH09GYxkRVBFIJCMA6KMmBHfN/fVWTx1zyhnS2+sC5fwiI7xdw1WwiorykTsOtB1ODKr3eB+//HTw+GfQOUDTAp2zezlW7sP2TrcS6X/WcqZL8mS6QndmsJUCmVnjyUbq10vtNkYzqxupqm623KSemNl5ccPWZSAp+ufXym2OktcCFx4V3cu+Xa8hIFIXYzBSCEGbYfjIwUtyF9NvJNXK2AFiCpvyPxPNfVzieCCO1Tz+r+K8IHnkCWWTjb0VHVAgU66UvPem58UoipfQZVBFnYf6Sjn4UWerq0rBQJnSw0M4Simq5YS1y+J1V6AJ559tXUv3LgknD/rEoPhsKgyh7NfJNKzWLql7T+oiNApyKJirh/wH3J8mQEIzB35IwxJG3JoRNjEV592vBr63JFw2qM64xjNeKLY9Ptev8Am0TbmMV4/W4aPE7Vs23UflOyYFQozXDkHZhyBW1cDGZos2bkxPHyai2JH/G1BUgw8dtalOF+9GLJ7M552BMDH5u40ra7+xTxxJqqBcHhEucqdgMUCH9NQymE8xwm8w2GhkH4rPTNQciJhDZyHbg7wERyRXTK9J4EwD33txr3/IY40L9QhtqTQ== 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)(39860400002)(396003)(136003)(346002)(451199015)(40470700004)(36840700001)(46966006)(82310400005)(186003)(5660300002)(33716001)(44832011)(16526019)(81166007)(40460700003)(336012)(426003)(2906002)(47076005)(356005)(86362001)(83380400001)(7416002)(36860700001)(82740400003)(316002)(103116003)(4326008)(41300700001)(54906003)(70586007)(478600001)(70206006)(9686003)(16576012)(8676002)(110136005)(26005)(8936002)(6666004)(40480700001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:00:50.6264 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6fc93470-ef2d-410e-8565-08dabe9f45d5 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: DM6NAM11FT066.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7126 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?1748597165275141591?= X-GMAIL-MSGID: =?utf-8?q?1748597165275141591?= Add a new field in mon_evt to support Bandwidth Monitoring Event Configuration(BMEC) and also update the "mon_features" display. The sysfs file "mon_features" will display the monitor configuration if supported. Before the change. $cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytes After the change when BMEC is supported. $cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_total_bytes_config mbm_local_bytes mbm_local_bytes_config Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/monitor.c | 6 ++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index e30e8b23f6b5..5459b5022760 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -63,11 +63,13 @@ DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key); * struct mon_evt - Entry in the event list of a resource * @evtid: event id * @name: name of the event + * @configurable: true if the event is configurable * @list: entry in &rdt_resource->evt_list */ struct mon_evt { enum resctrl_event_id evtid; char *name; + bool configurable; struct list_head list; }; diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index efe0c30d3a12..06c2dc980855 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -750,6 +750,7 @@ int rdt_get_mon_l3_config(struct rdt_resource *r) { unsigned int mbm_offset = boot_cpu_data.x86_cache_mbm_width_offset; struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); + bool mon_configurable = rdt_cpu_has(X86_FEATURE_BMEC); unsigned int threshold; int ret; @@ -783,6 +784,11 @@ int rdt_get_mon_l3_config(struct rdt_resource *r) if (ret) return ret; + if (mon_configurable) { + mbm_total_event.configurable = true; + mbm_local_event.configurable = true; + } + l3_mon_evt_init(r); r->mon_capable = true; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 8a3dafc0dbf7..8342feb54a7f 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1001,8 +1001,11 @@ static int rdt_mon_features_show(struct kernfs_open_file *of, struct rdt_resource *r = of->kn->parent->priv; struct mon_evt *mevt; - list_for_each_entry(mevt, &r->evt_list, list) + list_for_each_entry(mevt, &r->evt_list, list) { seq_printf(seq, "%s\n", mevt->name); + if (mevt->configurable) + seq_printf(seq, "%s_config\n", mevt->name); + } return 0; }