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

Configure Feed

Select the types of activity you want to include in your feed.

arch_topology: Fix cache attributes detection in the CPU hotplug path

init_cpu_topology() is called only once at the boot and all the cache
attributes are detected early for all the possible CPUs. However when
the CPUs are hotplugged out, the cacheinfo gets removed. While the
attributes are added back when the CPUs are hotplugged back in as part
of CPU hotplug state machine, it ends up called quite late after the
update_siblings_masks() are called in the secondary_start_kernel()
resulting in wrong llc_sibling_masks.

Move the call to detect_cache_attributes() inside update_siblings_masks()
to ensure the cacheinfo is updated before the LLC sibling masks are
updated. This will fix the incorrect LLC sibling masks generated when
the CPUs are hotplugged out and hotplugged back in again.

Reported-by: Ionela Voinescu <ionela.voinescu@arm.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Ionela Voinescu <ionela.voinescu@arm.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Ionela Voinescu <ionela.voinescu@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20220720-arch_topo_fixes-v3-3-43d696288e84@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sudeep Holla and committed by
Greg Kroah-Hartman
3fcbf1c7 0c80f9e1

+6 -10
+6 -10
drivers/base/arch_topology.c
··· 732 732 void update_siblings_masks(unsigned int cpuid) 733 733 { 734 734 struct cpu_topology *cpu_topo, *cpuid_topo = &cpu_topology[cpuid]; 735 - int cpu; 735 + int cpu, ret; 736 + 737 + ret = detect_cache_attributes(cpuid); 738 + if (ret) 739 + pr_info("Early cacheinfo failed, ret = %d\n", ret); 736 740 737 741 /* update core and thread sibling masks */ 738 742 for_each_online_cpu(cpu) { ··· 825 821 #if defined(CONFIG_ARM64) || defined(CONFIG_RISCV) 826 822 void __init init_cpu_topology(void) 827 823 { 828 - int ret, cpu; 824 + int ret; 829 825 830 826 reset_cpu_topology(); 831 827 ret = parse_acpi_topology(); ··· 839 835 */ 840 836 reset_cpu_topology(); 841 837 return; 842 - } 843 - 844 - for_each_possible_cpu(cpu) { 845 - ret = detect_cache_attributes(cpu); 846 - if (ret) { 847 - pr_info("Early cacheinfo failed, ret = %d\n", ret); 848 - break; 849 - } 850 838 } 851 839 } 852 840 #endif