Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers: base: cacheinfo: Ensure cpu hotplug work is done before Intel RDT

The cacheinfo structures are alloced/freed by cpu online/offline
callbacks. Originally these were only used by sysfs to expose the
cache topology to user space. Without any in-kernel dependencies
CPUHP_AP_ONLINE_DYN was an appropriate choice.

resctrl has started using these structures to identify CPUs that
share a cache. It updates its 'domain' structures from cpu
online/offline callbacks. These depend on the cacheinfo structures
(resctrl_online_cpu()->domain_add_cpu()->get_cache_id()->
get_cpu_cacheinfo()).
These also run as CPUHP_AP_ONLINE_DYN.

Now that there is an in-kernel dependency, move the cacheinfo
work earlier so we know its done before resctrl's CPUHP_AP_ONLINE_DYN
work runs.

Fixes: 2264d9c74dda1 ("x86/intel_rdt: Build structures for each resource based on cache topology")
Cc: <stable@vger.kernel.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: James Morse <james.morse@arm.com>
Link: https://lore.kernel.org/r/20190624173656.202407-1-james.morse@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

James Morse and committed by
Greg Kroah-Hartman
83b44fe3 0fd33116

+3 -1
+2 -1
drivers/base/cacheinfo.c
··· 655 655 656 656 static int __init cacheinfo_sysfs_init(void) 657 657 { 658 - return cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "base/cacheinfo:online", 658 + return cpuhp_setup_state(CPUHP_AP_BASE_CACHEINFO_ONLINE, 659 + "base/cacheinfo:online", 659 660 cacheinfo_cpu_online, cacheinfo_cpu_pre_down); 660 661 } 661 662 device_initcall(cacheinfo_sysfs_init);
+1
include/linux/cpuhotplug.h
··· 175 175 CPUHP_AP_WATCHDOG_ONLINE, 176 176 CPUHP_AP_WORKQUEUE_ONLINE, 177 177 CPUHP_AP_RCUTREE_ONLINE, 178 + CPUHP_AP_BASE_CACHEINFO_ONLINE, 178 179 CPUHP_AP_ONLINE_DYN, 179 180 CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, 180 181 CPUHP_AP_X86_HPET_ONLINE,