mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] fs/resctrl: Add missing kconfig entry for CONFIG_RESCTRL_ASSIGN_FIXED
@ 2026-01-28 16:12 Ben Horgan
  2026-02-02 21:50 ` Reinette Chatre
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Horgan @ 2026-01-28 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: tony.luck, reinette.chatre, Dave.Martin, james.morse, babu.moger,
	bp, Ben Horgan

The 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. Add the kconfig entry as it is
now necessary in order to support ABMC on MPAM where the counter assignment
mode is indeed fixed.

Also, take the opportunity ensure that a user attempt to change between
different counter assignment mode fails from the resctrl code rather than
delegating to the arch specific code and let the user know by adding a
message in last_cmd_status.

Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
Changes since v1:
Update the commit message to make it clear this is an anticipated follow on
patch rather than a fix.
Only fail attempts to change to a different counter assignment mode.
Kconfig indenting.
Use "counter assignment mode" text throughout.
---
 fs/resctrl/Kconfig   | 9 +++++++++
 fs/resctrl/monitor.c | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/fs/resctrl/Kconfig b/fs/resctrl/Kconfig
index 21671301bd8a..d833dea81aea 100644
--- a/fs/resctrl/Kconfig
+++ b/fs/resctrl/Kconfig
@@ -37,3 +37,12 @@ config RESCTRL_RMID_DEPENDS_ON_CLOSID
 	  Enabled by the architecture when the RMID values depend on the CLOSID.
 	  This causes the CLOSID allocator to search for CLOSID with clean
 	  RMID.
+
+config RESCTRL_ASSIGN_FIXED
+	bool
+	depends on RESCTRL_FS
+	help
+	  Enabled by the architecture when the counter assignment mode is not
+	  configurable. This ensures that counter assignment mode is not
+	  advertised as configurable and attempts to change counter assignment
+	  mode fail.
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 572a9925bd6c..93756be50062 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -1451,6 +1451,12 @@ ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf,
 	}
 
 	if (enable != resctrl_arch_mbm_cntr_assign_enabled(r)) {
+		if (IS_ENABLED(CONFIG_RESCTRL_ASSIGN_FIXED)) {
+			ret = -EINVAL;
+			rdt_last_cmd_puts("counter assignment mode is not configurable\n");
+			goto out_unlock;
+		}
+
 		ret = resctrl_arch_mbm_cntr_assign_set(r, enable);
 		if (ret)
 			goto out_unlock;
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-04 11:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-28 16:12 [PATCH v2] fs/resctrl: Add missing kconfig entry for CONFIG_RESCTRL_ASSIGN_FIXED Ben Horgan
2026-02-02 21:50 ` Reinette Chatre
2026-02-04 11:40   ` Ben Horgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®