Skip to contentSkip to conversation

fs/resctrl: Add missing kconfig entry for CONFIG_RESCTRL_ASSIGN_FIXED

PATCH Superseded Ben Horgan 3 participants 9 messages Jan 13 – Jan 16 RDT - resource allocation

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Ben Horgan

author
#0 lore raw

PATCH 1/1 fs/resctrl: Add missing kconfig entry for CONFIG_RESCTRL_ASSIGN_FIXED

The commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes") introduced CONFIG_RESCTRL_ASSIGN_FIXED but did not add the kconfig entry. Add this.

Also, take the opportunity ensure that any user attempt to change the assign 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.

Fixes 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes")
---
 fs/resctrl/Kconfig   | 8 ++++++++
 fs/resctrl/monitor.c | 6 ++++++
 2 files changed, 14 insertions(+)
fs/resctrl/Kconfig +8 -0
index 21671301bd8a..bdf9e11502fa 100644
@@ -37,3 +37,11 @@ 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 is not advertised as
+	 configurable and configuration attempts fail.
fs/resctrl/monitor.c +6 -0
index 572a9925bd6c..888e303c18a2 100644
@@ -1434,6 +1434,12 @@ ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf,
 
 	rdt_last_cmd_clear();
 
+	if (IS_ENABLED(CONFIG_RESCTRL_ASSIGN_FIXED)) {
+		ret = -EINVAL;
+		rdt_last_cmd_puts("assign mode is not configurable\n");
+		goto out_unlock;
+	}
+
 	if (!strcmp(buf, "default")) {
 		enable = 0;
 	} else if (!strcmp(buf, "mbm_event")) {
Signature · 1 line
2.43.0
#1 lore raw

Hi Ben,

Quoted 3 lines · Ben Horgan

The commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes") introduced CONFIG_RESCTRL_ASSIGN_FIXED but did not add the kconfig entry. Add this.

Add this -> Add the missing configuration option  or Add the missing Kconfig option. ?

Quoted 3 lines

Also, take the opportunity ensure that any user attempt to change the assign mode fails from the resctrl code rather than delegating to the arch

assign mode -> counter assignment mode

Quoted 30 lines

specific code and let the user know by adding a message in last_cmd_status.

Fixes 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes")
---
  fs/resctrl/Kconfig   | 8 ++++++++
  fs/resctrl/monitor.c | 6 ++++++
  2 files changed, 14 insertions(+)
fs/resctrl/Kconfig +8 -0
index 21671301bd8a..bdf9e11502fa 100644
@@ -37,3 +37,11 @@ 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 is not advertised as
+	 configurable and configuration attempts fail.
fs/resctrl/monitor.c +0 -0
index 572a9925bd6c..888e303c18a2 100644

fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1439

Quoted 6 lines
fs/resctrl/monitor.c +3 -0
@@ -1434,6 +1434,12 @@ ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf,
 
  	rdt_last_cmd_clear();
 
+	if (IS_ENABLED(CONFIG_RESCTRL_ASSIGN_FIXED)) {
+		ret = -EINVAL;
+		rdt_last_cmd_puts("assign mode is not configurable\n");

assign mode -> counter assignment mode

Quoted 6 lines
fs/resctrl/monitor.c +3 -0
+		goto out_unlock;
+	}
+
  	if (!strcmp(buf, "default")) {
  		enable = 0;
  	} else if (!strcmp(buf, "mbm_event")) {
author
#2 lore raw

Hi Babu,

Quoted 8 lines · Babu Moger

Hi Ben,

Quoted 3 lines · Ben Horgan

The commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes") introduced CONFIG_RESCTRL_ASSIGN_FIXED but did not add the kconfig entry. Add this.

Add this -> Add the missing configuration option  or Add the missing Kconfig option. ?

I'll update the commit message to make it clearer that the change is adding a Kconfig option that was previously intentionally left undefined. (As per Reinette's review comments.)

Quoted 6 lines
Quoted 4 lines

Also, take the opportunity ensure that any user attempt to change the assign mode fails from the resctrl code rather than delegating to the arch

assign mode -> counter assignment mode

Ack.

Quoted 35 lines
Quoted 35 lines

specific code and let the user know by adding a message in last_cmd_status.

Fixes 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display

monitoring modes")

---
  fs/resctrl/Kconfig   | 8 ++++++++
  fs/resctrl/monitor.c | 6 ++++++

  2 files changed, 14 insertions(+)
fs/resctrl/Kconfig +0 -0
index 21671301bd8a..bdf9e11502fa 100644
@@ -37,3 +37,11 @@ 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.

fs/resctrl/Kconfig +7 -0
+
+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 is not

advertised as
+     configurable and configuration attempts fail.

fs/resctrl/monitor.c +0 -0
index 572a9925bd6c..888e303c18a2 100644
Quoted 8 lines

fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct · line 1438

Quoted 6 lines
fs/resctrl/monitor.c +2 -0
@@ -1434,6 +1434,12 @@ ssize_t resctrl_mbm_assign_mode_write(struct
 kernfs_open_file *of, char *buf,
         rdt_last_cmd_clear();
   +    if (IS_ENABLED(CONFIG_RESCTRL_ASSIGN_FIXED)) {
+        ret = -EINVAL;
+        rdt_last_cmd_puts("assign mode is not configurable\n");

assign mode -> counter assignment mode

Ack

Quoted 8 lines

fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1445

Quoted 8 lines
fs/resctrl/monitor.c +3 -0
+        goto out_unlock;
+    }
+
       if (!strcmp(buf, "default")) {
           enable = 0;
       } else if (!strcmp(buf, "mbm_event")) {

Thanks,

Ben

maintainer
#3 lore raw
In reply to Ben Horgan

Hi Ben,

Per subject, the Kconfig entry has not really been missing but has instead been intentionally left undefined which is handled correctly by IS_ENABLED(). The plans/usage surrounding CONFIG_RESCTRL_ASSIGN_FIXED can be found in the same commit used in "Fixes" tag. Adding the definition as a fix to the patch that documents that it is intentionally left undefined is unexpected.

This patch is just following existing plan that CONFIG_RESCTRL_ASSIGN_FIXED will be defined at the time Arm support needs it, no? Folks using "Fixes" to determine if a change needs to be backported will find no benefit from this and terming it a fix will just cause unnecessary work.

Quoted 7 lines · Ben Horgan

The commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes") introduced CONFIG_RESCTRL_ASSIGN_FIXED but did not add the kconfig entry. Add this.

Also, take the opportunity ensure that any user attempt to change the assign 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.

Why *any* attempt? Avoiding delegating to arch seems ok as a goal but this change additionally changes interface with user space. Current behavior when user writes existing mode to the file is to just return success. For example, if current mode is "default" and user writes "default". This patch changes this behavior to fail instead. Is this intended?

Quoted 30 lines
Fixes 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes")
---
 fs/resctrl/Kconfig   | 8 ++++++++
 fs/resctrl/monitor.c | 6 ++++++
 2 files changed, 14 insertions(+)
fs/resctrl/Kconfig +8 -0
index 21671301bd8a..bdf9e11502fa 100644
@@ -37,3 +37,11 @@ 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 is not advertised as
+	 configurable and configuration attempts fail.
fs/resctrl/monitor.c +0 -0
index 572a9925bd6c..888e303c18a2 100644
@@ -1434,6 +1434,12 @@ ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf,
 
 	rdt_last_cmd_clear();

fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1445

Quoted 10 lines
fs/resctrl/monitor.c +6 -0
 
+	if (IS_ENABLED(CONFIG_RESCTRL_ASSIGN_FIXED)) {
+		ret = -EINVAL;
+		rdt_last_cmd_puts("assign mode is not configurable\n");
+		goto out_unlock;
+	}
+
 	if (!strcmp(buf, "default")) {
 		enable = 0;
 	} else if (!strcmp(buf, "mbm_event")) {

Reinette

author
#4 lore raw

Hi Reinette,

Quoted 8 lines · Reinette Chatre

Hi Ben,

Per subject, the Kconfig entry has not really been missing but has instead been intentionally left undefined which is handled correctly by IS_ENABLED(). The plans/usage surrounding CONFIG_RESCTRL_ASSIGN_FIXED can be found in the same commit used in "Fixes" tag. Adding the definition as a fix to the patch that documents that it is intentionally left undefined is unexpected.

Quoted 4 lines

This patch is just following existing plan that CONFIG_RESCTRL_ASSIGN_FIXED will be defined at the time Arm support needs it, no? Folks using "Fixes" to determine if a change needs to be backported will find no benefit from this and terming it a fix will just cause unnecessary work.

Fair enough. I didn't follow that discussion. I'll drop the fixes tag on a respin.

Quoted 10 lines · Ben Horgan
Quoted 7 lines

The commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes") introduced CONFIG_RESCTRL_ASSIGN_FIXED but did not add the kconfig entry. Add this.

Also, take the opportunity ensure that any user attempt to change the assign 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.

Quoted 5 lines

Why *any* attempt? Avoiding delegating to arch seems ok as a goal but this change additionally changes interface with user space. Current behavior when user writes existing mode to the file is to just return success. For example, if current mode is "default" and user writes "default". This patch changes this behavior to fail instead. Is this intended?

Intended but as you point out, it would be best to accept the current value without error for maximum compatibility between architectures. I'll update the config option help text to reflect this. Was the help text also discussed previously?

Quoted 32 lines
Quoted 32 lines
Fixes 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes")
---
 fs/resctrl/Kconfig   | 8 ++++++++
 fs/resctrl/monitor.c | 6 ++++++
 2 files changed, 14 insertions(+)
fs/resctrl/Kconfig +8 -0
index 21671301bd8a..bdf9e11502fa 100644
@@ -37,3 +37,11 @@ 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 is not advertised as
+	 configurable and configuration attempts fail.
fs/resctrl/monitor.c +0 -0
index 572a9925bd6c..888e303c18a2 100644
@@ -1434,6 +1434,12 @@ ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf,
 
 	rdt_last_cmd_clear();
 
Quoted 11 lines

fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1445

Quoted 9 lines
fs/resctrl/monitor.c +6 -0
+	if (IS_ENABLED(CONFIG_RESCTRL_ASSIGN_FIXED)) {
+		ret = -EINVAL;
+		rdt_last_cmd_puts("assign mode is not configurable\n");
+		goto out_unlock;
+	}
+
 	if (!strcmp(buf, "default")) {
 		enable = 0;
 	} else if (!strcmp(buf, "mbm_event")) {

Reinette

Thanks,

Ben

maintainer
#5 lore raw

Hi Ben,

Quoted 16 lines · Ben Horgan
Quoted 9 lines · Reinette Chatre
Quoted 7 lines · Ben Horgan

The commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes") introduced CONFIG_RESCTRL_ASSIGN_FIXED but did not add the kconfig entry. Add this.

Also, take the opportunity ensure that any user attempt to change the assign 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.

Quoted 5 lines

Why *any* attempt? Avoiding delegating to arch seems ok as a goal but this change additionally changes interface with user space. Current behavior when user writes existing mode to the file is to just return success. For example, if current mode is "default" and user writes "default". This patch changes this behavior to fail instead. Is this intended?

Quoted 4 lines

Intended but as you point out, it would be best to accept the current value without error for maximum compatibility between architectures. I'll update the config option help text to reflect this. Was the help text also discussed previously?

It is not clear to me which help text you are referring to. Could you please point me to it?

Reinette

author
#6 lore raw

Hi Reinette,

Quoted 19 lines · Reinette Chatre

Hi Ben,

Quoted 16 lines · Ben Horgan
Quoted 14 lines · Reinette Chatre
Quoted 7 lines · Ben Horgan

The commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes") introduced CONFIG_RESCTRL_ASSIGN_FIXED but did not add the kconfig entry. Add this.

Also, take the opportunity ensure that any user attempt to change the assign 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.

Why *any* attempt? Avoiding delegating to arch seems ok as a goal but this change additionally changes interface with user space. Current behavior when user writes existing mode to the file is to just return success. For example, if current mode is "default" and user writes "default". This patch changes this behavior to fail instead. Is this intended?

Quoted 7 lines
Quoted 4 lines

Intended but as you point out, it would be best to accept the current value without error for maximum compatibility between architectures. I'll update the config option help text to reflect this. Was the help text also discussed previously?

It is not clear to me which help text you are referring to. Could you please point me to it?

I just mean the description in Kconfig. Maybe I'm using the wrong terminology?

From this patch:
help
Enabled by the architecture when the counter assignment mode is not configurable. This ensures that counter assignment is not
advertised as
configurable and configuration attempts fail.

Quoted 2 lines

Reinette

Thanks,

Ben

maintainer
#7 lore raw

Hi Ben,

Quoted 27 lines · Ben Horgan

Hi Reinette,

Quoted 24 lines · Reinette Chatre

Hi Ben,

Quoted 20 lines · Ben Horgan
Quoted 9 lines · Reinette Chatre
Quoted 7 lines · Ben Horgan

The commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes") introduced CONFIG_RESCTRL_ASSIGN_FIXED but did not add the kconfig entry. Add this.

Also, take the opportunity ensure that any user attempt to change the assign 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.

Quoted 5 lines

Why *any* attempt? Avoiding delegating to arch seems ok as a goal but this change additionally changes interface with user space. Current behavior when user writes existing mode to the file is to just return success. For example, if current mode is "default" and user writes "default". This patch changes this behavior to fail instead. Is this intended?

Intended but as you point out, it would be best to accept the current value without error for maximum compatibility between architectures. I'll update the config option help text to reflect this. Was the help text also discussed previously?

Quoted 5 lines
Quoted 2 lines

It is not clear to me which help text you are referring to. Could you please point me to it?

I just mean the description in Kconfig. Maybe I'm using the wrong terminology?

Counter assignment mode is the right terminology and used throughout the resctrl documentation.

Quoted 5 lines

From this patch:
help
Enabled by the architecture when the counter assignment mode is not configurable. This ensures that counter assignment is not

nit: I recommend above "counter assignment" be "counter assignment mode" to be specific that this is about the *mode* being configurable and not talking about the actual counter assignment.

Also please ensure that the formatting adheres to the guidance in "Kconfig configuration files" in Documentation/process/coding-style.rst. Specifically, "help text is indented an additional two spaces".

Quoted 2 lines

advertised as
configurable and configuration attempts fail.

"configuration attempts" -> "attempts to change counter assignment mode"?

As a sidenote, if I understand correctly, MPAM can actually support changing the mode when it is in "free running" mode (when there are enough counters/monitors available). It seems to me these systems *could* advertise something like:

	# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
	[default]
	mbm_event

It is not clear to me if there is a scenario that would benefit from such capability though. I just bring this up to confirm whether CONFIG_RESCTRL_ASSIGN_FIXED is something that MPAM enabling wants to enforce for all platforms?

Reinette

author
#8 lore raw

Hi Reinette,

Quoted 30 lines · Reinette Chatre

Hi Ben,

Quoted 27 lines · Ben Horgan

Hi Reinette,

Quoted 24 lines · Reinette Chatre

Hi Ben,

Quoted 20 lines · Ben Horgan
Quoted 9 lines · Reinette Chatre
Quoted 7 lines · Ben Horgan

The commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes") introduced CONFIG_RESCTRL_ASSIGN_FIXED but did not add the kconfig entry. Add this.

Also, take the opportunity ensure that any user attempt to change the assign 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.

Quoted 5 lines

Why *any* attempt? Avoiding delegating to arch seems ok as a goal but this change additionally changes interface with user space. Current behavior when user writes existing mode to the file is to just return success. For example, if current mode is "default" and user writes "default". This patch changes this behavior to fail instead. Is this intended?

Intended but as you point out, it would be best to accept the current value without error for maximum compatibility between architectures. I'll update the config option help text to reflect this. Was the help text also discussed previously?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

It is not clear to me which help text you are referring to. Could you please point me to it?

I just mean the description in Kconfig. Maybe I'm using the wrong terminology?

Counter assignment mode is the right terminology and used throughout the resctrl documentation.

Ack.

Quoted 7 lines
Quoted 6 lines

From this patch:
help
Enabled by the architecture when the counter assignment mode is not configurable. This ensures that counter assignment is not

Quoted 7 lines

nit: I recommend above "counter assignment" be "counter assignment mode" to be specific that this is about the *mode* being configurable and not talking about the actual counter assignment.

Also please ensure that the formatting adheres to the guidance in "Kconfig configuration files" in Documentation/process/coding-style.rst. Specifically, "help text is indented an additional two spaces".

Will do.

Quoted 5 lines
Quoted 3 lines

advertised as
configurable and configuration attempts fail.

"configuration attempts" -> "attempts to change counter assignment mode"?

Sure.

Quoted 5 lines

As a sidenote, if I understand correctly, MPAM can actually support changing the mode when it is in "free running" mode (when there are enough counters/monitors available). It seems to me these systems *could* advertise something like:

Quoted 7 lines
	# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
	[default]
	mbm_event

It is not clear to me if there is a scenario that would benefit from such capability though. I just bring this up to confirm whether CONFIG_RESCTRL_ASSIGN_FIXED is something that MPAM enabling wants to enforce for all platforms?

On a platform with sufficient monitors to have one per rmid idx (num_partid * num_pmg) it would be architecturally possible to use either mode but the policy decision is that the driver will always decides which mode to use at probe based on whether there are sufficient monitors or not. Hence, we want to enforce CONFIG_RESCTRL_ASSIGN_FIXED for all platforms.

Quoted 2 lines

Reinette

Thanks,

Ben