Skip to content

Commit 1b3e50c

Browse files
James Morsebp3tk0v
authored andcommitted
x86/resctrl: Add CPU online callback for resctrl work
The resctrl architecture specific code may need to create a domain when a CPU comes online, it also needs to reset the CPUs PQR_ASSOC register. The resctrl filesystem code needs to update the rdtgroup_default CPU mask when CPUs are brought online. Currently, this is all done in one function, resctrl_online_cpu(). It will need to be split into architecture and filesystem parts before resctrl can be moved to /fs/. Pull the rdtgroup_default update work out as a filesystem specific cpu_online helper. resctrl_online_cpu() is the obvious name for this, which means the version in core.c needs renaming. resctrl_online_cpu() is called by the arch code once it has done the work to add the new CPU to any domains. In future patches, resctrl_online_cpu() will take the rdtgroup_mutex itself. Signed-off-by: James Morse <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Shaopeng Tan <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Reviewed-by: Babu Moger <[email protected]> Tested-by: Shaopeng Tan <[email protected]> Tested-by: Peter Newman <[email protected]> Tested-by: Babu Moger <[email protected]> Tested-by: Carl Worth <[email protected]> # arm64 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Borislav Petkov (AMD) <[email protected]>
1 parent 30017b6 commit 1b3e50c

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,16 +606,16 @@ static void clear_closid_rmid(int cpu)
606606
RESCTRL_RESERVED_CLOSID);
607607
}
608608

609-
static int resctrl_online_cpu(unsigned int cpu)
609+
static int resctrl_arch_online_cpu(unsigned int cpu)
610610
{
611611
struct rdt_resource *r;
612612

613613
mutex_lock(&rdtgroup_mutex);
614614
for_each_capable_rdt_resource(r)
615615
domain_add_cpu(cpu, r);
616-
/* The cpu is set in default rdtgroup after online. */
617-
cpumask_set_cpu(cpu, &rdtgroup_default.cpu_mask);
618616
clear_closid_rmid(cpu);
617+
618+
resctrl_online_cpu(cpu);
619619
mutex_unlock(&rdtgroup_mutex);
620620

621621
return 0;
@@ -967,7 +967,7 @@ static int __init resctrl_late_init(void)
967967

968968
state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
969969
"x86/resctrl/cat:online:",
970-
resctrl_online_cpu, resctrl_offline_cpu);
970+
resctrl_arch_online_cpu, resctrl_offline_cpu);
971971
if (state < 0)
972972
return state;
973973

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4007,6 +4007,14 @@ int resctrl_online_domain(struct rdt_resource *r, struct rdt_domain *d)
40074007
return 0;
40084008
}
40094009

4010+
void resctrl_online_cpu(unsigned int cpu)
4011+
{
4012+
lockdep_assert_held(&rdtgroup_mutex);
4013+
4014+
/* The CPU is set in default rdtgroup after online. */
4015+
cpumask_set_cpu(cpu, &rdtgroup_default.cpu_mask);
4016+
}
4017+
40104018
/*
40114019
* rdtgroup_init - rdtgroup initialization
40124020
*

include/linux/resctrl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
223223
u32 closid, enum resctrl_conf_type type);
224224
int resctrl_online_domain(struct rdt_resource *r, struct rdt_domain *d);
225225
void resctrl_offline_domain(struct rdt_resource *r, struct rdt_domain *d);
226+
void resctrl_online_cpu(unsigned int cpu);
226227

227228
/**
228229
* resctrl_arch_rmid_read() - Read the eventid counter corresponding to rmid

0 commit comments

Comments
 (0)