From: Fenghua Yu <[email protected]> All CPUs in a rdtgroup are given back to the default rdtgroup before the rdtgroup is removed during umount. After umount, the default rdtgroup contains all online CPUs.
cpu_closid needs to be cleared for each cpu in root rdtgroup during umount. Otherwise, PQR_ASSOC will be written to the non-zero value stored in cpu_closid after next mount. Signed-off-by: Fenghua Yu <[email protected]> --- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index cff286e..416b95e 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -801,6 +801,7 @@ static void rmdir_all_sub(void) { struct rdtgroup *rdtgrp, *tmp; struct task_struct *p, *t; + int cpu; /* move all tasks to default resource group */ read_lock(&tasklist_lock); @@ -819,10 +820,19 @@ static void rmdir_all_sub(void) /* Remove each rdtgroup other than root */ if (rdtgrp == &rdtgroup_default) continue; + + /* Give any CPUs back to the default group */ + cpumask_or(&rdtgroup_default.cpu_mask, + &rdtgroup_default.cpu_mask, &rdtgrp->cpu_mask); + kernfs_remove(rdtgrp->kn); list_del(&rdtgrp->rdtgroup_list); kfree(rdtgrp); } + + for_each_cpu(cpu, &rdtgroup_default.cpu_mask) + per_cpu(cpu_closid, cpu) = 0; + kernfs_remove(kn_info); } -- 2.5.0

