fs/resctrl: Add missing kconfig entry for CONFIG_RESCTRL_ASSIGN_FIXED
PATCH v2 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 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.
---
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(+)
fs/resctrl/Kconfig +9 -0
@@ -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.
fs/resctrl/monitor.c +6 -0
@@ -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;
Signature · 1 line
2.43.0
Reinette Chatre
maintainerHi Ben,
I just have a couple of comments regarding style.
Subject can be shortened by removing redundant words:
fs/resctrl: Add CONFIG_RESCTRL_ASSIGN_FIXED Kconfig entry
Please note the kconfig -> Kconfig change for rest of changelog also.
Quoted 2 lines · Ben Horgan
The commit
3b497c3f4f04("fs/resctrl: Introduce the interface to display monitoring modes") introducedCONFIG_RESCTRL_ASSIGN_FIXEDbut left adding
In x86 area there is a custom how to make references to a commit stand out in the changelog. Please see commit a121798ae669 ("x86/resctrl: Fix allocation of cleanest CLOSID on platforms with no monitors") for an example.
Quoted 1 line
the kconfig entry until it was necessary. Add the kconfig entry as it is
Note the kconfig -> Kconfig and please split the context from the solution (see "Changelog" in Documentation/process/maintainer-tip.rst for reference).
Quoted 1 line
now necessary in order to support ABMC on MPAM where the counter assignment
ABMC is name of AMD's feature. MPAM need not adopt AMD's feature name. On resctrl fs side it is just a generic "counter assignment" or "mbm_event" mode.
Quoted 6 lines
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.
This can be connected to the change to not make it seem like an afterthought nor contain trigger word ("Also, ...") that hints this is a logical change that belongs in separate patch. Finally, the "let the user know ..." is not necessary since it can be seen from the patch self.
Here is an example that addresses above notes but please consider it critically and do not just copy&paste without reading and considering corrections and improvement:
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 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.
Quoted 36 lines
Signed-off-by Ben Horgan <[email protected]>---
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.Kconfigindenting.
Use "counter assignment mode" text throughout.--- fs/resctrl/Kconfig | 9 +++++++++ fs/resctrl/monitor.c | 6 ++++++ 2 files changed, 15 insertions(+)fs/resctrl/Kconfig +9
-0@@ -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.fs/resctrl/monitor.c +0
-0
fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1456
Quoted 6 lines
fs/resctrl/monitor.c +3
-0@@ -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" );
Please start output to user space with upper case (unless it is a term that is usually written with lower case). You can use "grep rdt_last_cmd_puts fs/resctrl/*" to get an idea if the patterns used.
fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1462
Quoted 6 lines
fs/resctrl/monitor.c +3
-0+ goto out_unlock; + } + ret =resctrl_arch_mbm_cntr_assign_set (r, enable);if (ret) goto out_unlock;
Reinette
Hi Reinette,
Quoted 6 lines · Reinette Chatre
Hi Ben,
I just have a couple of comments regarding style.
Subject can be shortened by removing redundant words:
fs/resctrl: AddCONFIG_RESCTRL_ASSIGN_FIXEDKconfigentry
Ok, I'll update to this.
Quoted 28 lines
Please note the kconfig ->
Kconfigchange for rest of changelog also.Quoted 2 lines · Ben Horgan
The commit
3b497c3f4f04("fs/resctrl: Introduce the interface to display monitoring modes") introducedCONFIG_RESCTRL_ASSIGN_FIXEDbut left addingIn x86 area there is a custom how to make references to a commit stand out in the changelog. Please see commit
a121798ae669("x86/resctrl: Fix allocation of cleanest CLOSID on platforms with no monitors") for an example.Quoted 1 line
the kconfig entry until it was necessary. Add the kconfig entry as it is
Note the kconfig ->
Kconfigand please split the context from the solution (see "Changelog" inDocumentation/process/maintainer-tip.rstfor reference).Quoted 1 line
now necessary in order to support ABMC on MPAM where the counter assignment
ABMC is name of AMD's feature. MPAM need not adopt AMD's feature name. On resctrl fs side it is just a generic "counter assignment" or "
mbm_event" mode.Quoted 6 lines
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.
Quoted 5 lines
This can be connected to the change to not make it seem like an afterthought nor contain trigger word ("Also, ...") that hints this is a logical change that belongs in separate patch. Finally, the "let the user know ..." is not necessary since it can be seen from the patch self.
Quoted 1 line
Here is an example that addresses above notes but please consider it
critically
Quoted 10 lines
and do not just copy&paste without reading and considering corrections and improvement:
Commit
3b497c3f4f04("fs/resctrl: Introduce the interface to display monitoring modes")introduced
CONFIG_RESCTRL_ASSIGN_FIXEDbut left adding theKconfigentry until it was necessary.
Quoted 6 lines
Add
CONFIG_RESCTRL_ASSIGN_FIXEDin order to support MPAM where the counter assignment mode is indeed fixed.
CONFIG_RESCTRL_ASSIGN_FIXEDis a resctrl fsKconfigoption so handle attempts to modify counter assignment mode when it is enabled in resctrl fs rather than delegating to arch specific code.
Based on your comments and having a look at maintainer-tip.rst this seems like a good commit message that matches the commit. So, I'll go with it. Thanks for suggesting it.
Quoted 40 lines
Quoted 40 lines
Signed-off-by Ben Horgan <[email protected]>---
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.Kconfigindenting.
Use "counter assignment mode" text throughout.--- fs/resctrl/Kconfig | 9 +++++++++ fs/resctrl/monitor.c | 6 ++++++ 2 files changed, 15 insertions(+)fs/resctrl/Kconfig +9
-0@@ -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.fs/resctrl/monitor.c +0
-0@@ -1451,6 +1451,12 @@ ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, }
Quoted 7 lines
fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1456
Quoted 4 lines
fs/resctrl/monitor.c +3
-0if (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" );Please start output to user space with upper case (unless it is a term that is usually written with lower case). You can use "grep
rdt_last_cmd_putsfs/resctrl/*" to get an idea if the patterns used.
Yes, it looks better with a capital C.
Quoted 10 lines
fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1462
Quoted 7 lines
fs/resctrl/monitor.c +3
-0+ goto out_unlock; + } + ret =resctrl_arch_mbm_cntr_assign_set (r, enable);if (ret) goto out_unlock;Reinette
Thanks,
Ben