Skip to content

Add CONFIG_PERMANENT_CPU_TOPOLOGY

Prarit Bhargava lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2cpu hotplug, add CONFIG_PERMANENT_CPU_TOPOLOGY and keep topology directory for lifetime of CPUarch/x86/kernel/smpboot.c drivers/base/Kconfig drivers/base/Makefile +2 more+149 -1841 reply
2/2base, cpu, remove hotplugable_cpu_attr_groupsdrivers/base/cpu.c+2 -140 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Add CONFIG_PERMANENT_CPU_TOPOLOGY

The information in /sys/devices/system/cpu/cpuX/topology directory is useful for userspace monitoring applications and in-tree utilities like cpupower & turbostat.

When down'ing a CPU the /sys/devices/system/cpu/cpuX/topology directory is removed during the CPU_DEAD hotplug callback in the kernel. The problem with this model is that the CPU has not been physically removed and the data in the topology directory is still valid.

This patchset adds CONFIG_PERMANENT_CPU_TOPOLOGY, and is Y by default for x86, an N for all other arches. When enabled the kernel is modified so that the topology directory is added to the core cpu sysfs files so that the topology directory exists for the lifetime of the CPU. When disabled, the behavior of the current kernel is maintained (that is, the topology directory is removed on a down and added on an up). Adding CONFIG_PERMANENT_CPU_TOPOLOGY may require additional architecture so that the cpumask data the CPU's topology is not cleared during a CPU down.

This patchset combines drivers/base/topology.c and drivers/base/cpu.c to implement CONFIG_PERMANENT_CPU_TOPOLOGY, and leaves all arches except x86 with the current behavior, and adds an additional minor cleanup to drivers/base/cpu.c.

Before patch:

[root@prarit cpu143]# ls

cache    crash_notes       firmware_node  online     thermal_throttle
cpufreq  crash_notes_size  microcode      power      topology
cpuidle  driver            node3          subsystem  uevent

Down a cpu

[root@prarit cpu143]# echo 0 > online

[root@intel-brickland-05 cpu143]# ls

cpuidle      crash_notes_size  firmware_node  online  subsystem
crash_notes  driver            node3          power   uevent

[root@intel-brickland-05 cpu143]# ls -l topology
ls: cannot access topology: No such file or directory

After patch:

[root@prarit cpu143]# ls

cache    crash_notes       firmware_node  online     thermal_throttle
cpufreq  crash_notes_size  microcode      power      topology
cpuidle  driver            node3          subsystem  uevent

[root@prarit cpu143]# cat topology/*
27
ffff,c0000000,000000ff,ffc00000,00000000
54-71,126-143
3
8000,00000000,00000080,00000000,00000000
71,143

Down a cpu

[root@prarit cpu143]# echo 0 > online
[root@intel-brickland-05 cpu143]# ls

cpuidle      crash_notes_size  firmware_node  online  subsystem  uevent
crash_notes  driver            node3          power   topology

[root@prarit cpu143]# cat topology/*
27
ffff,c0000000,000000ff,ffc00000,00000000
54-71,126-143
3
8000,00000000,00000080,00000000,00000000
71,143

I did some light testing with and without BOOTPARAM_HOTPLUG_CPU0 enabled, and up'd and down'd CPUs in sequence, randomly, by thread group, by socket group and didn't see any issues.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Len Brown <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Zhu Guihua <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc "Jan H. Schönherr" <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc "Paul E. McKenney" <[email protected]>
Cc Thomas Renninger <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

Prarit Bhargava (2):
cpu hotplug, add CONFIG_PERMANENT_CPU_TOPOLOGY and keep topology
directory for lifetime of CPU
base, cpu, remove hotplugable_cpu_attr_groups

 arch/x86/kernel/smpboot.c |   28 --------
 drivers/base/Kconfig      |   13 ++++
 drivers/base/Makefile     |    2 +-
 drivers/base/cpu.c        |  141 ++++++++++++++++++++++++++++++++++++++---
 drivers/base/topology.c   |  155 ---------------------------------------------
 5 files changed, 146 insertions(+), 193 deletions(-)
 delete mode 100644 drivers/base/topology.c
Signature · 1 line
1.7.9.3