Skip to content

Commit eeff1d4

Browse files
James Morsebp3tk0v
authored andcommitted
x86/resctrl: Move domain helper migration into resctrl_offline_cpu()
When a CPU is taken offline the resctrl filesystem code needs to check if it was the CPU nominated to perform the periodic overflow and limbo work. If so, another CPU needs to be chosen to do this work. This is currently done in core.c, mixed in with the code that removes the CPU from the domain's mask, and potentially free()s the domain. Move the migration of the overflow and limbo helpers into the filesystem code, into resctrl_offline_cpu(). As resctrl_offline_cpu() runs before the architecture code has removed the CPU from the domain mask, the callers need to be told which CPU is being removed, to avoid picking it as the new CPU. This uses the exclude_cpu feature previously added. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Shaopeng Tan <tan.shaopeng@fujitsu.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reviewed-by: Babu Moger <babu.moger@amd.com> Tested-by: Shaopeng Tan <tan.shaopeng@fujitsu.com> Tested-by: Peter Newman <peternewman@google.com> Tested-by: Babu Moger <babu.moger@amd.com> Tested-by: Carl Worth <carl@os.amperecomputing.com> # arm64 Link: https://lore.kernel.org/r/20240213184438.16675-24-james.morse@arm.com Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
1 parent 258c91e commit eeff1d4

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -580,22 +580,6 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
580580

581581
return;
582582
}
583-
584-
if (r == &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl) {
585-
if (is_mbm_enabled() && cpu == d->mbm_work_cpu) {
586-
cancel_delayed_work(&d->mbm_over);
587-
/*
588-
* temporary: exclude_cpu=-1 as this CPU has already
589-
* been removed by cpumask_clear_cpu()d
590-
*/
591-
mbm_setup_overflow_handler(d, 0, RESCTRL_PICK_ANY_CPU);
592-
}
593-
if (is_llc_occupancy_enabled() && cpu == d->cqm_work_cpu &&
594-
has_busy_rmid(d)) {
595-
cancel_delayed_work(&d->cqm_limbo);
596-
cqm_setup_limbo_handler(d, 0, RESCTRL_PICK_ANY_CPU);
597-
}
598-
}
599583
}
600584

601585
static void clear_closid_rmid(int cpu)

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4029,7 +4029,9 @@ static void clear_childcpus(struct rdtgroup *r, unsigned int cpu)
40294029

40304030
void resctrl_offline_cpu(unsigned int cpu)
40314031
{
4032+
struct rdt_resource *l3 = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl;
40324033
struct rdtgroup *rdtgrp;
4034+
struct rdt_domain *d;
40334035

40344036
lockdep_assert_held(&rdtgroup_mutex);
40354037

@@ -4039,6 +4041,22 @@ void resctrl_offline_cpu(unsigned int cpu)
40394041
break;
40404042
}
40414043
}
4044+
4045+
if (!l3->mon_capable)
4046+
return;
4047+
4048+
d = get_domain_from_cpu(cpu, l3);
4049+
if (d) {
4050+
if (is_mbm_enabled() && cpu == d->mbm_work_cpu) {
4051+
cancel_delayed_work(&d->mbm_over);
4052+
mbm_setup_overflow_handler(d, 0, cpu);
4053+
}
4054+
if (is_llc_occupancy_enabled() && cpu == d->cqm_work_cpu &&
4055+
has_busy_rmid(d)) {
4056+
cancel_delayed_work(&d->cqm_limbo);
4057+
cqm_setup_limbo_handler(d, 0, cpu);
4058+
}
4059+
}
40424060
}
40434061

40444062
/*

0 commit comments

Comments
 (0)