linux/arch/parisc/kernel
Valentin Schneider f1a0a376ca sched/core: Initialize the idle task with preemption disabled
As pointed out by commit

  de9b8f5dcb ("sched: Fix crash trying to dequeue/enqueue the idle thread")

init_idle() can and will be invoked more than once on the same idle
task. At boot time, it is invoked for the boot CPU thread by
sched_init(). Then smp_init() creates the threads for all the secondary
CPUs and invokes init_idle() on them.

As the hotplug machinery brings the secondaries to life, it will issue
calls to idle_thread_get(), which itself invokes init_idle() yet again.
In this case it's invoked twice more per secondary: at _cpu_up(), and at
bringup_cpu().

Given smp_init() already initializes the idle tasks for all *possible*
CPUs, no further initialization should be required. Now, removing
init_idle() from idle_thread_get() exposes some interesting expectations
with regards to the idle task's preempt_count: the secondary startup always
issues a preempt_disable(), requiring some reset of the preempt count to 0
between hot-unplug and hotplug, which is currently served by
idle_thread_get() -> idle_init().

Given the idle task is supposed to have preemption disabled once and never
see it re-enabled, it seems that what we actually want is to initialize its
preempt_count to PREEMPT_DISABLED and leave it there. Do that, and remove
init_idle() from idle_thread_get().

Secondary startups were patched via coccinelle:

  @begone@
  @@

  -preempt_disable();
  ...
  cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);

Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210512094636.2958515-1-valentin.schneider@arm.com
2021-05-12 13:01:45 +02:00
..
syscalls parisc architecture updates for kernel 5.13: 2021-05-03 13:47:17 -07:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
alternative.c parisc: Refactor alternative code to accept multiple conditions 2020-04-05 22:50:40 +02:00
asm-offsets.c parisc: Optimize per-pagetable spinlocks 2021-02-12 16:39:42 +01:00
audit.c
cache.c parisc: Rewrite tlb flush threshold calculation 2020-10-15 08:10:39 +02:00
compat_audit.c
drivers.c dma-mapping: split <linux/dma-mapping.h> 2020-10-06 07:07:03 +02:00
entry.S parisc: Optimize per-pagetable spinlocks 2021-02-12 16:39:42 +01:00
firmware.c parisc: firmware: Update references to parisc website 2020-06-01 23:02:11 +02:00
ftrace.c ftrace: Have the callbacks receive a struct ftrace_regs instead of pt_regs 2020-11-13 12:14:55 -05:00
hardware.c parisc: hardware: Update references to parisc website 2020-06-01 23:02:39 +02:00
head.S mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
hpmc.S parisc: Fix IVT checksum calculation wrt HPMC 2021-02-12 16:31:42 +01:00
inventory.c parisc: Add qemu fw_cfg interface 2020-10-15 08:10:37 +02:00
irq.c Rework of the X86 irq stack handling: 2021-02-24 16:32:23 -08:00
jump_label.c
kexec_file.c parisc: add support for kexec_file_load() syscall 2019-09-08 15:41:46 +02:00
kexec.c parisc: add support for kexec_file_load() syscall 2019-09-08 15:41:46 +02:00
kgdb.c maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault 2020-06-17 10:57:41 -07:00
kprobes.c parisc: kprobes: Use generic kretprobe trampoline handler 2020-09-08 11:52:33 +02:00
Makefile parisc: fix compilation when KEXEC=n and KEXEC_FILE=y 2019-12-15 21:05:38 +01:00
module.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
pa7300lc.c
pacache.S mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
parisc_ksyms.c
patch.c
pci-dma.c parisc: pci-dma: fix warning unused-function 2020-12-15 05:41:11 +01:00
pci.c
pdc_chassis.c
pdc_cons.c
pdt.c parisc: Report bad pages as HardwareCorrupted 2020-07-28 11:19:17 +02:00
perf_asm.S
perf_images.h
perf.c parisc/perf: open access for CAP_PERFMON privileged process 2020-04-16 12:19:08 -03:00
process.c arch: ensure parisc/powerpc handle PF_IO_WORKER in copy_thread() 2021-02-23 20:33:33 -07:00
processor.c parisc: Drop loops_per_jiffy from per_cpu struct 2020-11-11 14:57:30 +01:00
ptrace.c arch/parisc/kernel: remove duplicate include in ptrace 2021-03-04 09:12:29 +01:00
real2.S
relocate_kernel.S
setup.c parisc: Fix typo in setup.c 2021-05-03 15:08:59 +02:00
signal32.c
signal32.h
signal.c parisc: add support for TIF_NOTIFY_SIGNAL 2020-11-09 08:16:55 -07:00
smp.c sched/core: Initialize the idle task with preemption disabled 2021-05-12 13:01:45 +02:00
stacktrace.c
sys_parisc32.c
sys_parisc.c parisc: Make user stack size configurable 2020-11-11 14:59:08 +01:00
syscall.S parisc: syscalls: switch to generic syscalltbl.sh 2021-04-27 09:43:56 +02:00
time.c parisc: use legacy_timer_tick 2020-10-30 21:57:05 +01:00
topology.c
traps.c parisc: Fix IVT checksum calculation wrt HPMC 2021-02-12 16:31:42 +01:00
unaligned.c
unwind.c
vmlinux.lds.S vmlinux.lds.h: Split ELF_DETAILS from STABS_DEBUG 2020-09-01 09:50:35 +02:00