Skip to content

Commit 373af4e

Browse files
James Morsebp3tk0v
authored andcommitted
x86/resctrl: Move RFTYPE flags to be managed by resctrl
resctrl_file_fflags_init() is called from the architecture specific code to make the 'thread_throttle_mode' file visible. The architecture specific code has already set the membw.throttle_mode in the rdt_resource. This forces the RFTYPE flags used by resctrl to be exposed to the architecture specific code. This doesn't need to be specific to the architecture, the throttle_mode can be used by resctrl to determine if the 'thread_throttle_mode' file should be visible. This allows the RFTYPE flags to be private to resctrl. Add thread_throttle_mode_init(), and use it to call resctrl_file_fflags_init() from resctrl_init(). This avoids publishing an extra function between the architecture and filesystem code. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reviewed-by: Fenghua Yu <fenghuay@nvidia.com> Reviewed-by: Babu Moger <babu.moger@amd.com> Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Peter Newman <peternewman@google.com> Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Amit Singh Tomar <amitsinght@marvell.com> # arm64 Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> # arm64 Tested-by: Babu Moger <babu.moger@amd.com> Link: https://lore.kernel.org/r/20250311183715.16445-28-james.morse@arm.com
1 parent 4cf9acf commit 373af4e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

arch/x86/kernel/cpu/resctrl/core.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,6 @@ static __init bool __get_mem_config_intel(struct rdt_resource *r)
227227
else
228228
r->membw.throttle_mode = THREAD_THROTTLE_MAX;
229229

230-
resctrl_file_fflags_init("thread_throttle_mode",
231-
RFTYPE_CTRL_INFO | RFTYPE_RES_MB);
232-
233230
r->alloc_capable = true;
234231

235232
return true;

arch/x86/kernel/cpu/resctrl/rdtgroup.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,6 +2064,16 @@ static struct rftype *rdtgroup_get_rftype_by_name(const char *name)
20642064
return NULL;
20652065
}
20662066

2067+
static void thread_throttle_mode_init(void)
2068+
{
2069+
struct rdt_resource *r_mba;
2070+
2071+
r_mba = resctrl_arch_get_resource(RDT_RESOURCE_MBA);
2072+
if (r_mba->membw.throttle_mode != THREAD_THROTTLE_UNDEFINED)
2073+
resctrl_file_fflags_init("thread_throttle_mode",
2074+
RFTYPE_CTRL_INFO | RFTYPE_RES_MB);
2075+
}
2076+
20672077
void resctrl_file_fflags_init(const char *config, unsigned long fflags)
20682078
{
20692079
struct rftype *rft;
@@ -4277,6 +4287,8 @@ int __init resctrl_init(void)
42774287

42784288
rdtgroup_setup_default();
42794289

4290+
thread_throttle_mode_init();
4291+
42804292
ret = resctrl_mon_resource_init();
42814293
if (ret)
42824294
return ret;

0 commit comments

Comments
 (0)