Skip to content

Commit 2937f9c

Browse files
babumogerbp3tk0v
authored andcommitted
x86/resctrl: Introduce resctrl_file_fflags_init() to initialize fflags
thread_throttle_mode_init() and mbm_config_rftype_init() both initialize fflags for resctrl files. Adding new files will involve adding another function to initialize the fflags. This can be simplified by adding a new function resctrl_file_fflags_init() and passing the file name and flags to be initialized. Consolidate fflags initialization into resctrl_file_fflags_init() and remove thread_throttle_mode_init() and mbm_config_rftype_init(). [ Tony: Drop __init attribute so resctrl_file_fflags_init() can be used at run time. ] Signed-off-by: Babu Moger <[email protected]> Signed-off-by: Tony Luck <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 135eef3 commit 2937f9c

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ static __init bool __get_mem_config_intel(struct rdt_resource *r)
234234
r->membw.throttle_mode = THREAD_THROTTLE_PER_THREAD;
235235
else
236236
r->membw.throttle_mode = THREAD_THROTTLE_MAX;
237-
thread_throttle_mode_init();
237+
238+
resctrl_file_fflags_init("thread_throttle_mode",
239+
RFTYPE_CTRL_INFO | RFTYPE_RES_MB);
238240

239241
r->alloc_capable = true;
240242

arch/x86/kernel/cpu/resctrl/internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,7 @@ void cqm_handle_limbo(struct work_struct *work);
647647
bool has_busy_rmid(struct rdt_mon_domain *d);
648648
void __check_limbo(struct rdt_mon_domain *d, bool force_free);
649649
void rdt_domain_reconfigure_cdp(struct rdt_resource *r);
650-
void __init thread_throttle_mode_init(void);
651-
void __init mbm_config_rftype_init(const char *config);
650+
void resctrl_file_fflags_init(const char *config, unsigned long fflags);
652651
void rdt_staged_configs_clear(void);
653652
bool closid_allocated(unsigned int closid);
654653
int resctrl_find_cleanest_closid(void);

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,11 +1224,13 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)
12241224

12251225
if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) {
12261226
mbm_total_event.configurable = true;
1227-
mbm_config_rftype_init("mbm_total_bytes_config");
1227+
resctrl_file_fflags_init("mbm_total_bytes_config",
1228+
RFTYPE_MON_INFO | RFTYPE_RES_CACHE);
12281229
}
12291230
if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) {
12301231
mbm_local_event.configurable = true;
1231-
mbm_config_rftype_init("mbm_local_bytes_config");
1232+
resctrl_file_fflags_init("mbm_local_bytes_config",
1233+
RFTYPE_MON_INFO | RFTYPE_RES_CACHE);
12321234
}
12331235
}
12341236

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,24 +2020,13 @@ static struct rftype *rdtgroup_get_rftype_by_name(const char *name)
20202020
return NULL;
20212021
}
20222022

2023-
void __init thread_throttle_mode_init(void)
2024-
{
2025-
struct rftype *rft;
2026-
2027-
rft = rdtgroup_get_rftype_by_name("thread_throttle_mode");
2028-
if (!rft)
2029-
return;
2030-
2031-
rft->fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB;
2032-
}
2033-
2034-
void __init mbm_config_rftype_init(const char *config)
2023+
void resctrl_file_fflags_init(const char *config, unsigned long fflags)
20352024
{
20362025
struct rftype *rft;
20372026

20382027
rft = rdtgroup_get_rftype_by_name(config);
20392028
if (rft)
2040-
rft->fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE;
2029+
rft->fflags = fflags;
20412030
}
20422031

20432032
/**

0 commit comments

Comments
 (0)