Message ID | 166604560666.5345.17936133716540279017.stgit@bmoger-ubuntu |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1669626wrs; Mon, 17 Oct 2022 15:29:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4cajJFUg4vSJsfK4aQ2f9fr5GE8ZFfrIeoPxpZ4nzH7wmtjGtzOQzwox+1QuNhlmWT47fI X-Received: by 2002:a63:2ac9:0:b0:457:24a2:6fa7 with SMTP id q192-20020a632ac9000000b0045724a26fa7mr5279pgq.484.1666045779927; Mon, 17 Oct 2022 15:29:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666045779; cv=pass; d=google.com; s=arc-20160816; b=bYuA3xXbAr5cRWrJLn6ir7789Ax70CTg2iB8Rbwjm+u/q9tTXrdNtR56ukQCg6AYHF rjbEYmnlPdWM+Hk8dJpjy05Yhx9ToNuggSnUEAGiJ8EbNMMxeApnhVeRfdOfOMy40H9E LRlAaDm/OMdGTQM8XdxdFNjt59sKB7wwjiSgjN4Sw/oUsRzg1fO7ceGfMl15pZ4jmvgA j3ctniYCEz+1q0XFDfbQOAczjKTyKkpeW5c5+IWkkXey7z4AfwxRXxEQ7LXiQr0xwwTE Bkc16UAbzcCuyu5xd0zwqQr4+DfFG/yTeCTtMzhPHkhIyOW2eYpOAndDdafh2igjLynk 2TsQ== 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=PHmsdfuyUZgBV9NaapYbUaxFPpD5iENV7ySgSROjkVU=; b=llyW2C+0UlJE0pPNCzJpcTM1euymQZiG8/KhC4U+nDIpeDR5MfzTZ27LffMun4b2e7 TrHVvBrx+djfqcKTG8lztLlJRwW3Fax8SPQK9ISkB4toc87MNUHB0QrbAkj92foAU9aG soHG341vFShHaocVzB2JyOt9/VRUktKDwt8QsdGhDx5ILsdEVb41Hjs8k0K5nXFrcAKf BSpWsFrWqbH5n5klV9fpCwp0thc7YYB2SZYr1TMop83mJHI2HF4ajvyHEyjgOpuafetJ gJNXESSZCrCwSDZtjLyahxNjT38NaogK1JcV/6VGfIbVlvppFnV2uRXXMYyOEqKT9GaL 0r3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0qu7VaiK; 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 t10-20020a17090a5d8a00b0020243dc975bsi17526890pji.116.2022.10.17.15.29.26; Mon, 17 Oct 2022 15:29:39 -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=0qu7VaiK; 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 S230239AbiJQW1Z (ORCPT <rfc822;kernel.ruili@gmail.com> + 99 others); Mon, 17 Oct 2022 18:27:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229922AbiJQW1T (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 17 Oct 2022 18:27:19 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2041.outbound.protection.outlook.com [40.107.212.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2222814FB; Mon, 17 Oct 2022 15:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=npkGBj9Mxxh2aQSLf0OxSea44tmNtbi5RSJQDM5h63oT3TRKgF4ePdlrfO+Y7cPUSn6jTyZYEo/0wOdckBoSicxHH6BCTWphE6agEJKi/V7eAwme6ghLlaBXkwFNAglzhaiHqS/lC/eSRb0zkmrODG4tnmqZtQQHTXKPx/obGOcmIy1e/wXdKjGXRBliJsLaeu0kj2P3jIcfqB50D1vjcS2B/Wx0xUeR6B7anJeaDqlfRaj7OtHkmGWvmp+mGbFCUxZ7lt28FuaK1F6orPxV1O2OgRo3UI3rNfW1oizrxh+vNYAWHKAYhoKeTRh3wW4TojjoF4serirZ01C775rkfA== 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=PHmsdfuyUZgBV9NaapYbUaxFPpD5iENV7ySgSROjkVU=; b=BlNf0pXcPIWdnEOLhb6/Qz+2dqk/K5bBK/AGiduR3wLMNE+zN/DkioZIaorvWNzn96snl5QSskc2L1qTN53CG77mNk7vJn00SGrhN9NtbyT6yPldoBrpJWKBMkrq9DeiSAnP2p8cgiAGTwSv1eu2ngYbkL3CQR8a2ht0j2D/1C8ShIs4QsA75oZWHevSPEl+3B/vNsusx1Vd4pRC7DK5UuEU0yWo2CwaVaU82qxx7gTnb0GsWCQvpZR5TpPEeFjWORW2p88RbjqCvlf+P1QbEvVk4b7pEuX9umFDlJvNfIEPL9IeuuDZqDcFr9zAUNDpPsGCHaW0Ud5m3w1nX8ckbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.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=PHmsdfuyUZgBV9NaapYbUaxFPpD5iENV7ySgSROjkVU=; b=0qu7VaiK8XKGPHM//aGzCL6MmaUJbxZSwJsCNDW4BL++0m5KRMqAAurvDplHbpUhDEXe/RzD+zGPz5NoInqLoq18t35oD6WYPh0qHQjh1Pz2XmPcPj9Ep6LMW3BYfbh3pCPSZOOmPtBOurYeoiDWiBzRhdqh17R11y+cwDEFAm4= Received: from BN0PR03CA0008.namprd03.prod.outlook.com (2603:10b6:408:e6::13) by PH7PR12MB5952.namprd12.prod.outlook.com (2603:10b6:510:1db::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Mon, 17 Oct 2022 22:26:49 +0000 Received: from BN8NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e6:cafe::fe) by BN0PR03CA0008.outlook.office365.com (2603:10b6:408:e6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Mon, 17 Oct 2022 22:26:49 +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 BN8NAM11FT013.mail.protection.outlook.com (10.13.176.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5723.20 via Frontend Transport; Mon, 17 Oct 2022 22:26:49 +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; Mon, 17 Oct 2022 17:26:47 -0500 Subject: [PATCH v7 06/12] x86/resctrl: Introduce data structure to support monitor configuration From: Babu Moger <babu.moger@amd.com> To: <corbet@lwn.net>, <reinette.chatre@intel.com>, <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de> CC: <fenghua.yu@intel.com>, <dave.hansen@linux.intel.com>, <x86@kernel.org>, <hpa@zytor.com>, <paulmck@kernel.org>, <akpm@linux-foundation.org>, <quic_neeraju@quicinc.com>, <rdunlap@infradead.org>, <damien.lemoal@opensource.wdc.com>, <songmuchun@bytedance.com>, <peterz@infradead.org>, <jpoimboe@kernel.org>, <pbonzini@redhat.com>, <babu.moger@amd.com>, <chang.seok.bae@intel.com>, <pawan.kumar.gupta@linux.intel.com>, <jmattson@google.com>, <daniel.sneddon@linux.intel.com>, <sandipan.das@amd.com>, <tony.luck@intel.com>, <james.morse@arm.com>, <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <bagasdotme@gmail.com>, <eranian@google.com> Date: Mon, 17 Oct 2022 17:26:46 -0500 Message-ID: <166604560666.5345.17936133716540279017.stgit@bmoger-ubuntu> In-Reply-To: <166604543832.5345.9696970469830919982.stgit@bmoger-ubuntu> References: <166604543832.5345.9696970469830919982.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: BN8NAM11FT013:EE_|PH7PR12MB5952:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cb674fc-a675-42a1-7d8a-08dab08eaed1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ROEm9rrqo0ftJy+Mb8b3wmDI8XWrOvRYt6k6l1gKcINDFE7Or7JhBd11PJyubPPpQ26qWYKyM9rTCF+m2klnl8GkupbAzS+FcedrIRqS0yY73EdXN4jse0hE0tpb1a+c/BBw0v0gLuckPZ48/9i8pk6rZ2JOQ1PAqe8MuugM6gJqPvxHBqeZTYmMnVSqgvv6lS/vEtJzZYI0v5gwiLi8gZSBCR13MbFDshQqZN3P0yQf03cV9g4lDipuIZ9dsYMB1V2rgQD7kPeZj468ppeMlyMRn+iqKaQgkKSJVOdX0lXgzFUBwGoDX7hnbFLjoVLFmzxHL5emCB7gqtISei3r202x/M0rzS/wNp1325YMn+3Pl70GznEIB6ZY09CJ2vXENy5dEbcRjTquVV78CadkeDtNiJcEp5TlpppvQDsn4NB54/n/y2GMJCH+jz+XK96gyc7BEK10bUaHFUOUGpMd+eUtwbgqwbq7caOdO7qr3hm8PmJxNgwMGs/RiYVlYiGSkaRQN9/v/KQCqCbsM0IljcQBp7ZzlZZZGDm+nf2O4GG5lrnYTRwsX3L4BnZS9kNbHJ9pyApYYMS9bcPidBruQHu3p//ckPxG7tswVrpPHpTAJDpzgRwrlUkaFeTBXyUYhLhAmdWqAjRJC0/TUv2/N12fvxkI3mDDDwcHAX5vGC2Fw2fe4X3tDj1xNjxAkPc5Ul/UQkK668Df/09OT6UNB7IQhOTCFT71y64pWxFv0XnFsAkKxA0VvjfB9REzn3NJJDZqsSiURtFvvroWEGmKW7pj0f74T8VAehIT6wPki0eMTMhUk45ZSpK8mziD8bq3glgy6C92y1sT4tM6k273KA== 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)(346002)(39860400002)(451199015)(46966006)(40470700004)(36840700001)(26005)(9686003)(41300700001)(40460700003)(186003)(478600001)(33716001)(336012)(16526019)(44832011)(4326008)(2906002)(103116003)(7416002)(5660300002)(8936002)(82310400005)(86362001)(36860700001)(110136005)(16576012)(54906003)(82740400003)(316002)(47076005)(426003)(8676002)(81166007)(70206006)(83380400001)(356005)(40480700001)(70586007)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 22:26:49.0687 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2cb674fc-a675-42a1-7d8a-08dab08eaed1 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: BN8NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5952 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746975619368268299?= X-GMAIL-MSGID: =?utf-8?q?1746975619368268299?= |
Series |
x86/resctrl: Support for AMD QoS new features
|
|
Commit Message
Moger, Babu
Oct. 17, 2022, 10:26 p.m. UTC
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 if BMEC is supported.
$cat /sys/fs/resctrl/info/L3_MON/mon_features
llc_occupancy
mbm_total_bytes
mbm_total_config
mbm_local_bytes
mbm_local_config
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
arch/x86/kernel/cpu/resctrl/core.c | 3 ++-
arch/x86/kernel/cpu/resctrl/internal.h | 4 +++-
arch/x86/kernel/cpu/resctrl/monitor.c | 7 ++++++-
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 5 ++++-
4 files changed, 15 insertions(+), 4 deletions(-)
Comments
Hi Babu, On 10/17/2022 3:26 PM, Babu Moger wrote: > 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 if BMEC is supported. > $cat /sys/fs/resctrl/info/L3_MON/mon_features > llc_occupancy > mbm_total_bytes > mbm_total_config > mbm_local_bytes > mbm_local_config This does not seem to be what the code in this patch does. > > Signed-off-by: Babu Moger <babu.moger@amd.com> > --- > arch/x86/kernel/cpu/resctrl/core.c | 3 ++- > arch/x86/kernel/cpu/resctrl/internal.h | 4 +++- > arch/x86/kernel/cpu/resctrl/monitor.c | 7 ++++++- > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 5 ++++- > 4 files changed, 15 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c > index d79f494a4e91..46813b1c50c2 100644 > --- a/arch/x86/kernel/cpu/resctrl/core.c > +++ b/arch/x86/kernel/cpu/resctrl/core.c > @@ -814,6 +814,7 @@ static __init bool get_rdt_alloc_resources(void) > static __init bool get_rdt_mon_resources(void) > { > struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl; > + bool mon_configurable = rdt_cpu_has(X86_FEATURE_BMEC); > > if (rdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC)) > rdt_mon_features |= (1 << QOS_L3_OCCUP_EVENT_ID); > @@ -825,7 +826,7 @@ static __init bool get_rdt_mon_resources(void) > if (!rdt_mon_features) > return false; > > - return !rdt_get_mon_l3_config(r); > + return !rdt_get_mon_l3_config(r, mon_configurable); > } This seems to do a portion of configuration in the calling function, pass the results of to the actual configuration function where the rest of the configuration is done. Determining "mon_configurable" really looks like it belongs in rdt_get_mon_l3_config(). Is it availability of rdt_cpu_has() that prevented that change? Why not make it available internally to all resctrl code? Patch 7's mbm_config_rftype_init() can also be moved to rdt_get_mon_l3_config() to match how other related configs (thread_throttle_mode_init()) are done. > > static __init void __check_quirks_intel(void) > diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h > index 16e3c6e03c79..b458f768f30c 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; > }; > > @@ -522,7 +524,7 @@ int closids_supported(void); > void closid_free(int closid); > int alloc_rmid(void); > void free_rmid(u32 rmid); > -int rdt_get_mon_l3_config(struct rdt_resource *r); > +int rdt_get_mon_l3_config(struct rdt_resource *r, bool configurable); > void mon_event_count(void *info); > int rdtgroup_mondata_show(struct seq_file *m, void *arg); > void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, > diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c > index efe0c30d3a12..4b8adb7f1c5c 100644 > --- a/arch/x86/kernel/cpu/resctrl/monitor.c > +++ b/arch/x86/kernel/cpu/resctrl/monitor.c > @@ -746,7 +746,7 @@ static void l3_mon_evt_init(struct rdt_resource *r) > list_add_tail(&mbm_local_event.list, &r->evt_list); > } > > -int rdt_get_mon_l3_config(struct rdt_resource *r) > +int rdt_get_mon_l3_config(struct rdt_resource *r, bool configurable) > { > unsigned int mbm_offset = boot_cpu_data.x86_cache_mbm_width_offset; > struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); > @@ -783,6 +783,11 @@ int rdt_get_mon_l3_config(struct rdt_resource *r) > if (ret) > return ret; > > + if (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 1271fd1ae2f3..5f0ef1bf4c78 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; > } > If mevt->name is "mbm_total_bytes", then would this not print "mbm_total_bytes_config"? This is different from "mbm_total_config" in the changelog and does not match the actual files created in later patches.. Reinette
Hi Reinette, On 10/25/22 18:45, Reinette Chatre wrote: > Hi Babu, > > On 10/17/2022 3:26 PM, Babu Moger wrote: >> 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 if BMEC is supported. >> $cat /sys/fs/resctrl/info/L3_MON/mon_features >> llc_occupancy >> mbm_total_bytes >> mbm_total_config >> mbm_local_bytes >> mbm_local_config > This does not seem to be what the code in this patch does. You are right. it is # 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 <babu.moger@amd.com> >> --- >> arch/x86/kernel/cpu/resctrl/core.c | 3 ++- >> arch/x86/kernel/cpu/resctrl/internal.h | 4 +++- >> arch/x86/kernel/cpu/resctrl/monitor.c | 7 ++++++- >> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 5 ++++- >> 4 files changed, 15 insertions(+), 4 deletions(-) >> >> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c >> index d79f494a4e91..46813b1c50c2 100644 >> --- a/arch/x86/kernel/cpu/resctrl/core.c >> +++ b/arch/x86/kernel/cpu/resctrl/core.c >> @@ -814,6 +814,7 @@ static __init bool get_rdt_alloc_resources(void) >> static __init bool get_rdt_mon_resources(void) >> { >> struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl; >> + bool mon_configurable = rdt_cpu_has(X86_FEATURE_BMEC); >> >> if (rdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC)) >> rdt_mon_features |= (1 << QOS_L3_OCCUP_EVENT_ID); >> @@ -825,7 +826,7 @@ static __init bool get_rdt_mon_resources(void) >> if (!rdt_mon_features) >> return false; >> >> - return !rdt_get_mon_l3_config(r); >> + return !rdt_get_mon_l3_config(r, mon_configurable); >> } > This seems to do a portion of configuration in the calling function, pass the > results of to the actual configuration function where the rest of the configuration is > done. Determining "mon_configurable" really looks like it belongs in > rdt_get_mon_l3_config(). Is it availability of rdt_cpu_has() that prevented > that change? Why not make it available internally to all resctrl code? Yes. It is because of rdt_cpu_has availability. Also, it is __init routine. Yes. I can make it available. > > Patch 7's mbm_config_rftype_init() can also be moved to rdt_get_mon_l3_config() > to match how other related configs (thread_throttle_mode_init()) are done. Sure. Will do. > >> >> static __init void __check_quirks_intel(void) >> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h >> index 16e3c6e03c79..b458f768f30c 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; >> }; >> >> @@ -522,7 +524,7 @@ int closids_supported(void); >> void closid_free(int closid); >> int alloc_rmid(void); >> void free_rmid(u32 rmid); >> -int rdt_get_mon_l3_config(struct rdt_resource *r); >> +int rdt_get_mon_l3_config(struct rdt_resource *r, bool configurable); >> void mon_event_count(void *info); >> int rdtgroup_mondata_show(struct seq_file *m, void *arg); >> void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, >> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c >> index efe0c30d3a12..4b8adb7f1c5c 100644 >> --- a/arch/x86/kernel/cpu/resctrl/monitor.c >> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c >> @@ -746,7 +746,7 @@ static void l3_mon_evt_init(struct rdt_resource *r) >> list_add_tail(&mbm_local_event.list, &r->evt_list); >> } >> >> -int rdt_get_mon_l3_config(struct rdt_resource *r) >> +int rdt_get_mon_l3_config(struct rdt_resource *r, bool configurable) >> { >> unsigned int mbm_offset = boot_cpu_data.x86_cache_mbm_width_offset; >> struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); >> @@ -783,6 +783,11 @@ int rdt_get_mon_l3_config(struct rdt_resource *r) >> if (ret) >> return ret; >> >> + if (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 1271fd1ae2f3..5f0ef1bf4c78 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; >> } >> > If mevt->name is "mbm_total_bytes", then would this not > print "mbm_total_bytes_config"? This is different from "mbm_total_config" > in the changelog and does not match the actual files created in later > patches.. Sure. Will update the changelog, Thanks Babu
diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index d79f494a4e91..46813b1c50c2 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -814,6 +814,7 @@ static __init bool get_rdt_alloc_resources(void) static __init bool get_rdt_mon_resources(void) { struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl; + bool mon_configurable = rdt_cpu_has(X86_FEATURE_BMEC); if (rdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC)) rdt_mon_features |= (1 << QOS_L3_OCCUP_EVENT_ID); @@ -825,7 +826,7 @@ static __init bool get_rdt_mon_resources(void) if (!rdt_mon_features) return false; - return !rdt_get_mon_l3_config(r); + return !rdt_get_mon_l3_config(r, mon_configurable); } static __init void __check_quirks_intel(void) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 16e3c6e03c79..b458f768f30c 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; }; @@ -522,7 +524,7 @@ int closids_supported(void); void closid_free(int closid); int alloc_rmid(void); void free_rmid(u32 rmid); -int rdt_get_mon_l3_config(struct rdt_resource *r); +int rdt_get_mon_l3_config(struct rdt_resource *r, bool configurable); void mon_event_count(void *info); int rdtgroup_mondata_show(struct seq_file *m, void *arg); void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index efe0c30d3a12..4b8adb7f1c5c 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -746,7 +746,7 @@ static void l3_mon_evt_init(struct rdt_resource *r) list_add_tail(&mbm_local_event.list, &r->evt_list); } -int rdt_get_mon_l3_config(struct rdt_resource *r) +int rdt_get_mon_l3_config(struct rdt_resource *r, bool configurable) { unsigned int mbm_offset = boot_cpu_data.x86_cache_mbm_width_offset; struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); @@ -783,6 +783,11 @@ int rdt_get_mon_l3_config(struct rdt_resource *r) if (ret) return ret; + if (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 1271fd1ae2f3..5f0ef1bf4c78 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; }