sst-linux/arch/ia64/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 Add Landlock, a new LSM from Mickaël Salaün <mic@linux.microsoft.com> 2021-05-01 18:50:44 -07:00
.gitignore
acpi-ext.c
acpi.c ia64: ensure proper NUMA distance and possible map initialization 2021-04-30 11:20:34 -07:00
asm-offsets.c ia64: do not typedef struct pal_min_state_area_s 2021-02-12 05:11:19 +09:00
audit.c
brl_emu.c
crash_dump.c
crash.c Kbuild updates for v5.12 2021-02-25 10:17:31 -08:00
cyclone.c
dma-mapping.c
efi_stub.S
efi.c ia64: fix EFI_DEBUG build 2021-04-30 11:20:35 -07:00
elfcore.c
entry.h
entry.S ia64: syscalls: switch to generic syscalltbl.sh 2021-04-25 05:25:40 +09:00
err_inject.c ia64: fix format strings for err_inject 2021-03-25 09:22:55 -07:00
esi_stub.S
esi.c
fsys.S arch/ia64/kernel/fsys.S: fix typos 2021-04-30 11:20:34 -07:00
fsyscall_gtod_data.h
ftrace.c
gate-data.S
gate.lds.S
gate.S
head.S ia64: drop unused IA64_FW_EMU ifdef 2021-04-30 11:20:35 -07:00
iosapic.c
irq_ia64.c
irq_lsapic.c
irq.c
irq.h
ivt.S
kprobes.c
machine_kexec.c ia64: drop marked broken DISCONTIGMEM and VIRTUAL_MEM_MAP 2021-04-30 11:20:35 -07:00
Makefile ia64: drop marked broken DISCONTIGMEM and VIRTUAL_MEM_MAP 2021-04-30 11:20:35 -07:00
Makefile.gate
mca_asm.S
mca_drv_asm.S
mca_drv.c ia64: do not typedef struct pal_min_state_area_s 2021-02-12 05:11:19 +09:00
mca_drv.h
mca.c ia64: mca: always make IA64_MCA_DEBUG an expression 2021-04-30 11:20:35 -07:00
minstate.h
module.c ia64: module: fix symbolizer crash on fdescr 2021-04-30 11:20:35 -07:00
msi_ia64.c
numa.c
pal.S ia64: trivial spelling fixes 2021-04-30 11:20:35 -07:00
palinfo.c arch: ia64: Remove rest of perfmon support 2021-01-22 12:12:20 +05:30
patch.c
pci-dma.c
perfmon_itanium.h arch: ia64: Remove rest of perfmon support 2021-01-22 12:12:20 +05:30
process.c arch: setup PF_IO_WORKER threads like PF_KTHREAD 2021-02-21 17:25:22 -07:00
ptrace.c ia64: fix ia64_syscall_get_set_arguments() for break-based syscalls 2021-03-13 11:27:31 -08:00
relocate_kernel.S
sal.c
salinfo.c
setup.c
sigframe.h
signal.c ia64: don't call handle_signal() unless there's actually a signal queued 2021-03-02 17:22:11 -07:00
smp.c
smpboot.c sched/core: Initialize the idle task with preemption disabled 2021-05-12 13:01:45 +02:00
stacktrace.c
sys_ia64.c
time.c EFI updates for v5.12 2021-02-20 19:09:26 -08:00
topology.c
traps.c
unaligned.c
uncached.c efi: ia64: move IA64-only declarations to new asm/efi.h header 2021-01-18 13:50:37 +01:00
unwind_decoder.c
unwind_i.h
unwind.c
vmlinux.lds.S