android_kernel_samsung_msm8976/arch/arm64/kernel
Abhimanyu Kapur 05b2d4a64c ARM64: smp: Fix cpu_up() racing with sys_reboot
Nothing stops a process from hotplugging in a CPU concurrently
with a sys_reboot() call. In such a situation we could have
ipi_cpu_stop() mark a cpu as 'offline' and _cpu_up() ignore the
fact that the CPU is not really offline and call the
CPU_UP_PREPARE notifier. When this happens stop_machine code will
complain that the cpu thread already exists and BUG_ON().

CPU0                      CPU1

 sys_reboot()
 kernel_restart()
 machine_restart()
 machine_shutdown()
 smp_send_stop()
 ...                   ipi_cpu_stop()
		       set_cpu_online(1, false)
                       local_irq_disable()
                       while(1)
        <PREEMPT>
 cpu_up()
 _cpu_up()
 if (!cpu_online(1))
 __cpu_notify(CPU_UP_PREPARE...)

 cpu_stop_cpu_callback()
 BUG_ON(stopper->thread)

This is easily reproducible by hotplugging in and out in a tight
loop while also rebooting.

Since the CPU is not really offline and hasn't gone through the
proper steps to be marked as such, let's mark the CPU as inactive.
This is just as easily testable as online and avoids any possibility
of _cpu_up() trying to bring the CPU back online when it never was
offline to begin with. Based on the similar patchset by for arm
targets 040c163( "ARM: smp: Fix cpu_up() racing with sys_reboot)"

CRs-fixed: 758395
Change-Id: Ia13a3aad8cd6616119a07b5114350591173a5d03
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
2014-11-25 16:25:24 -08:00
..
vdso arm64: vdso: fix coarse clock handling 2014-04-17 17:16:48 -07:00
.gitignore
arm64ksyms.c arm64: lib: Implement optimized string length routines 2014-08-15 11:46:49 -07:00
asm-offsets.c arm64: kernel: cpu_{suspend/resume} implementation 2014-04-17 17:04:31 -07:00
cpu_ops.c arm64: introduce CPU_OF_TABLES for cpu ops selection 2014-03-03 19:46:22 -08:00
cputable.c
debug-monitors.c arm64: debug: make local symbols static 2014-08-15 11:41:34 -07:00
early_printk.c arm64: fixmap: fix missing sub-page offset for earlyprintk 2014-08-15 11:45:48 -07:00
efi-entry.S arm64: fix el2_setup check of CurrentEL 2014-08-15 17:22:15 -07:00
efi-stub.c arm64: efi: add EFI stub 2014-08-15 11:45:47 -07:00
efi.c arm64: efi: only attempt efi map setup if booting via EFI 2014-08-15 11:46:50 -07:00
entry-fpsimd.S arm64: add support for kernel mode NEON in interrupt context 2014-08-15 11:45:51 -07:00
entry-ftrace.S arm64: ftrace: Fix comment typo 'CONFIG_FUNCTION_GRAPH_FP_TEST' 2014-08-15 17:22:11 -07:00
entry.S Revert "arm64: defer reloading a task's FPSIMD state to userland resume" 2014-08-21 23:18:11 -07:00
fpsimd.c Revert "arm64: defer reloading a task's FPSIMD state to userland resume" 2014-08-21 23:18:11 -07:00
ftrace.c arm64: ftrace: (bugfix) synced with ftcace interface change 2014-07-29 13:02:35 -07:00
head.S arm64: fix el2_setup check of CurrentEL 2014-08-15 17:22:15 -07:00
hw_breakpoint.c arm64: is_compat_task is defined both in asm/compat.h and linux/compat.h 2014-07-29 13:02:33 -07:00
hyp-stub.S
insn.c arm64: introduce aarch64_insn_gen_{nop|branch_imm}() helper functions 2014-04-17 17:05:04 -07:00
io.c arm64: io: Fix memset_io optimization 2014-10-14 20:05:07 -07:00
irq.c Merge upstream tag 'v3.10.49' into msm-3.10 2014-08-20 13:23:09 -07:00
jump_label.c arm64, jump label: optimize jump label implementation 2014-04-17 17:05:05 -07:00
kgdb.c arm64: KGDB: Add step debugging support 2014-08-15 11:41:19 -07:00
kuser32.S arm64: atomics: fix use of acquire + release for full barrier semantics 2014-04-17 17:16:53 -07:00
Makefile Perf: arm64: add perf trace user 2014-11-03 07:36:19 -08:00
module.c arm64: move encode_insn_immediate() from module.c to insn.c 2014-04-17 17:05:02 -07:00
opcodes.c arm64: copy conditional instruction tests from arm 2014-05-23 16:38:03 -07:00
pcibios.c arm64: PCI(e) arch support 2014-06-12 10:35:47 -07:00
perf_debug.c Perf: arm64: add perf trace user 2014-11-03 07:36:19 -08:00
perf_event.c Perf: arm64: make debug dir handle exportable 2014-11-03 07:35:54 -08:00
perf_regs.c arm64: fix !CONFIG_COMPAT build failures 2014-08-15 11:41:42 -07:00
perf_trace_counters.c Perf: arm64: Refine disable/enable in tracecounters 2014-10-02 14:12:38 -04:00
perf_trace_counters.h Perf: arm64: Refine disable/enable in tracecounters 2014-10-02 14:12:38 -04:00
perf_trace_user.c Perf: arm64: add perf trace user 2014-11-03 07:36:19 -08:00
perf_trace_user.h Perf: arm64: add perf trace user 2014-11-03 07:36:19 -08:00
process.c Merge "arm64: process: Use continuation prints for show_data" 2014-09-19 08:01:36 -07:00
psci.c ARM: Check if a CPU has gone offline 2014-08-15 11:46:43 -07:00
ptrace.c Revert "arm64: defer reloading a task's FPSIMD state to userland resume" 2014-08-21 23:18:11 -07:00
return_address.c arm64: ftrace: Add CALLER_ADDRx macros 2014-07-29 13:02:35 -07:00
setup.c arm64: restrict effects of ARMV7_COMPAT_CPUINFO to ARMv7 tasks 2014-10-23 19:47:52 -07:00
signal.c Revert "arm64: defer reloading a task's FPSIMD state to userland resume" 2014-08-21 23:18:11 -07:00
signal32.c arm64: Provide read/write fault information in compat signal handlers 2014-08-15 11:45:53 -07:00
sleep.S arm64: Move cpu_resume_mmu to a head.S section 2014-07-15 18:22:53 -07:00
smp.c ARM64: smp: Fix cpu_up() racing with sys_reboot 2014-11-25 16:25:24 -08:00
smp_spin_table.c arm64: Remove boot thread synchronisation for spin-table release method 2014-08-15 11:45:52 -07:00
stacktrace.c arm64: Add 'notrace' attribute to unwind_frame() for ftrace 2014-07-29 13:02:34 -07:00
suspend.c arm64: kernel: fix per-cpu offset restore on resume 2014-04-17 17:05:13 -07:00
swp_emulate.c arm/arm64: Rate-limited warnings for SWP emulation 2014-08-27 20:58:01 -07:00
sys.c
sys32.S arm64: compat: correct register concatenation for syscall wrappers 2014-02-07 13:49:54 -08:00
sys_compat.c
time.c arm64: kernel: initialize broadcast hrtimer based clock event device 2014-08-15 17:22:11 -07:00
topology.c arm64: topology: Define arch_get_cpu_efficiency() API for scheduler 2014-07-22 14:20:35 -07:00
traps.c arm64: update die handler from ARM / x86 2014-11-13 19:20:53 -08:00
vdso.c arm64: vdso: clean up vdso_pagelist initialization 2014-08-15 11:41:23 -07:00
vmlinux.lds.S arm64: Fix linker script entry point 2014-08-15 11:46:51 -07:00