[PATCH v3] fs/resctrl: Add CONFIG_RESCTRL_ASSIGN_FIXED Kconfig entry

Ben Horgan posted 1 patch 2 days, 20 hours ago
There is a newer version of this series
fs/resctrl/Kconfig   | 9 +++++++++
fs/resctrl/monitor.c | 6 ++++++
2 files changed, 15 insertions(+)
[PATCH v3] fs/resctrl: Add CONFIG_RESCTRL_ASSIGN_FIXED Kconfig entry
Posted by Ben Horgan 2 days, 20 hours ago
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.

CONFIG_RESCTRL_ASSIGN_FIXED is a resctrl fs Kconfig option so handle
attempts to modify counter assignment mode when it is enabled in resctrl fs
rather than delegating to arch specific code.

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.

Changes since v2:
Start user message with a capital
Make summary more succint - was
 "fs/resctrl: Add missing kconfig entry for CONFIG_RESCTRL_ASSIGN_FIXED"
Tidy changelog
---
 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..4e9f55ee3267 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
Re: [PATCH v3] fs/resctrl: Add CONFIG_RESCTRL_ASSIGN_FIXED Kconfig entry
Posted by Reinette Chatre 2 days, 16 hours ago
Hi Ben,

On 2/4/26 4:02 AM, Ben Horgan wrote:
> 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 changelog flow makes a big leap between its two paragraphs. I cannot tell why the
middle paragraph was dropped since it describes why the change is needed now to connect
with the opening context. Could you add a middle paragraph like below?

  Add CONFIG_RESCTRL_ASSIGN_FIXED in order to support MPAM where the counter assignment
  mode is indeed fixed. 

> 
> CONFIG_RESCTRL_ASSIGN_FIXED is a resctrl fs Kconfig option so handle
> attempts to modify counter assignment mode when it is enabled in resctrl fs
> rather than delegating to arch specific code.
> 
> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
> ---
Reinette
Re: [PATCH v3] fs/resctrl: Add CONFIG_RESCTRL_ASSIGN_FIXED Kconfig entry
Posted by Ben Horgan 2 days, 16 hours ago
Hi Reinette,

On 2/4/26 16:08, Reinette Chatre wrote:
> Hi Ben,
> 
> On 2/4/26 4:02 AM, Ben Horgan wrote:
>> 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 changelog flow makes a big leap between its two paragraphs. I cannot tell why the
> middle paragraph was dropped since it describes why the change is needed now to connect
> with the opening context. Could you add a middle paragraph like below?
> 
>   Add CONFIG_RESCTRL_ASSIGN_FIXED in order to support MPAM where the counter assignment
>   mode is indeed fixed.

Sorry, I'll do that now. The omission was simply a mistake.

> 
>>
>> CONFIG_RESCTRL_ASSIGN_FIXED is a resctrl fs Kconfig option so handle
>> attempts to modify counter assignment mode when it is enabled in resctrl fs
>> rather than delegating to arch specific code.
>>
>> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
>> ---
> Reinette

Thanks,

Ben