linux/arch/arm64/kernel
Linus Torvalds 710d60cbf1 Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull cpu hotplug updates from Thomas Gleixner:
 "This is the first part of the ongoing cpu hotplug rework:

   - Initial implementation of the state machine

   - Runs all online and prepare down callbacks on the plugged cpu and
     not on some random processor

   - Replaces busy loop waiting with completions

   - Adds tracepoints so the states can be followed"

More detailed commentary on this work from an earlier email:
 "What's wrong with the current cpu hotplug infrastructure?

   - Asymmetry

     The hotplug notifier mechanism is asymmetric versus the bringup and
     teardown.  This is mostly caused by the notifier mechanism.

   - Largely undocumented dependencies

     While some notifiers use explicitely defined notifier priorities,
     we have quite some notifiers which use numerical priorities to
     express dependencies without any documentation why.

   - Control processor driven

     Most of the bringup/teardown of a cpu is driven by a control
     processor.  While it is understandable, that preperatory steps,
     like idle thread creation, memory allocation for and initialization
     of essential facilities needs to be done before a cpu can boot,
     there is no reason why everything else must run on a control
     processor.  Before this patch series, bringup looks like this:

       Control CPU                     Booting CPU

       do preparatory steps
       kick cpu into life

                                       do low level init

       sync with booting cpu           sync with control cpu

       bring the rest up

   - All or nothing approach

     There is no way to do partial bringups.  That's something which is
     really desired because we waste e.g.  at boot substantial amount of
     time just busy waiting that the cpu comes to life.  That's stupid
     as we could very well do preparatory steps and the initial IPI for
     other cpus and then go back and do the necessary low level
     synchronization with the freshly booted cpu.

   - Minimal debuggability

     Due to the notifier based design, it's impossible to switch between
     two stages of the bringup/teardown back and forth in order to test
     the correctness.  So in many hotplug notifiers the cancel
     mechanisms are either not existant or completely untested.

   - Notifier [un]registering is tedious

     To [un]register notifiers we need to protect against hotplug at
     every callsite.  There is no mechanism that bringup/teardown
     callbacks are issued on the online cpus, so every caller needs to
     do it itself.  That also includes error rollback.

  What's the new design?

     The base of the new design is a symmetric state machine, where both
     the control processor and the booting/dying cpu execute a well
     defined set of states.  Each state is symmetric in the end, except
     for some well defined exceptions, and the bringup/teardown can be
     stopped and reversed at almost all states.

     So the bringup of a cpu will look like this in the future:

       Control CPU                     Booting CPU

       do preparatory steps
       kick cpu into life

                                       do low level init

       sync with booting cpu           sync with control cpu

                                       bring itself up

     The synchronization step does not require the control cpu to wait.
     That mechanism can be done asynchronously via a worker or some
     other mechanism.

     The teardown can be made very similar, so that the dying cpu cleans
     up and brings itself down.  Cleanups which need to be done after
     the cpu is gone, can be scheduled asynchronously as well.

  There is a long way to this, as we need to refactor the notion when a
  cpu is available.  Today we set the cpu online right after it comes
  out of the low level bringup, which is not really correct.

  The proper mechanism is to set it to available, i.e. cpu local
  threads, like softirqd, hotplug thread etc. can be scheduled on that
  cpu, and once it finished all booting steps, it's set to online, so
  general workloads can be scheduled on it.  The reverse happens on
  teardown.  First thing to do is to forbid scheduling of general
  workloads, then teardown all the per cpu resources and finally shut it
  off completely.

  This patch series implements the basic infrastructure for this at the
  core level.  This includes the following:

   - Basic state machine implementation with well defined states, so
     ordering and prioritization can be expressed.

   - Interfaces to [un]register state callbacks

     This invokes the bringup/teardown callback on all online cpus with
     the proper protection in place and [un]installs the callbacks in
     the state machine array.

     For callbacks which have no particular ordering requirement we have
     a dynamic state space, so that drivers don't have to register an
     explicit hotplug state.

     If a callback fails, the code automatically does a rollback to the
     previous state.

   - Sysfs interface to drive the state machine to a particular step.

     This is only partially functional today.  Full functionality and
     therefor testability will be achieved once we converted all
     existing hotplug notifiers over to the new scheme.

   - Run all CPU_ONLINE/DOWN_PREPARE notifiers on the booting/dying
     processor:

       Control CPU                     Booting CPU

       do preparatory steps
       kick cpu into life

                                       do low level init

       sync with booting cpu           sync with control cpu
       wait for boot
                                       bring itself up

                                       Signal completion to control cpu

     In a previous step of this work we've done a full tree mechanical
     conversion of all hotplug notifiers to the new scheme.  The balance
     is a net removal of about 4000 lines of code.

     This is not included in this series, as we decided to take a
     different approach.  Instead of mechanically converting everything
     over, we will do a proper overhaul of the usage sites one by one so
     they nicely fit into the symmetric callback scheme.

     I decided to do that after I looked at the ugliness of some of the
     converted sites and figured out that their hotplug mechanism is
     completely buggered anyway.  So there is no point to do a
     mechanical conversion first as we need to go through the usage
     sites one by one again in order to achieve a full symmetric and
     testable behaviour"

* 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits)
  cpu/hotplug: Document states better
  cpu/hotplug: Fix smpboot thread ordering
  cpu/hotplug: Remove redundant state check
  cpu/hotplug: Plug death reporting race
  rcu: Make CPU_DYING_IDLE an explicit call
  cpu/hotplug: Make wait for dead cpu completion based
  cpu/hotplug: Let upcoming cpu bring itself fully up
  arch/hotplug: Call into idle with a proper state
  cpu/hotplug: Move online calls to hotplugged cpu
  cpu/hotplug: Create hotplug threads
  cpu/hotplug: Split out the state walk into functions
  cpu/hotplug: Unpark smpboot threads from the state machine
  cpu/hotplug: Move scheduler cpu_online notifier to hotplug core
  cpu/hotplug: Implement setup/removal interface
  cpu/hotplug: Make target state writeable
  cpu/hotplug: Add sysfs state interface
  cpu/hotplug: Hand in target state to _cpu_up/down
  cpu/hotplug: Convert the hotplugged cpu work to a state machine
  cpu/hotplug: Convert to a state machine for the control processor
  cpu/hotplug: Add tracepoints
  ...
2016-03-15 13:50:29 -07:00
..
vdso arm64: build vdso without libgcov 2015-11-12 15:18:07 +00:00
.gitignore arm64: Build infrastructure 2012-09-17 13:42:21 +01:00
acpi.c Power management and ACPI updates for v4.4-rc1 2015-11-04 18:10:13 -08:00
alternative.c arm64: mm: fold alternatives into .init 2015-12-10 17:36:08 +00:00
arm64ksyms.c ARM: 8480/2: arm64: add implementation for arm-smccc 2016-01-04 16:24:45 +00:00
armv8_deprecated.c arm64: add __init/__initdata section marker to some functions/variables 2015-12-02 12:17:11 +00:00
asm-offsets.c * s390: Support for runtime instrumentation within guests, 2016-01-12 13:22:12 -08:00
cacheinfo.c arm64: kernel: add support for cpu cache information 2015-01-15 11:55:07 +00:00
cpu_errata.c arm64: KVM: Add workaround for Cortex-A57 erratum 834220 2015-11-24 17:58:14 +01:00
cpu_ops.c arm64: force CONFIG_SMP=y and remove redundant #ifdefs 2015-07-27 11:08:40 +01:00
cpufeature.c arm64: add __init/__initdata section marker to some functions/variables 2015-12-02 12:17:11 +00:00
cpuidle.c arm64: cpuidle: add __init section marker to arm_cpuidle_init 2015-07-02 17:44:27 +01:00
cpuinfo.c arm64: restore bogomips information in /proc/cpuinfo 2015-11-19 17:57:18 +00:00
debug-monitors.c arm64: debug: re-enable irqs before sending breakpoint SIGTRAP 2016-02-10 16:05:28 +00:00
efi-entry.S arm64/efi: isolate EFI stub from the kernel proper 2015-10-12 16:20:12 +01:00
efi.c arm64/efi: refactor EFI init and runtime code for reuse by 32-bit ARM 2015-12-09 16:57:23 +00:00
entry32.S arm64: entry32: remove pointless register assignment 2015-07-10 16:47:13 +01:00
entry-fpsimd.S arm64: fpsimd: fix a typo in fpsimd_save_partial_state ENDPROC 2014-07-31 11:42:42 +01:00
entry-ftrace.S arm64: ftrace: fix function_graph tracer panic 2015-10-02 11:12:56 +01:00
entry.S arm64: entry: remove pointless SPSR mode check 2016-01-06 15:40:38 +00:00
fpsimd.c arm64: add __init/__initdata section marker to some functions/variables 2015-12-02 12:17:11 +00:00
ftrace.c arm64: ftrace: modify a stack frame in a safe way 2015-12-21 17:26:01 +00:00
head.S arm64: kernel: fix architected PMU registers unconditional access 2016-01-25 11:09:06 +00:00
hw_breakpoint.c arm64: Fix missing #include in hw_breakpoint.c 2015-10-12 12:10:53 +01:00
hyp-stub.S irqchip: gic-v3: Initial support for GICv3 2014-07-08 22:11:47 +00:00
image.h arm64/efi: Make strnlen() available to the EFI namespace 2016-02-16 10:32:10 +00:00
insn.c arm64: insn: remove BUG_ON from codegen 2016-01-17 19:15:26 -05:00
io.c arm64: optimize memcpy_{from,to}io() and memset_io() 2014-11-06 17:25:27 +00:00
irq.c arm64: remove irq_count and do_softirq_own_stack() 2015-12-21 17:26:01 +00:00
jump_label.c jump_label: Rename JUMP_LABEL_{EN,DIS}ABLE to JUMP_LABEL_{JMP,NOP} 2015-08-03 11:34:12 +02:00
kgdb.c arm64/debug: Simplify BRK insn opcode declarations 2015-07-27 11:08:42 +01:00
kuser32.S arm64: Add __NR_* definitions for compat syscalls 2014-07-10 11:02:40 +01:00
Makefile xen: features and fixes for 4.5-rc0 2016-01-12 13:05:36 -08:00
module.c arm64: module: avoid undefined shift behavior in reloc_data() 2016-01-05 11:27:20 +00:00
paravirt.c arm64: introduce CONFIG_PARAVIRT, PARAVIRT_TIME_ACCOUNTING and pv_time_ops 2015-12-21 14:40:54 +00:00
pci.c ARM64: PCI: do not enable resources on PROBE_ONLY systems 2015-07-30 20:17:07 +01:00
perf_callchain.c arm64: ftrace: fix a stack tracer's output under function graph tracer 2015-12-21 17:26:02 +00:00
perf_event.c arm64: perf: add support for Cortex-A72 2015-12-22 14:45:35 +00:00
perf_regs.c perf: Move task_pt_regs sampling into arch code 2015-01-09 11:12:28 +01:00
process.c arm64: ftrace: fix a stack tracer's output under function graph tracer 2015-12-21 17:26:02 +00:00
psci.c drivers: firmware: psci: move power_state handling to generic code 2015-10-02 14:35:16 +01:00
ptrace.c arm64: Clear out any singlestep state on a ptrace detach operation 2015-12-07 17:48:21 +00:00
return_address.c arm64: ftrace: fix a stack tracer's output under function graph tracer 2015-12-21 17:26:02 +00:00
setup.c arch: Set IORESOURCE_SYSTEM_RAM flag for System RAM 2016-01-30 09:49:57 +01:00
signal32.c arm64: compat: fix vfp save/restore across signal handlers in big-endian 2015-09-17 11:57:03 +01:00
signal.c arm64: Removed unused variable 2015-04-13 20:40:10 +02:00
sleep.S arm64: kasan: clear stale stack poison 2016-03-09 15:43:42 -08:00
smccc-call.S ARM: 8480/2: arm64: add implementation for arm-smccc 2016-01-04 16:24:45 +00:00
smp_spin_table.c ARM64: kernel: make cpu_ops hooks DT agnostic 2015-05-19 16:09:29 +01:00
smp.c arch/hotplug: Call into idle with a proper state 2016-03-01 20:36:57 +01:00
stacktrace.c arm64: make irq_stack_ptr more robust 2016-02-12 15:53:51 +00:00
suspend.c arm64: kernel: pause/unpause function graph tracer in cpu_suspend() 2015-11-17 17:11:45 +00:00
sys32.c arm64: fix implementation of mmap2 compat syscall 2015-03-19 10:43:51 +00:00
sys_compat.c arm64: compat: align cacheflush syscall with arch/arm 2014-12-01 13:31:12 +00:00
sys.c arm64: make sys_call_table const 2015-01-27 09:38:08 +00:00
time.c arm64: ftrace: fix a stack tracer's output under function graph tracer 2015-12-21 17:26:02 +00:00
topology.c arm64: kernel: remove non-legit DT warnings when booting using ACPI 2015-07-27 11:08:41 +01:00
trace-events-emulation.h arm64: Trace emulation of AArch32 legacy instructions 2014-11-20 16:35:02 +00:00
traps.c arm64: make irq_stack_ptr more robust 2016-02-12 15:53:51 +00:00
vdso.c arm64: VDSO: fix coarse clock monotonicity regression 2015-08-10 15:37:45 +01:00
vmlinux.lds.S arm64 updates for 4.5: 2016-01-12 12:23:33 -08:00