Skip to content

Introduce cpu_enabled_map and friends

Alex Chiang linux-acpi linux-arch linux-ia64 lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14Introduce cpu_enabled_map and friendsdrivers/base/cpu.c include/linux/cpumask.h init/main.c +1 more+44 -1310 replies
2/14Populate cpu_enabled_maparch/m32r/kernel/smpboot.c include/asm-m32r/smp.h+2 -00 replies
3/14Populate cpu_enabled_maparch/alpha/kernel/process.c arch/alpha/kernel/smp.c+4 -00 replies
4/14Populate cpu_enabled_maparch/arm/mach-realview/platsmp.c+3 -10 replies
5/14Populate cpu_enabled_maparch/mips/kernel/smp.c arch/mips/kernel/smtc.c+2 -00 replies
6/14Populate cpu_enabled_maparch/parisc/kernel/processor.c arch/parisc/kernel/smp.c+4 -00 replies
7/14Populate cpu_enabled_maparch/powerpc/kernel/setup-common.c arch/powerpc/platforms/powermac/smp.c arch/powerpc/platforms/pseries/hotplug-cpu.c+4 -02 replies
8/14Populate cpu_enabled_maparch/s390/kernel/smp.c+6 -10 replies
9/14Populate cpu_enabled_maparch/sh/kernel/smp.c+1 -00 replies
10/14Populate cpu_enabled_maparch/sparc/kernel/smp.c arch/sparc64/kernel/mdesc.c arch/sparc64/kernel/smp.c+3 -00 replies
11/14x86: Populate cpu_enabled_maparch/x86/kernel/acpi/boot.c arch/x86/kernel/apic_32.c arch/x86/kernel/apic_64.c +3 more+12 -22 replies
12/14Populate and use cpu_enabled_maparch/ia64/kernel/acpi.c arch/ia64/kernel/smpboot.c include/asm-ia64/smp.h+17 -70 replies
13/14Avoid overflowing ia64_cpu_to_sapicid in acpi_map_lsapic()arch/ia64/kernel/acpi.c+2 -30 replies
14/14ACPI: Provide /sys/devices/system/cpu/cpuN/deconfiguredrivers/acpi/Kconfig drivers/acpi/Makefile drivers/acpi/processor_core.c +2 more+311 -02 replies

Reviews trailers per patch

1 of 14 patches has a Reviewed-by or Acked-by.

PatchH. Peter Anvin
1/14
2/14
3/14
4/14
5/14
6/14
7/14
8/14
9/14
10/14
11/14A-b
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/14] Introduce cpu_enabled_map and friends

The following series presents cpu_enabled_map, which captures the concept of a physically present and enabled CPU.

The complement of this map gives us present but disabled CPUs. Perhaps the CPU was disabled by firmware for whatever reason.

For the most part, cpu_enabled_map will follow cpu_present_map. On x86 and ia64, ACPI can tell us if a CPU is present, enabled, or both. On those two archs, cpu_enabled_map is a subset of cpu_present_map. All CPUs described in the MADT are now added to cpu_present_map, but only ones with ACPI_MADT_ENABLED are added to cpu_enabled_map.

Other archs may wish to do something similar, so some minimum levels of support are included with this patch series, enabling others to fill things in as desired. I certainly acknowledge that a better job could be done.

Patch 01 introduces the actual map and interface.

Patches 02 -- 12 modify arch code in an attempt to populate the map correctly.

Patch 12 is the most interesting one, in that we actually demonstrate how an arch [ia64] would actually use cpu_enabled_map to control calling cpu_up() on a given CPU.

Patch 13 fixes a potential overflow bug in ia64 ACPI code.

Patch 14 is the money patch. It demonstrates why we might want to go through all these gyrations. Now that ia64 presents *all* physically present CPUs in sysfs, even if they have been disabled by firmware, we give userspace a way to poke at those CPUs.

This is possible because present CPUs are in the ACPI namespace. Even though we might not have a valid per_cpu pointer for a disabled CPU (because we never called cpu_up() on it), we can still obtain a valid ACPI handle for that CPU by walking the namespace and executing methods underneath it.

The big picture implication is that we can allow userspace to interact with disabled CPUs. In this particular example, we provide a knob that lets a sysadmin schedule any present CPU for firmware deconfiguration or enablement.

I have compile tested on:

- arm, sparc, powerpc, alpha, x86, and ia64

I have boot tested on x86 and ia64

None of my x86 platforms have firmware support for disabling CPUs, but my ia64 ones do, so that's where I've done my most extensive testing.

Thanks.

/ac

---

Alex Chiang (14):
ACPI: Provide /sys/devices/system/cpu/cpuN/deconfigure [IA64] Avoid overflowing ia64_cpu_to_sapicid in acpi_map_lsapic() [IA64] Populate and use cpu_enabled_map
x86: Populate cpu_enabled_map
[SPARC] Populate cpu_enabled_map
[SH] Populate cpu_enabled_map
[S390] Populate cpu_enabled_map
[POWERPC] Populate cpu_enabled_map
[PARISC] Populate cpu_enabled_map
[MIPS] Populate cpu_enabled_map
[ARM] Populate cpu_enabled_map
[ALPHA] Populate cpu_enabled_map
[M32R] Populate cpu_enabled_map
Introduce cpu_enabled_map and friends

 arch/alpha/kernel/process.c                  |    2 
 arch/alpha/kernel/smp.c                      |    2 
 arch/arm/mach-realview/platsmp.c             |    4 
 arch/ia64/kernel/acpi.c                      |   21 +-
 arch/ia64/kernel/smpboot.c                   |    7 +
 arch/m32r/kernel/smpboot.c                   |    1 
 arch/mips/kernel/smp.c                       |    1 
 arch/mips/kernel/smtc.c                      |    1 
 arch/parisc/kernel/processor.c               |    1 
 arch/parisc/kernel/smp.c                     |    3 
 arch/powerpc/kernel/setup-common.c           |    1 
 arch/powerpc/platforms/powermac/smp.c        |    1 
 arch/powerpc/platforms/pseries/hotplug-cpu.c |    2 
 arch/s390/kernel/smp.c                       |    7 +
 arch/sh/kernel/smp.c                         |    1 
 arch/sparc/kernel/smp.c                      |    1 
 arch/sparc64/kernel/mdesc.c                  |    1 
 arch/sparc64/kernel/smp.c                    |    1 
 arch/x86/kernel/acpi/boot.c                  |    7 -
 arch/x86/kernel/apic_32.c                    |    1 
 arch/x86/kernel/apic_64.c                    |    1 
 arch/x86/kernel/smpboot.c                    |    2 
 arch/x86/mach-voyager/voyager_smp.c          |    2 
 arch/x86/xen/smp.c                           |    1 
 drivers/acpi/Kconfig                         |   18 ++
 drivers/acpi/Makefile                        |    4 
 drivers/acpi/processor_core.c                |    8 +
 drivers/acpi/processor_deconfigure.c         |  275 ++++++++++++++++++++++++++
 drivers/base/cpu.c                           |    9 +
 include/acpi/processor.h                     |    6 +
 include/asm-ia64/smp.h                       |    1 
 include/asm-m32r/smp.h                       |    1 
 include/linux/cpumask.h                      |   31 ++-
 init/main.c                                  |    1 
 kernel/sched.c                               |   16 +-
 35 files changed, 415 insertions(+), 27 deletions(-)
 create mode 100644 drivers/acpi/processor_deconfigure.c