From nobody Mon Oct 6 03:15:52 2025 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2072.outbound.protection.outlook.com [40.107.93.72]) (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 26DFD246784; Fri, 25 Jul 2025 18:30:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753468241; cv=fail; b=FwXW9sRxe4Ii4SA3ogIulrlRIYqS4IVC9X2dkzL8r4Mql2Vf8ESviUMGexJpc/U0KbM9wPCgKgiw/W/th7GtGYX1lMlYafoUqH+dvaeLaJReaJwDkEdoXPp3tTUzvAS66iLWXF49cDH5wURCROg7yDWDI4XmZ0RR91VAr3ZNIng= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753468241; c=relaxed/simple; bh=B017s1kmCpH2nuMtV8oOJ2ytpHkPlb15V45wW9qXXXU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tkqYPXiOlK/f6jKp1Q0/CZPX8qVx3QmMdsv7eZoSTZ8TjVSTGVh4pYoCOAJRFdSBqGUHWAsOVLLNwpsiCCCAOG5AMP1/xFGPrKe+z8VjFM4N3NQbDELMpLZ+c2eKTTFtE+A306XjPn8BBE9Sbom1cEoUVc3QLUX0R+mdVZnCL1k= 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=i5/Zjd+T; arc=fail smtp.client-ip=40.107.93.72 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="i5/Zjd+T" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sjVBwteAWCqI3pJ2OADGLGkiYH0AED0IMYlLCmmgzHiSmQk60JgjFvg0ASOHC3IR+dp/qxRcdVcduzzTmYIL9xxFuRUiapQlB47d05hbhgRCSreDvpSI0LD4jNzOZSxAkMZZbMpEoSXFLLNsySd9qtCCUSsWIoP9eNbnDZ/jnYWTZK0UkF6DrHN2FDs9QvQn4GCkjOz1sx4Bzr8QrLS4sHV+NT2Ds3R9DCY7I5U+wXh5KEkKNi7TGGidxlBhIdOonJ7psYEP0aUaTwABLySUVUiTqUNhsLscseBqCuI27kwMXTvMovFQPzxa1TTPG8PXAbCjq5pZB2UviioU0le0aQ== 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=8F293fVe2luY6MdLWMC1gszE7dc6yb3clPIn6Yded1I=; b=VW+IpWp/hUlHbazUwOnfzfeONlXSax1mNkcgISeMNMWOcbRoLUUNl9M2l9aMBb7Fm8FUq/HO1oy4RZVf6d16hjcLZBsagcodwdiBwF4N32oXyPEvCjUkd2P3Kjko6gYm+7wHabVu6D7pfSnSLDTZu6dsSGcl+i/hAswKC4PG054Iv51UC26gt0AT7/W+SCZ8jvKuD+ScfycYlTpqmI54qQmZzpj63U+bIiHNJpHUWNQPLZGzs4Di46c5GyVVe5vnKe7vNty88GfVwRDFVn14u1bH8O16PvoaCwH5ExZkUj1AL8tQrYLwWl/f4c7unR1L76n5fDAQASoReoYLaFHgOA== 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=8F293fVe2luY6MdLWMC1gszE7dc6yb3clPIn6Yded1I=; b=i5/Zjd+T3VaP5uE/wCQ1l9yQXOXEPUKDqXJTnJjkDgF21SBFP8jaZ2ewabKQ8EPxFiGDMaErD3QIxE1qfu2jYuB5M/vPEQM9kDrvI8RTsD6wdCRKaoWykmqExwcEYm3QhRBhovnb4z2Wp0sMEukSk2dkxZ9/0DrF54PPRFZuH9Y= Received: from PH7P220CA0113.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32d::31) by SA3PR12MB7904.namprd12.prod.outlook.com (2603:10b6:806:320::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8964.22; Fri, 25 Jul 2025 18:30:37 +0000 Received: from SA2PEPF000015C6.namprd03.prod.outlook.com (2603:10b6:510:32d:cafe::34) by PH7P220CA0113.outlook.office365.com (2603:10b6:510:32d::31) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8943.31 via Frontend Transport; Fri, 25 Jul 2025 18:30:37 +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 SA2PEPF000015C6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8964.20 via Frontend Transport; Fri, 25 Jul 2025 18:30:37 +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; Fri, 25 Jul 2025 13:30:34 -0500 From: Babu Moger To: , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v16 02/34] x86,fs/resctrl: Replace architecture event enabled checks Date: Fri, 25 Jul 2025 13:29:21 -0500 Message-ID: <63d54a44ab32a95d9a21b7bae9396f077653111e.1753467772.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: SA2PEPF000015C6:EE_|SA3PR12MB7904:EE_ X-MS-Office365-Filtering-Correlation-Id: 28b8a234-9f65-45b8-6b67-08ddcba959ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?tnxXyYlfxqeYhhMan63AlGOTneeCT0zPgyLPhk8XjCZY7pHpNet/C+FgKwzO?= =?us-ascii?Q?W9O5anL46/7affBP49sKseio/62G2SVjyJ81v4hfa7qfBMylaC+4lho5nSYh?= =?us-ascii?Q?Ji23/zFBE86sYOBQuAHJ7ll89LVS4x8785CI6vyjyOYeLgocOvLTwNSfWbyV?= =?us-ascii?Q?Iv9nYDUEOr57iIkMmx/klq878D/tWS5CMh2KqGCHjW3dKZuMWKcy/K+zXYqu?= =?us-ascii?Q?snY/Qem4NiNfB2nLJ4t0sfgC/K0th0CbfDSe9uDGMQUJgYNMYMi3Fvc5Z01T?= =?us-ascii?Q?32aEI4g5yCHhSKUZKFmgnr9rujOuZkznUP7FlxGZYTVwAN2UA5rixWMw3tIx?= =?us-ascii?Q?ycQG3I0X/MsPcY4IraqXasKEXj/nE3/2bRhQNol2b9sPKcSwwRcIQW/a/odn?= =?us-ascii?Q?WZkpW43oet0ykYRxNBY7Cle89qywRE0o+xGDmmihH88fow1ZrGmv8KbiKwBx?= =?us-ascii?Q?oIUACI7KqclrbPs/cdmysXRj6qDZaJBdcc5pSQ1WnIsK0VDuLRfPu50OfHgd?= =?us-ascii?Q?emzzkZy7tIpqVoYl4Zd/a7Er+cv1M4eJ3+5m3vyXWz9QO2hASRZWRMtvGVxo?= =?us-ascii?Q?qdKLfSTMl1LI19A9CMe8TSilv2+rmFp2XH39PzSoV2jPezzGzxNOi60+4SWj?= =?us-ascii?Q?ePmw9/J01ZCD5/B7pbI6QWMi9HJABcqKCVhDjR4++EoYyfH4nExCFbprRGR+?= =?us-ascii?Q?bW9EggSgKbdUJgyWofteuoLDLNxnmq+c7iJhvthlQrvrSwAlQm+X+VTX2/2Z?= =?us-ascii?Q?iBGauuYYEgUGT+f1b5pgYeIihb4qa7LOs+1v+Q8RNkFT3jP4KRoLb+pzoPoz?= =?us-ascii?Q?BLPSwbg3rwtmNx6iSkHXwxQ+uRw9uCl8XfA1aUbDeLDlfxyJzxbkDfaUtpuA?= =?us-ascii?Q?NI7TG1NZAGAR8s9BHtC/6zUzuDEtR+8l0L3WPPavYiRt4V2GNCz2kdzll8xN?= =?us-ascii?Q?WNIkXm/tPwxVtaiIHk06S2EdN9CbDdg5idldoIabjy0UUT5vEcxndjAd1YHx?= =?us-ascii?Q?3EOh9cAycnb7jZQ3sPQ/MWVW0ABqHuyUJYyXRzfoTOVAsiWekw7Tx4B0pcMh?= =?us-ascii?Q?KM1cdaKVKPAwdOnJdWjZGA+53WVFgNgtA+WB+OijE/Cwu6ckzblYvePuI/a7?= =?us-ascii?Q?Fm/WUi/0zS7Dt/yjefbC4QPfzsxWSk1NfInUmT76WGzIn7jKA/HS9VFo/CLU?= =?us-ascii?Q?c4nW01bp5ug5yPydrx7MXRyINUxTIZt5rwmDQCvOeIBah8rLLx9YwSCQj1Wr?= =?us-ascii?Q?howgE4ccdLoFnXbpJiZsJuAuK4K4rpAsuCRpVYz1lzvJ5qgFns3eyz496C8+?= =?us-ascii?Q?rYsSr2S6ZImK1ZHvKAJo9JelPKDPPP9rhFZbzSfmLW1+ldEvi56Pyu55eHzU?= =?us-ascii?Q?n/fWRs5Omp09Vfu62yXVIn3bK+2eD/49Mmx2r7s+j2dNIlp1JU+3qRZ4Rt3g?= =?us-ascii?Q?sOyP1Db4VEHlBu1lMBYE2E938uAyLUqn8nYQRP0cVrya2bKJZ5gtDbYDg+hJ?= =?us-ascii?Q?6oHw9oA0oMenJtg/dEqMRkQJXivcYQD2BzEgHIeeP5Drdmp7DSi2yDCDRg?= =?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)(1800799024)(36860700013)(7416014)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2025 18:30:37.4266 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28b8a234-9f65-45b8-6b67-08ddcba959ea 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: SA2PEPF000015C6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7904 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 Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre --- 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