fs/resctrl: Add CONFIG_RESCTRL_ASSIGN_FIXED Kconfig entry
PATCH v4 1/1 fs/resctrl: Add CONFIG_RESCTRL_ASSIGN_FIXED Kconfig entry
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.
---
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 succinct - was
"fs/resctrl: Add missing kconfig entry for CONFIG_RESCTRL_ASSIGN_FIXED"
Tidy changelog
Changes since v3:
Add middle paragraph in changelog
--- 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
+ x86 Maintainers
Hi Ben,
Quoted 10 lines · Ben Horgan
Commit
3b497c3f4f04("fs/resctrl: Introduce the interface to display monitoring modes")introduced
CONFIG_RESCTRL_ASSIGN_FIXEDbut left adding theKconfigentry until it was necessary.Add
CONFIG_RESCTRL_ASSIGN_FIXEDin order to support MPAM where the counter assignment mode is indeed fixed.
Quoted 6 lines
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.Signed-off-by Ben Horgan <[email protected]>---
Thank you.
Reinette
fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1454
Quoted 9 lines · Ben Horgan
fs/resctrl/monitor.c +1
-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 )) {
Does it need to be a Kconfig entry or you can figure out programatically from the architecture that that is the case and avoid yet another CONFIG_ knob?
From reading this, I'm thinking
if (IS ARM64) {should do or...?
Quoted 8 lines
fs/resctrl/monitor.c +5
-0+ 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 · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteHi Boris,
Quoted 14 lines · Borislav Petkov
fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1454
Quoted 9 lines · Ben Horgan
fs/resctrl/monitor.c +1
-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 )) {Does it need to be a
Kconfigentry or you can figure out programatically from the architecture that that is the case and avoid yet anotherCONFIG_knob?
Quoted 5 lines
From reading this, I'm thinking
if (IS ARM64) {should do or...?
Yes, we don't necessarily need the Kconfig and we don't necessarily need this condition at all in resctrl_mbm_assign_mode_write(), we do need the existing one in resctrl_mbm_assign_mode_show() though.
The Kconfig was effectively added in:
commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes")
and I was just filling in the missing piece. Most arch specific things in resctrl seem to be dealt with using resctrl_arch_* hooks. Would it be preferable to create a new one of these? It could be resctrl_arch_mbm_cntr_assign_fixed() although we seem to be getting too many of these too. Perhaps we could extend the meaning of another hook, resctrl_arch_mbm_assign_set() could return -EOPNOTSUPP to indicate to resctrl that the counter assignment mode is not configurable.
Quoted 10 lines
fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1462
Quoted 9 lines
fs/resctrl/monitor.c +5
-0+ 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;
Thanks,
Ben
Reinette Chatre
maintainerHi Ben,
Quoted 17 lines · Ben Horgan
Hi Boris,
Quoted 14 lines · Borislav Petkov
fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1454
Quoted 9 lines · Ben Horgan
fs/resctrl/monitor.c +1
-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 )) {Does it need to be a
Kconfigentry or you can figure out programatically from the architecture that that is the case and avoid yet anotherCONFIG_knob?
Quoted 8 lines
Quoted 5 lines
From reading this, I'm thinking
if (IS ARM64) {should do or...?
Yes, we don't necessarily need the
Kconfigand we don't necessarily need this condition at all inresctrl_mbm_assign_mode_write(), we do need the existing one inresctrl_mbm_assign_mode_show()though.
It is not obvious to me why the one in resctrl_mbm_assign_mode_show() is required if a new arch helper could suffice in other parts
Quoted 7 lines
The
Kconfigwas effectively added in:commit
3b497c3f4f04("fs/resctrl: Introduce the interface to display monitoring modes")and I was just filling in the missing piece. Most arch specific things in resctrl seem to be dealt with using resctrl_arch_* hooks. Would it be preferable to create a new one of these?
It looks to me as though this patch fits in with the other series you posted at
https://lore.kernel.org/lkml/[email protected]/
When looking at this patch together with the other series there may indeed be an arch helper that can replace CONFIG_RESCTRL_ASSIGN_FIXED but as I mentioned in that series the MPAM capabilities and strategies for resctrl to support them are not clear to me at this time.
Quoted 2 lines
It could be
resctrl_arch_mbm_cntr_assign_fixed()although we seem to be getting too many of these too. Perhaps we could extend the meaning of another hook,resctrl_arch_mbm_assign_set()could
Could you please elaborate which category of helper is getting to be too many? We can surely explore improvements.
Quoted 2 lines
return
-EOPNOTSUPPto indicate to resctrl that the counter assignment mode is not configurable.
Reinette
Hi Reinette,
Quoted 24 lines · Reinette Chatre
Hi Ben,
Quoted 21 lines · Ben Horgan
Hi Boris,
Quoted 18 lines · Borislav Petkov
fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1454
Quoted 9 lines · Ben Horgan
fs/resctrl/monitor.c +1
-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 )) {Does it need to be a
Kconfigentry or you can figure out programatically from the architecture that that is the case and avoid yet anotherCONFIG_knob?From reading this, I'm thinking
if (IS ARM64) {
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
should do or...?
Yes, we don't necessarily need the
Kconfigand we don't necessarily need this condition at all inresctrl_mbm_assign_mode_write(), we do need the existing one inresctrl_mbm_assign_mode_show()though.It is not obvious to me why the one in
resctrl_mbm_assign_mode_show()is required if a new arch helper could suffice in other parts
I think a new arch helper could cover both.
Quoted 9 lines
Quoted 8 lines
The
Kconfigwas effectively added in:commit
3b497c3f4f04("fs/resctrl: Introduce the interface to display monitoring modes")and I was just filling in the missing piece. Most arch specific things in resctrl seem to be dealt with using resctrl_arch_* hooks. Would it be preferable to create a new one of these?
Quoted 7 lines
It looks to me as though this patch fits in with the other series you posted at
https://lore.kernel.org/lkml/[email protected]/When looking at this patch together with the other series there may indeed be an arch helper that can replace
CONFIG_RESCTRL_ASSIGN_FIXEDbut as I mentioned in that series the MPAM capabilities and strategies for resctrl to support them are not clear to me at this time.
If you like, I can drop this patch and tag a resctrl_arch_ hook based hook version on to that series when I respin. Do you prefer a new hook, resctrl_arch_mbm_cntr_assign_fixed(), or using/abusing the error return of resctrl_arch_mbm_assign_set()?
Quoted 7 lines
Quoted 4 lines
It could be
resctrl_arch_mbm_cntr_assign_fixed()although we seem to be getting too many of these too. Perhaps we could extend the meaning of another hook,resctrl_arch_mbm_assign_set()couldCould you please elaborate which category of helper is getting to be too many? We can surely explore improvements.
Nothing major or anything that necessarily needs to change. Just that for each new feature we get a few new resctrl_arch_* and they all need to be updated in the MPAM driver even if the feature isn't used.
Quoted 6 lines
Quoted 3 lines
return
-EOPNOTSUPPto indicate to resctrl that the counter assignment mode is not configurable.Reinette
Thanks,
Ben
Reinette Chatre
maintainerHi Ben,
Quoted 54 lines · Ben Horgan
Hi Reinette,
Quoted 24 lines · Reinette Chatre
Hi Ben,
Quoted 21 lines · Ben Horgan
Hi Boris,
Quoted 18 lines · Borislav Petkov
fs/resctrl/monitor.c ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf, · line 1454
Quoted 9 lines · Ben Horgan
fs/resctrl/monitor.c +1
-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 )) {Does it need to be a
Kconfigentry or you can figure out programatically from the architecture that that is the case and avoid yet anotherCONFIG_knob?From reading this, I'm thinking
if (IS ARM64) {Quoted 7 lines
Quoted 4 lines
Quoted 1 line
should do or...?
Yes, we don't necessarily need the
Kconfigand we don't necessarily need this condition at all inresctrl_mbm_assign_mode_write(), we do need the existing one inresctrl_mbm_assign_mode_show()though.It is not obvious to me why the one in
resctrl_mbm_assign_mode_show()is required if a new arch helper could suffice in other partsI think a new arch helper could cover both.
Quoted 9 lines
Quoted 8 lines
The
Kconfigwas effectively added in:commit
3b497c3f4f04("fs/resctrl: Introduce the interface to display monitoring modes")and I was just filling in the missing piece. Most arch specific things in resctrl seem to be dealt with using resctrl_arch_* hooks. Would it be preferable to create a new one of these?
Quoted 7 lines
It looks to me as though this patch fits in with the other series you posted at
https://lore.kernel.org/lkml/[email protected]/When looking at this patch together with the other series there may indeed be an arch helper that can replace
CONFIG_RESCTRL_ASSIGN_FIXEDbut as I mentioned in that series the MPAM capabilities and strategies for resctrl to support them are not clear to me at this time.
Quoted 4 lines
If you like, I can drop this patch and tag a
resctrl_arch_hook based hook version on to that series when I respin. Do you prefer a new hook,resctrl_arch_mbm_cntr_assign_fixed(), or using/abusing the error return ofresctrl_arch_mbm_assign_set()?
I am now focusing on understanding the MPAM requirements around assignable counters that are being discussed as part of the other series you sent recently. Without that insight it is difficult to have preference for an interface.
I do think it will be helpful to keep this work together in one series.
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
It could be
resctrl_arch_mbm_cntr_assign_fixed()although we seem to be getting too many of these too. Perhaps we could extend the meaning of another hook,resctrl_arch_mbm_assign_set()couldCould you please elaborate which category of helper is getting to be too many? We can surely explore improvements.
Nothing major or anything that necessarily needs to change. Just that for each new feature we get a few new resctrl_arch_* and they all need to be updated in the MPAM driver even if the feature isn't used.
I see. These helpers evolved as part of the arch fs split. One option may be to have an arch register callbacks instead that resctrl fs could test for existence and not require every arch to have a stub.
Reinette