From nobody Sat Oct 4 16:15:38 2025 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2082.outbound.protection.outlook.com [40.107.100.82]) (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 00E48299928; Fri, 15 Aug 2025 02:26:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755224783; cv=fail; b=qRpn72m0nBQeLTE//W+eK6ODsGZmqUfWJlHZYfB5e0jgNgPdRniiGlfjUJgkm6xzMCRMGTIwoYlu+GV0D8zozTGCGPuC6p/Nb54Q4sI95Xi1iolemS6HbSyxKrNQNjCGDvZFnl8SN1QPMscK2Xs1MqUCBeX/dp41nePrlK7nZBE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755224783; c=relaxed/simple; bh=G89l5UhNDXlGszY2msokXrkxS59eQy2tJDFfb054QKM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j2g8Pu93MYJAeXOx2I9heBkTFbal4KuznyJg7QSgOaNbvbKmvfQm3wXt1CeuvGFUrOK2mmiG0zov+HFvGF2Isw3WGpcErPgEXu6xW9IrY8bK1GNJxPolKwlTOM28V8aPiYXAV41wxRbAu6mlRLe4H3ZK7Artd7zszkLBgbDNjIY= 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=oYOIDZJu; arc=fail smtp.client-ip=40.107.100.82 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="oYOIDZJu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XRrtfZHRDOeLWbw4lXYX/mJ4JyM5RHD9K1HVPGFZQaoTzcYn0+dRghvMCUqeJ6+zPar5J7jHb489/vfYzJhJ4K7n1Ygo8L0yMjhc2LM83zH1DJGZ+n4LORNvWv4zUpY07QvAgYE3X/i74XbBIazP+4jXLjHmE0QMTkMP9NtM3MJUk+ajMRWkkrBQMcOC5gpCVmQrd/TrKH3KW5CByxwMWnlJ7JuH5cuHPrBuNvLWQ2lmFSUX6bBWLe6UwxvDgr0qLCQ0O8vcs+31RIbkQt/N7sGIV0nnIqj6+aTZSPDu5umFPXj1qCu0x/+/+p5TMif8y+1e/mhYcigfshBAiCaVTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=e6+Af598yG0VZZvJwzmyiCY77XBJ0aUE4otOz6LvZww=; b=rKon1FUbnaLKKUsPH7vc1gY1J/iw7eiyVcoOEaYwSXqzZmRAiBLl0+1bWLQsBQiIl7atjiWcMTvYdD5A0tWmjy8oNYxyLcBMk3zbvPFv2TCwV1mafvq0Hd6+EVHyh8iedqkp6H1+nig2fmRTzZMoxlZlQAqF3YujDJqUk09HPfi9wNLj0b2+kMfn6FH5tV8nU6DxzxkvjOJczbF+0yuR0kM8nDCufLFVyQQdTnCvsjmL3VMVCK93zde33SUVcY6aO9WaSeQIKzgOEEzfmvv/v1w7tpzmpe11S/sc9jml8qKIRABZL018DIz3ulmmBG06QyM7H3URPUGThvkAK5Ntaw== 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=e6+Af598yG0VZZvJwzmyiCY77XBJ0aUE4otOz6LvZww=; b=oYOIDZJu74Iyau3uHAC0uwwGCZOnHWbRicstVE3dh6Spg/8WiosLTs6yzDsVWjAnZgp1kgdbbp6fvSmcHAJILJGe8GUXtVq40uoEjUDeFrX8RyUV1ZSRKLdQlWHVcX1ukqYR7DstNOXul/Wk7Nm06+XUUy5F6zPIR6FIlpY63/c= Received: from BYAPR04CA0025.namprd04.prod.outlook.com (2603:10b6:a03:40::38) by MW4PR12MB7334.namprd12.prod.outlook.com (2603:10b6:303:219::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9009.15; Fri, 15 Aug 2025 02:26:14 +0000 Received: from SN1PEPF00036F3C.namprd05.prod.outlook.com (2603:10b6:a03:40:cafe::9b) by BYAPR04CA0025.outlook.office365.com (2603:10b6:a03:40::38) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9031.17 via Frontend Transport; Fri, 15 Aug 2025 02:26:14 +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 SN1PEPF00036F3C.mail.protection.outlook.com (10.167.248.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9031.11 via Frontend Transport; Fri, 15 Aug 2025 02:26:14 +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.39; Thu, 14 Aug 2025 21:26:07 -0500 From: Babu Moger To: , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v17 02/33] x86,fs/resctrl: Replace architecture event enabled checks Date: Thu, 14 Aug 2025 21:25:06 -0500 Message-ID: <6bd00ee6c912b03b1ae37cb5f28a806b8b6e6a1a.1755224735.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: quoted-printable 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: SN1PEPF00036F3C:EE_|MW4PR12MB7334:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ed57144-9e97-4ec1-2fa2-08dddba31b68 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|376014|36860700013|1800799024|13003099007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?lj8/XRkVv/BHe7vs2F+/UD1myGX6A2WFIfdeVaMXIhCWE3iJltcTXMnOculY?= =?us-ascii?Q?6Yf6iDtB+t1BJaxrt+1t8uQWYK/6H93b2AaLcJYVmlRHB3n6YuAyndVDdO4q?= =?us-ascii?Q?WeViqUPnDZKcIwYrq8g6sFlNfDCrRECsz9uQf48A97l2Qc8P3c/XKJ2IWc+2?= =?us-ascii?Q?HNSKxARz6NKFb97jdT+oAQhJ8yZICzBfJQesE9EWdkBUAoHcyeju+RJuyCJr?= =?us-ascii?Q?www8LqtntzCxXhNx3VbCsIiiwd91IfdSBm2dbtYDh7Zlgbh0MTeX50cNnm9W?= =?us-ascii?Q?CJSeOOm1v6FyVoAJZnOPjOJl7rciPraovOix7cLtdGOXfx1lj17PlAQ7umpU?= =?us-ascii?Q?OO73sXPMqIchvJ3fS5cNHnJOb6xVOwkOYWT4uulGYCmRkb4IENxHeQFtOOaj?= =?us-ascii?Q?7VtPyKEE0dTj8Rb+pXDV76RBD11uDbya97qQX8IubvZCc4y0GAHpr25CDWxe?= =?us-ascii?Q?wEnZ28WdHzlXaLRgyRrOdORG6oixVVwyOirByV1ZPTOVwbkppQhy7/daJH0+?= =?us-ascii?Q?Hp8VxXn/pMf8y/IG1iLrPtUvX+FJjSZ6Pcu+8TBb4wm+NEx8VeYsfWrtOKNn?= =?us-ascii?Q?fQA/xCxtTUsPBDRA9MCRTfhYY40man7cNwhnb7vmatjkIIM4Bx9e0FFnZf+y?= =?us-ascii?Q?Pdjtruusy8Zi4LW7kNFUkhAWcToVpuaswVB9U+Guf28+q1LJ0n4aW0dJ5t9w?= =?us-ascii?Q?RtFcrp3CqRRO34+M60w8i6cxx8oLf8bgoyfGSQaFCrkqdC7Kj9hBXn8Jl6Fj?= =?us-ascii?Q?4JdBRXLDyE+2Hghb+dB9mW94Cmh13vdS3PYrQ6DOgg5nPmk2KwgMoJgggzu6?= =?us-ascii?Q?0ZaZ0NtnmNAmaRP5rvOJ/30puhFucMnE7+vI/kc9h/TauJ2g5D8XiwrC6ojf?= =?us-ascii?Q?Q8MUU+RHGPxYDTful28wDy8MPemyd6kJFtPF+jf1cdVxNx1wQMnYfk2FRctK?= =?us-ascii?Q?k9Z8k5pV7m+JDjZI7uN5SaHOmkjhIGhea9zsCXmmWYP/+NMh8V1JGL8YNb9S?= =?us-ascii?Q?4L37M6sP3MmXGK9+uEYAB6yW6acb8O2tpfRQ4rbMZS01mmj+BzPn1LQocdMM?= =?us-ascii?Q?1CpHHghD6YdEnnc40lEbV9C3sJ8hgMC/JuHWNRp2PJCBXXzR1JRK2qoTxYkD?= =?us-ascii?Q?jhrkdg9FRqWyhdBBIN7rbmbEug0Utk3HpPHg4p6UEFmuK6gVjA/mrFIckaQh?= =?us-ascii?Q?NHAoq+5JFpbWniWSKXG9VHi0/JpWihaRiKdx50esn2jWcOnlzEQ6k9LUOWSO?= =?us-ascii?Q?QBCeZk7e9/vFjw5mHX6C70uwyQcivGBnl+CM3L3t4/pbzUhDFIhZVEpuMI+f?= =?us-ascii?Q?xtyxVoZuYnGnc8owbzToJOertTtRJYE7z2ItkqmhSt8KsbG6vRgFZb1YjFZN?= =?us-ascii?Q?ccxAgyHnwhu4Qz+pk1YnUz+IQqVNmAKFiHccRuz739tX39c4USQDlBi9B0NP?= =?us-ascii?Q?n8nXEhlE6x9KMidJlPg2/ifS8lj3gmt6fHVh+D5dfwMYMANnZzGPFsCNar/f?= =?us-ascii?Q?5xbhhyG6Xzus9vA6SKnSDRZMuSsbkgg96O8xCQqxgHFJhGf2bqdr3VLj3A?= =?us-ascii?Q?=3D=3D?= 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:(13230040)(82310400026)(7416014)(376014)(36860700013)(1800799024)(13003099007);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2025 02:26:14.1794 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ed57144-9e97-4ec1-2fa2-08dddba31b68 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: SN1PEPF00036F3C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7334 Content-Type: text/plain; charset="utf-8" From: Tony Luck The resctrl file system now has complete knowledge of the status of every event. So there is no need for per-event function calls to check. Replace each of the resctrl_arch_is_{event}enabled() calls with resctrl_is_mon_event_enabled(QOS_{EVENT}). No functional change. Signed-off-by: Tony Luck Signed-off-by: Babu Moger Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre --- v17: Addred Signed-off-by tag. Picked up first four patches from: https://lore.kernel.org/lkml/20250711235341.113933-1-tony.luck@intel.com/ These patches have already been reviewed. --- arch/x86/include/asm/resctrl.h | 15 --------------- arch/x86/kernel/cpu/resctrl/core.c | 4 ++-- arch/x86/kernel/cpu/resctrl/monitor.c | 4 ++-- fs/resctrl/ctrlmondata.c | 4 ++-- fs/resctrl/monitor.c | 16 +++++++++++----- fs/resctrl/rdtgroup.c | 18 +++++++++--------- include/linux/resctrl.h | 2 ++ 7 files changed, 28 insertions(+), 35 deletions(-) diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h index feb93b50e990..b1dd5d6b87db 100644 --- a/arch/x86/include/asm/resctrl.h +++ b/arch/x86/include/asm/resctrl.h @@ -84,21 +84,6 @@ static inline void resctrl_arch_disable_mon(void) static_branch_dec_cpuslocked(&rdt_enable_key); } =20 -static inline bool resctrl_arch_is_llc_occupancy_enabled(void) -{ - return (rdt_mon_features & (1 << QOS_L3_OCCUP_EVENT_ID)); -} - -static inline bool resctrl_arch_is_mbm_total_enabled(void) -{ - return (rdt_mon_features & (1 << QOS_L3_MBM_TOTAL_EVENT_ID)); -} - -static inline bool resctrl_arch_is_mbm_local_enabled(void) -{ - return (rdt_mon_features & (1 << QOS_L3_MBM_LOCAL_EVENT_ID)); -} - /* * __resctrl_sched_in() - Writes the task's CLOSid/RMID to IA32_PQR_MSR * diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 7fcae25874fe..1a319ce9328c 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -402,13 +402,13 @@ static int arch_domain_mbm_alloc(u32 num_rmid, struct= rdt_hw_mon_domain *hw_dom) { size_t tsize; =20 - if (resctrl_arch_is_mbm_total_enabled()) { + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID)) { tsize =3D sizeof(*hw_dom->arch_mbm_total); hw_dom->arch_mbm_total =3D kcalloc(num_rmid, tsize, GFP_KERNEL); if (!hw_dom->arch_mbm_total) return -ENOMEM; } - if (resctrl_arch_is_mbm_local_enabled()) { + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_LOCAL_EVENT_ID)) { tsize =3D sizeof(*hw_dom->arch_mbm_local); hw_dom->arch_mbm_local =3D kcalloc(num_rmid, tsize, GFP_KERNEL); if (!hw_dom->arch_mbm_local) { diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/re= sctrl/monitor.c index c261558276cd..61d38517e2bf 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -207,11 +207,11 @@ void resctrl_arch_reset_rmid_all(struct rdt_resource = *r, struct rdt_mon_domain * { struct rdt_hw_mon_domain *hw_dom =3D resctrl_to_arch_mon_dom(d); =20 - if (resctrl_arch_is_mbm_total_enabled()) + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID)) memset(hw_dom->arch_mbm_total, 0, sizeof(*hw_dom->arch_mbm_total) * r->num_rmid); =20 - if (resctrl_arch_is_mbm_local_enabled()) + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_LOCAL_EVENT_ID)) memset(hw_dom->arch_mbm_local, 0, sizeof(*hw_dom->arch_mbm_local) * r->num_rmid); } diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index d98e0d2de09f..ad7ffc6acf13 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -473,12 +473,12 @@ ssize_t rdtgroup_mba_mbps_event_write(struct kernfs_o= pen_file *of, rdt_last_cmd_clear(); =20 if (!strcmp(buf, "mbm_local_bytes")) { - if (resctrl_arch_is_mbm_local_enabled()) + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_LOCAL_EVENT_ID)) rdtgrp->mba_mbps_event =3D QOS_L3_MBM_LOCAL_EVENT_ID; else ret =3D -EINVAL; } else if (!strcmp(buf, "mbm_total_bytes")) { - if (resctrl_arch_is_mbm_total_enabled()) + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID)) rdtgrp->mba_mbps_event =3D QOS_L3_MBM_TOTAL_EVENT_ID; else ret =3D -EINVAL; diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 2313e48de55f..9e988b2c1a22 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -336,7 +336,7 @@ void free_rmid(u32 closid, u32 rmid) =20 entry =3D __rmid_entry(idx); =20 - if (resctrl_arch_is_llc_occupancy_enabled()) + if (resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID)) add_rmid_to_limbo(entry); else list_add_tail(&entry->list, &rmid_free_lru); @@ -637,10 +637,10 @@ static void mbm_update(struct rdt_resource *r, struct= rdt_mon_domain *d, * This is protected from concurrent reads from user as both * the user and overflow handler hold the global mutex. */ - if (resctrl_arch_is_mbm_total_enabled()) + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID)) mbm_update_one_event(r, d, closid, rmid, QOS_L3_MBM_TOTAL_EVENT_ID); =20 - if (resctrl_arch_is_mbm_local_enabled()) + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_LOCAL_EVENT_ID)) mbm_update_one_event(r, d, closid, rmid, QOS_L3_MBM_LOCAL_EVENT_ID); } =20 @@ -879,6 +879,12 @@ void resctrl_enable_mon_event(enum resctrl_event_id ev= entid) mon_event_all[eventid].enabled =3D true; } =20 +bool resctrl_is_mon_event_enabled(enum resctrl_event_id eventid) +{ + return eventid >=3D QOS_FIRST_EVENT && eventid < QOS_NUM_EVENTS && + mon_event_all[eventid].enabled; +} + /** * resctrl_mon_resource_init() - Initialise global monitoring structures. * @@ -914,9 +920,9 @@ int resctrl_mon_resource_init(void) RFTYPE_MON_INFO | RFTYPE_RES_CACHE); } =20 - if (resctrl_arch_is_mbm_local_enabled()) + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_LOCAL_EVENT_ID)) mba_mbps_default_event =3D QOS_L3_MBM_LOCAL_EVENT_ID; - else if (resctrl_arch_is_mbm_total_enabled()) + else if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID)) mba_mbps_default_event =3D QOS_L3_MBM_TOTAL_EVENT_ID; =20 return 0; diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index b95501d4b5de..a7eeb33501da 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -123,8 +123,8 @@ void rdt_staged_configs_clear(void) =20 static bool resctrl_is_mbm_enabled(void) { - return (resctrl_arch_is_mbm_total_enabled() || - resctrl_arch_is_mbm_local_enabled()); + return (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID) || + resctrl_is_mon_event_enabled(QOS_L3_MBM_LOCAL_EVENT_ID)); } =20 static bool resctrl_is_mbm_event(int e) @@ -196,7 +196,7 @@ static int closid_alloc(void) lockdep_assert_held(&rdtgroup_mutex); =20 if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID) && - resctrl_arch_is_llc_occupancy_enabled()) { + resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID)) { cleanest_closid =3D resctrl_find_cleanest_closid(); if (cleanest_closid < 0) return cleanest_closid; @@ -4051,7 +4051,7 @@ void resctrl_offline_mon_domain(struct rdt_resource *= r, struct rdt_mon_domain *d =20 if (resctrl_is_mbm_enabled()) cancel_delayed_work(&d->mbm_over); - if (resctrl_arch_is_llc_occupancy_enabled() && has_busy_rmid(d)) { + if (resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID) && has_busy_rmid(= d)) { /* * When a package is going down, forcefully * decrement rmid->ebusy. There is no way to know @@ -4087,12 +4087,12 @@ static int domain_setup_mon_state(struct rdt_resour= ce *r, struct rdt_mon_domain u32 idx_limit =3D resctrl_arch_system_num_rmid_idx(); size_t tsize; =20 - if (resctrl_arch_is_llc_occupancy_enabled()) { + if (resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID)) { d->rmid_busy_llc =3D bitmap_zalloc(idx_limit, GFP_KERNEL); if (!d->rmid_busy_llc) return -ENOMEM; } - if (resctrl_arch_is_mbm_total_enabled()) { + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID)) { tsize =3D sizeof(*d->mbm_total); d->mbm_total =3D kcalloc(idx_limit, tsize, GFP_KERNEL); if (!d->mbm_total) { @@ -4100,7 +4100,7 @@ static int domain_setup_mon_state(struct rdt_resource= *r, struct rdt_mon_domain return -ENOMEM; } } - if (resctrl_arch_is_mbm_local_enabled()) { + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_LOCAL_EVENT_ID)) { tsize =3D sizeof(*d->mbm_local); d->mbm_local =3D kcalloc(idx_limit, tsize, GFP_KERNEL); if (!d->mbm_local) { @@ -4145,7 +4145,7 @@ int resctrl_online_mon_domain(struct rdt_resource *r,= struct rdt_mon_domain *d) RESCTRL_PICK_ANY_CPU); } =20 - if (resctrl_arch_is_llc_occupancy_enabled()) + if (resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID)) INIT_DELAYED_WORK(&d->cqm_limbo, cqm_handle_limbo); =20 /* @@ -4220,7 +4220,7 @@ void resctrl_offline_cpu(unsigned int cpu) cancel_delayed_work(&d->mbm_over); mbm_setup_overflow_handler(d, 0, cpu); } - if (resctrl_arch_is_llc_occupancy_enabled() && + if (resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID) && cpu =3D=3D d->cqm_work_cpu && has_busy_rmid(d)) { cancel_delayed_work(&d->cqm_limbo); cqm_setup_limbo_handler(d, 0, cpu); diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 2944042bd84c..40aba6b5d4f0 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -372,6 +372,8 @@ int resctrl_arch_update_domains(struct rdt_resource *r,= u32 closid); =20 void resctrl_enable_mon_event(enum resctrl_event_id eventid); =20 +bool resctrl_is_mon_event_enabled(enum resctrl_event_id eventid); + bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt); =20 /** --=20 2.34.1