From nobody Sat Apr 11 10:48:08 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 091B83CF679 for ; Fri, 13 Mar 2026 17:45:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423941; cv=none; b=Ln5KJJQd3UBLRCgZukEkA+8umZz4AJEvYovsRiRBC3M+aiVqQLLv/hha6weRqcOvxRxQiCFI8zilxR9mauogLfcQkyh3DlhevoVY+eGYhlTE0jZ8wPyQH1Wn9roWtwKxP2s+khBNXRnMK51Mxy1XR7X58gZQikywNjHOQmm7hqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423941; c=relaxed/simple; bh=fvPFkilTW9Kk8puqSto312O9KHgj6qa6CnmStRJUw1s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ohOO6bvKPt85l8gpi2lvhXZrWiIALzAhLzQW7+yZ1aUtRT7ufzghlA0P43xSntWaESK+Q/X227zaje7TteGyPmw4DyuBcGXvQXjNVsAiQwUra2gp562KeaBOPuKIFq5vA93dKQY6YfetxgM55D7kOdwS0C0lbx7z/CtnlMSLToU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3F6A81C00; Fri, 13 Mar 2026 10:45:32 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 46C693F694; Fri, 13 Mar 2026 10:45:36 -0700 (PDT) From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v2 1/6] x86,fs/resctrl: Make resctrl_arch_is_evt_configurable() aware of mbm_assign_mode Date: Fri, 13 Mar 2026 17:45:19 +0000 Message-ID: <20260313174524.3482767-2-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260313174524.3482767-1-ben.horgan@arm.com> References: <20260313174524.3482767-1-ben.horgan@arm.com> 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 Content-Type: text/plain; charset="utf-8" The features BMEC and ABMC provide separate interfaces to configuring which bandwidth types a counter tracks. Currently resctrl_arch_is_evt_configurable() only ever returns true if BMEC is supported. ABMC is useful even when BMEC is supported as it also provides counter assignment which reduces the number of hardware monitors a system requires. It is an architectural detail that ABMC provides counter configurability without requiring the prior feature, BMEC. On MPAM systems these two features are independent and the bandwidth types are limited to a choice of only read or write. In order to give resctrl the information to support these features independently extend resctrl_arch_is_evt_configurable() to report whether events are configurable when using the mbm_event counter assignment mode. Signed-off-by: Ben Horgan --- arch/x86/kernel/cpu/resctrl/core.c | 12 ++++++++++-- fs/resctrl/monitor.c | 4 ++-- include/linux/resctrl.h | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 7667cf7c4e94..8c041c5f07ab 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -877,11 +877,19 @@ bool rdt_cpu_has(int flag) return ret; } =20 -bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt) +bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt, bool per_= cntr) { - if (!rdt_cpu_has(X86_FEATURE_BMEC)) + if (!per_cntr && !rdt_cpu_has(X86_FEATURE_BMEC)) return false; =20 + if (per_cntr && !rdt_cpu_has(X86_FEATURE_ABMC)) + return false; + + /* + * When ABMC is used the mbm_local and mbm_total events are enabled + * based on the equivalently named cpu features. (In order to allow + * fallback to the default counter assignment mode). + */ switch (evt) { case QOS_L3_MBM_TOTAL_EVENT_ID: return rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL); diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 49f3f6b846b2..d25622ee22c5 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -1854,12 +1854,12 @@ int resctrl_l3_mon_resource_init(void) if (ret) return ret; =20 - if (resctrl_arch_is_evt_configurable(QOS_L3_MBM_TOTAL_EVENT_ID)) { + if (resctrl_arch_is_evt_configurable(QOS_L3_MBM_TOTAL_EVENT_ID, false)) { mon_event_all[QOS_L3_MBM_TOTAL_EVENT_ID].configurable =3D true; resctrl_file_fflags_init("mbm_total_bytes_config", RFTYPE_MON_INFO | RFTYPE_RES_CACHE); } - if (resctrl_arch_is_evt_configurable(QOS_L3_MBM_LOCAL_EVENT_ID)) { + if (resctrl_arch_is_evt_configurable(QOS_L3_MBM_LOCAL_EVENT_ID, false)) { mon_event_all[QOS_L3_MBM_LOCAL_EVENT_ID].configurable =3D true; resctrl_file_fflags_init("mbm_local_bytes_config", RFTYPE_MON_INFO | RFTYPE_RES_CACHE); diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 006e57fd7ca5..4ae63233b506 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -419,7 +419,7 @@ bool resctrl_enable_mon_event(enum resctrl_event_id eve= ntid, bool any_cpu, =20 bool resctrl_is_mon_event_enabled(enum resctrl_event_id eventid); =20 -bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt); +bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt, bool per_= cntr); =20 static inline bool resctrl_is_mbm_event(enum resctrl_event_id eventid) { --=20 2.43.0 From nobody Sat Apr 11 10:48:08 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F6203CF033 for ; Fri, 13 Mar 2026 17:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423944; cv=none; b=J4tmHixI3+OT2tmnryFnfgw+7zt/SZXTKPZ3JNY7HF+OUE+auKcnoo83LrmkdrsGXazmWWTxzN8kq0xBRU+Y2EyBPeHzOROjE1BFFxqbAXPHQjHCzF083oCdxe52rQlTy8bA0tdpVTdJi4QFnuTh8SOT3ooJjz4xIAL+DKnuKg0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423944; c=relaxed/simple; bh=r3jS0iMVJKol5bbCcmZNRj72n5eFPLHhD7IuoyM7mBA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pypcTweRQZpDZq68/Cyy3AL4JC6j5VKn7PAI9x3kvoaYMGE/G75IVtQPzpBpVG/7TFdJHKhn4W1tJ/mPPpQ/LRrXXtFbiOWC1aGTCgregHIoITd3TRMrAagHodUszMGv9ULZNXtdF7y/RdZa4H7I43IQ4x9FHRSix+Yyx+P96eM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A6D551E7D; Fri, 13 Mar 2026 10:45:34 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A636B3F694; Fri, 13 Mar 2026 10:45:38 -0700 (PDT) From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v2 2/6] fs/resctrl: Tidy up the error path in resctrl_mkdir_event_configs() Date: Fri, 13 Mar 2026 17:45:20 +0000 Message-ID: <20260313174524.3482767-3-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260313174524.3482767-1-ben.horgan@arm.com> References: <20260313174524.3482767-1-ben.horgan@arm.com> 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 Content-Type: text/plain; charset="utf-8" The error path in resctrl_mkdir_event_configs() is unnecessarily complicated. Simplify it to just return directly on error. Signed-off-by: Ben Horgan --- fs/resctrl/rdtgroup.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 5da305bd36c9..4753841c2ca3 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2331,20 +2331,19 @@ static int resctrl_mkdir_event_configs(struct rdt_r= esource *r, struct kernfs_nod kn_subdir2 =3D kernfs_create_dir(kn_subdir, mevt->name, kn_subdir->mode,= mevt); if (IS_ERR(kn_subdir2)) { ret =3D PTR_ERR(kn_subdir2); - goto out; + return ret; } =20 ret =3D rdtgroup_kn_set_ugid(kn_subdir2); if (ret) - goto out; + return ret; =20 ret =3D rdtgroup_add_files(kn_subdir2, RFTYPE_ASSIGN_CONFIG); if (ret) - break; + return ret; } =20 -out: - return ret; + return 0; } =20 static int rdtgroup_mkdir_info_resdir(void *priv, char *name, --=20 2.43.0 From nobody Sat Apr 11 10:48:08 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD1033CF681 for ; Fri, 13 Mar 2026 17:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423945; cv=none; b=rtaLZaV6h5SKXbyDs+ZgP1lCzx8CYMmgqwoxkVBYuuo1OzEDS5Yol0KuFH4fqpisVxiCmJyLDu+h9H5/fD1pNw0szKcNzPWtdPfrwhYI6RG+vDdVcDm1xCvYoXYz6vXLzIUXk4w5I4YO8TbSpNN8U0HH6VirVD0FRxZzYjnCWi0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423945; c=relaxed/simple; bh=fiS+WI7+dFbwd3+osifScvvOyqC4dpyEw/XxyoTVVuo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hEaGeSTCttH054CNqo2GoLV/9aIonH7JJ84y3eeuKuWy3oFCAw7YFrz8MZsfdpXq36A84o/XYEvcJtnw6Rc502SrmTgwD2CSGtPxcHBewpUr5UwZLa5wKFfOLhH6zPAUhZ6j6Q7AVmXuBH6TuZwe+0SedHbym3pXS9EgheStKNk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 102A622C7; Fri, 13 Mar 2026 10:45:37 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1A7DF3F694; Fri, 13 Mar 2026 10:45:40 -0700 (PDT) From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v2 3/6] fs/resctrl: Make 'event_filter' files read only if they're not configurable Date: Fri, 13 Mar 2026 17:45:21 +0000 Message-ID: <20260313174524.3482767-4-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260313174524.3482767-1-ben.horgan@arm.com> References: <20260313174524.3482767-1-ben.horgan@arm.com> 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 Content-Type: text/plain; charset="utf-8" When the counter assignment mode is mbm_event resctrl assumes the mbm events are configurable and exposes the 'event_filter' files. These files live at info/L3_MON/event_configs//event_filter and are used to display and set the event configuration. The MPAM driver has no support for changing event configuration and so mbm_event mode can't be used. In order to support mbm_event event with MPAM make the 'event_filter' files read only if the event configuration can't be changed. A user can still chmod the file and so also return an error from event_filter_write(). Signed-off-by: Ben Horgan --- fs/resctrl/monitor.c | 6 ++++++ fs/resctrl/rdtgroup.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index d25622ee22c5..a2da771d82df 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -1414,6 +1414,12 @@ ssize_t event_filter_write(struct kernfs_open_file *= of, char *buf, size_t nbytes =20 rdt_last_cmd_clear(); =20 + if (!resctrl_arch_is_evt_configurable(mevt->evtid, true)) { + rdt_last_cmd_printf("event_filter is not configurable for %s\n", mevt->n= ame); + ret =3D -EPERM; + goto out_unlock; + } + r =3D resctrl_arch_get_resource(mevt->rid); if (!resctrl_arch_mbm_cntr_assign_enabled(r)) { rdt_last_cmd_puts("mbm_event counter assignment mode is not enabled\n"); diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 4753841c2ca3..2f0a509b313a 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2341,6 +2341,22 @@ static int resctrl_mkdir_event_configs(struct rdt_re= source *r, struct kernfs_nod ret =3D rdtgroup_add_files(kn_subdir2, RFTYPE_ASSIGN_CONFIG); if (ret) return ret; + + if (!resctrl_arch_is_evt_configurable(mevt->evtid, true)) { + struct iattr iattr =3D {.ia_valid =3D ATTR_MODE,}; + struct kernfs_node *kn; + + kn =3D kernfs_find_and_get_ns(kn_subdir2, "event_filter", NULL); + if (!kn) + return -ENOENT; + + iattr.ia_mode =3D S_IFREG | 0444; + + ret =3D kernfs_setattr(kn, &iattr); + kernfs_put(kn); + if (ret) + return ret; + } } =20 return 0; --=20 2.43.0 From nobody Sat Apr 11 10:48:08 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36B613CF675 for ; Fri, 13 Mar 2026 17:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423950; cv=none; b=dDRZj/h2U3HGNKWeh8nQxwJmMlMMWPng1hqDqJjHlKVj60RqRRpaW3yuBTlJfceVgfUsfJi+SGmCYCScG8UU05BoAUdqtDfG2XOT2+vdjS8Hhx90/LDCyTD0iL5NAVQiCCgx6nQZt5m8N7e2Oser/KbQUPhG/nlxYR8zfwIud+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423950; c=relaxed/simple; bh=BpFhy3nmQaddqrQYLKcAJrB640tbX9XYLKUwwA6Pwms=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ppbPLMoh08HfINf89lj/ci31JaJHPAJN21hXa4OrKQpM573A8MpSS4M5l6Czhd8rFzR+37sIMehbgt8Hoz9KeAeQWR66fxg4NpFT1OnIO/d3CLxRoizSNCqmMhapit8A5LIQWKTDLttgEuhoVywt9d6LxqEXDPEKt6xt1RkYY54= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 704C92308; Fri, 13 Mar 2026 10:45:39 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 792DB3F694; Fri, 13 Mar 2026 10:45:43 -0700 (PDT) From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v2 4/6] fs/resctrl: Disallow the software controller when mbm counters are assignable Date: Fri, 13 Mar 2026 17:45:22 +0000 Message-ID: <20260313174524.3482767-5-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260313174524.3482767-1-ben.horgan@arm.com> References: <20260313174524.3482767-1-ben.horgan@arm.com> 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 Content-Type: text/plain; charset="utf-8" The software controller requires that there are free running mbm counters for each control group in order to provide the feedback necessary to control the memory bandwidth allocation for that control group. Previous to the introduction counter assignment support (ABMC) resctrl required this in order to advertise support for mbm but now if the mbm counters are assignable then this can't be guaranteed. Currently, only AMD systems support counter assignment but the MBA is non linear and so the software controller is never supported anyway. For MPAM systems the MBA is linear and so the dependency on counters not being assignable needs to made explicit. Hence, fail the mount if the user requests the software controller, the mba_MBps option, and the mbm counters are assignable. Signed-off-by: Ben Horgan --- fs/resctrl/rdtgroup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 2f0a509b313a..21e6ca71e6e7 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2535,7 +2535,8 @@ static bool supports_mba_mbps(void) =20 return (resctrl_is_mbm_enabled() && r->alloc_capable && is_mba_linear() && - r->ctrl_scope =3D=3D rmbm->mon_scope); + r->ctrl_scope =3D=3D rmbm->mon_scope && + !rmbm->mon.mbm_cntr_assignable); } =20 /* @@ -2950,7 +2951,7 @@ static int rdt_parse_param(struct fs_context *fc, str= uct fs_parameter *param) ctx->enable_cdpl2 =3D true; return 0; case Opt_mba_mbps: - msg =3D "mba_MBps requires MBM and linear scale MBA at L3 scope"; + msg =3D "mba_MBps requires dedicated MBM counters and linear scale MBA a= t L3 scope"; if (!supports_mba_mbps()) return invalfc(fc, msg); ctx->enable_mba_mbps =3D true; --=20 2.43.0 From nobody Sat Apr 11 10:48:08 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 781CD3CF033 for ; Fri, 13 Mar 2026 17:45:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423950; cv=none; b=u4GRNDQ7FxEwPb3pSrQKAXkMEbL6IaLQiRSwEvwtyRIw9vMdKghJXTwcorXs2MR65Xg/+dmd8bnY+XIbArLecEFaC8UMAPqJ+5gGjtb8eVFhWWxwKCkUXjF4tc39SNRB+l4iU2aJvO75sd2ptmKlB6HO1jHsIZxDBTQ1g1yQxBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423950; c=relaxed/simple; bh=LQ2C2TT3Za0iObr3jPQjDLE6iKrpDWbqnA5YJbTPAGU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NhvjdhetxvwXMeln0WJ4dzHSqHNR3ye+CHKU6Fwdr3xB+mfQOSWEw2eVVv86jQFGgXUTsaj46F0Xh3G4t5jcYsjbq4xMHPPfq2kraxukf71f2LB8Cvx2ZbbF8oxqBVPAbMsKVxFFmDa/ERpIPd1mlk5eF/ScCADOFq/Ov0LIveI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CBFEA176A; Fri, 13 Mar 2026 10:45:41 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D7B383F694; Fri, 13 Mar 2026 10:45:45 -0700 (PDT) From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v2 5/6] x86,fs/resctrl: Add resctrl_arch_mbm_cntr_assign_fixed() Date: Fri, 13 Mar 2026 17:45:23 +0000 Message-ID: <20260313174524.3482767-6-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260313174524.3482767-1-ben.horgan@arm.com> References: <20260313174524.3482767-1-ben.horgan@arm.com> 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 Content-Type: text/plain; charset="utf-8" Commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring = modes") introduced CONFIG_RESCTRL_ASSIGN_FIXED but left adding the Kconfig entry until it was necessary. The counter assignment mode is fixed in MPAM, even when there are assignable counters, and so addressing this is needed to support MPAM. To avoid the burden of another Kconfig entry, replace CONFIG_RESCTRL_ASSIGN_FIXED with a new arch hook, resctrl_arch_mbm_cntr_assign_fixed(). To enable better user reporting check use the new check in resctrl_mbm_assign_mode_write(). Signed-off-by: Ben Horgan --- arch/x86/kernel/cpu/resctrl/monitor.c | 5 +++++ fs/resctrl/monitor.c | 8 +++++++- include/linux/resctrl.h | 10 ++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/re= sctrl/monitor.c index 9bd87bae4983..aa7f8f1ecd22 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -523,6 +523,11 @@ bool resctrl_arch_mbm_cntr_assign_enabled(struct rdt_r= esource *r) return resctrl_to_arch_res(r)->mbm_cntr_assign_enabled; } =20 +bool resctrl_arch_mbm_cntr_assign_fixed(struct rdt_resource *r) +{ + return false; +} + static void resctrl_abmc_config_one_amd(void *info) { union l3_qos_abmc_cfg *abmc_cfg =3D info; diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index a2da771d82df..62edb464410a 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -1455,7 +1455,7 @@ int resctrl_mbm_assign_mode_show(struct kernfs_open_f= ile *of, else seq_puts(s, "[default]\n"); =20 - if (!IS_ENABLED(CONFIG_RESCTRL_ASSIGN_FIXED)) { + if (!resctrl_arch_mbm_cntr_assign_fixed(r)) { if (enabled) seq_puts(s, "default\n"); else @@ -1506,6 +1506,12 @@ ssize_t resctrl_mbm_assign_mode_write(struct kernfs_= open_file *of, char *buf, } =20 if (enable !=3D resctrl_arch_mbm_cntr_assign_enabled(r)) { + if (!resctrl_arch_mbm_cntr_assign_fixed(r)) { + ret =3D -EINVAL; + rdt_last_cmd_puts("Counter assignment mode is not configurable\n"); + goto out_unlock; + } + ret =3D resctrl_arch_mbm_cntr_assign_set(r, enable); if (ret) goto out_unlock; diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 4ae63233b506..c85176999eb2 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -500,6 +500,16 @@ bool resctrl_arch_mbm_cntr_assign_enabled(struct rdt_r= esource *r); */ int resctrl_arch_mbm_cntr_assign_set(struct rdt_resource *r, bool enable); =20 +/** + * resctrl_arch_mbm_cntr_assign_fixed() - Check if MBM counter assignment = mode + * can be configured. + * @r: Pointer to the resource structure. + * + * Return: + * true if the assignment mode is fixed, false otherwise. + */ +bool resctrl_arch_mbm_cntr_assign_fixed(struct rdt_resource *r); + /* * Update the ctrl_val and apply this config right now. * Must be called on one of the domain's CPUs. --=20 2.43.0 From nobody Sat Apr 11 10:48:08 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF0483CFF59 for ; Fri, 13 Mar 2026 17:45:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423952; cv=none; b=HfCWhjPREtROw3SqD7yNd5G/f9cqtl6d0P5RzEKz0EI1eaoSVbj9YDAGD0MM9NxZo53YwlZNncdHFwnsNKRrn36LgIopBPZgzEfg0QpJzvUAeYcOn4J/qm3hYocqVLWHr4rL+4xdXV5S0/Hp+/4cRNy1HSZhTxvhG+s7pL5GbkQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423952; c=relaxed/simple; bh=rzmTg/kGfhSeIQdfvRyMGXVSdK56H706Ex87WY/Bpoo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N0Dvb3D4AKiMhWg5kdJicK1NN9Kd5fKR1tjPL6Kq2DexFxZ6ueLM8RVo3Kz9HZ8ixkEoFguH2j298icy37Rali+WrSmEEQy5kDHsjXUWybZEbsRFmvplyLDVwoUujoXHAVpa2FDMXpEyzr4RSIvMjpQx0/P0eqoYsZSzBVhAoR4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 40B491C00; Fri, 13 Mar 2026 10:45:44 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 423643F694; Fri, 13 Mar 2026 10:45:48 -0700 (PDT) From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v2 6/6] arm_mpam: resctrl: Adapt to new or changed resctrl arch functions Date: Fri, 13 Mar 2026 17:45:24 +0000 Message-ID: <20260313174524.3482767-7-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260313174524.3482767-1-ben.horgan@arm.com> References: <20260313174524.3482767-1-ben.horgan@arm.com> 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 Content-Type: text/plain; charset="utf-8" Fix MPAM build after change to new version of resctrl_arch_is_evt_configurable() and introduction of resctrl_arch_mbm_cntr_assign_fixed(). Signed-off-by: Ben Horgan --- drivers/resctrl/mpam_resctrl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c index a7691c66553a..86e899b89b58 100644 --- a/drivers/resctrl/mpam_resctrl.c +++ b/drivers/resctrl/mpam_resctrl.c @@ -97,7 +97,7 @@ bool resctrl_arch_mon_capable(void) return l3->mon_capable; } =20 -bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt) +bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt, bool assi= gnable) { return false; } @@ -148,6 +148,11 @@ int resctrl_arch_mbm_cntr_assign_set(struct rdt_resour= ce *r, bool enable) return -EINVAL; } =20 +bool resctrl_arch_mbm_cntr_assign_fixed(struct rdt_resource *r) +{ + return true; +} + int resctrl_arch_io_alloc_enable(struct rdt_resource *r, bool enable) { return -EOPNOTSUPP; --=20 2.43.0