mirror_ubuntu-kernels/arch/arm64/kernel
Phil Auld 5524cbb1bf arch/arm64: Fix topology initialization for core scheduling
Arm64 systems rely on store_cpu_topology() to call update_siblings_masks()
to transfer the toplogy to the various cpu masks. This needs to be done
before the call to notify_cpu_starting() which tells the scheduler about
each cpu found, otherwise the core scheduling data structures are setup
in a way that does not match the actual topology.

With smt_mask not setup correctly we bail on `cpumask_weight(smt_mask) == 1`
for !leaders in:

 notify_cpu_starting()
   cpuhp_invoke_callback_range()
     sched_cpu_starting()
       sched_core_cpu_starting()

which leads to rq->core not being correctly set for !leader-rq's.

Without this change stress-ng (which enables core scheduling in its prctl
tests in newer versions -- i.e. with PR_SCHED_CORE support) causes a warning
and then a crash (trimmed for legibility):

[ 1853.805168] ------------[ cut here ]------------
[ 1853.809784] task_rq(b)->core != rq->core
[ 1853.809792] WARNING: CPU: 117 PID: 0 at kernel/sched/fair.c:11102 cfs_prio_less+0x1b4/0x1c4
...
[ 1854.015210] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
...
[ 1854.231256] Call trace:
[ 1854.233689]  pick_next_task+0x3dc/0x81c
[ 1854.237512]  __schedule+0x10c/0x4cc
[ 1854.240988]  schedule_idle+0x34/0x54

Fixes: 9edeaea1bc ("sched: Core-wide rq->lock")
Signed-off-by: Phil Auld <pauld@redhat.com>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Link: https://lore.kernel.org/r/20220331153926.25742-1-pauld@redhat.com
Signed-off-by: Will Deacon <will@kernel.org>
2022-04-04 10:24:22 +01:00
..
probes arm64: kprobes: Make a frame pointer on __kretprobe_trampoline 2021-10-22 12:16:53 -04:00
vdso arm64: vdso: Fix "no previous prototype" warning 2022-01-24 12:08:28 +00:00
vdso32 Kbuild: move to -std=gnu11 2022-03-13 17:31:37 +09:00
.gitignore
acpi_numa.c
acpi_parking_protocol.c
acpi.c arm64: Simplify checking for populated DT 2021-12-06 16:12:53 +00:00
alternative.c
armv8_deprecated.c arm64: extable: add a dedicated uaccess handler 2021-10-21 10:45:22 +01:00
asm-offsets.c KVM: arm64: Drop unused workaround_flags vcpu field 2021-12-08 14:54:07 +00:00
cacheinfo.c drivers: base: cacheinfo: Get rid of DEFINE_SMP_CALL_CACHE_FUNCTION() 2021-09-01 10:29:10 +02:00
cpu_errata.c arm64 updates for 5.18 2022-03-21 10:46:39 -07:00
cpu_ops.c
cpu-reset.S arm64: kexec: remove cpu-reset.h 2021-10-01 13:31:00 +01:00
cpufeature.c Merge branch 'for-next/spectre-bhb' into for-next/core 2022-03-14 19:08:31 +00:00
cpuidle.c cpuidle: PSCI: Move the has_lpi check to the beginning of the function 2022-03-03 20:20:06 +01:00
cpuinfo.c arm64/mte: Add hwcap for asymmetric mode 2022-02-25 14:41:05 +00:00
crash_core.c arm64: crash_core: Export MODULES, VMALLOC, and VMEMMAP ranges 2022-03-07 21:25:47 +00:00
crash_dump.c
debug-monitors.c
efi-entry.S
efi-header.S
efi-rt-wrapper.S
efi.c arm64: efi: Export screen_info 2021-08-04 16:54:36 +00:00
elfcore.c arm64: mte: Fix the stack frame size warning in mte_dump_tag_range() 2022-04-04 09:59:27 +01:00
entry-common.c Changes in this cycle were: 2022-03-22 14:39:12 -07:00
entry-fpsimd.S arm64/sve: Explicitly load vector length when restoring SVE state 2021-10-21 10:18:17 +01:00
entry-ftrace.S arm64: Use BTI C directly and unconditionally 2021-12-14 18:12:58 +00:00
entry.S Merge branch 'for-next/spectre-bhb' into for-next/core 2022-03-14 19:08:31 +00:00
fpsimd.c arm64/fpsimd: Clarify the purpose of using last in fpsimd_save() 2022-02-08 14:43:22 +00:00
ftrace.c arm64: ftrace: use HAVE_FUNCTION_GRAPH_RET_ADDR_PTR 2021-11-16 09:47:54 +00:00
head.S sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y 2021-09-30 16:13:10 +02:00
hibernate-asm.S arm64: kexec: install a copy of the linear-map 2021-10-01 13:31:00 +01:00
hibernate.c arm64: Drop outdated links in comments 2022-01-05 11:51:01 +00:00
hw_breakpoint.c
hyp-stub.S
idle.c Merge branch 'for-next/entry' into for-next/core 2021-06-24 14:01:55 +01:00
idreg-override.c arm64: Add support of PAuth QARMA3 architected algorithm 2022-02-25 13:38:52 +00:00
image-vars.h ARM: 2022-03-24 11:58:57 -07:00
image.h
io.c
irq.c
jump_label.c arm64: insn: decouple patching from insn code 2021-06-11 11:19:27 +01:00
kaslr.c arm64: fix the doc of RANDOMIZE_MODULE_REGION_FULL 2021-08-03 10:36:42 +01:00
kexec_image.c
kgdb.c arm64: insn: decouple patching from insn code 2021-06-11 11:19:27 +01:00
kuser32.S
machine_kexec_file.c arm64: kexec: Fix missing error code 'ret' warning in load_other_segments() 2021-12-16 17:44:58 +00:00
machine_kexec.c Merge branches 'for-next/misc', 'for-next/cache-ops-dzp', 'for-next/stacktrace', 'for-next/xor-neon', 'for-next/kasan', 'for-next/armv8_7-fp', 'for-next/atomics', 'for-next/bti', 'for-next/sve', 'for-next/kselftest' and 'for-next/kcsan', remote-tracking branch 'arm64/for-next/perf' into for-next/core 2022-01-05 18:14:32 +00:00
Makefile arm64: mte: Dump the MTE tags in the core file 2022-02-15 22:53:29 +00:00
module-plts.c
module.c kasan, arm64: don't tag executable vmalloc allocations 2022-03-24 19:06:48 -07:00
mte.c arm64/mte: Remove asymmetric mode from the prctl() interface 2022-03-09 18:14:56 +00:00
paravirt.c
patching.c Merge branch 'for-next/insn' into for-next/core 2021-06-24 14:03:24 +01:00
pci.c arm64: PCI: Support root bridge preparation for Hyper-V 2021-08-23 10:59:26 +01:00
perf_callchain.c Peter Zijlstra says: 2022-01-12 16:26:58 -08:00
perf_event.c arm64: perf: Expose some Armv9 common events under sysfs 2022-03-08 11:40:44 +00:00
perf_regs.c
pointer_auth.c arm64: move preemption disablement to prctl handlers 2021-07-28 18:33:49 +01:00
process.c arm64/mte: Remove asymmetric mode from the prctl() interface 2022-03-09 18:14:56 +00:00
proton-pack.c Merge branch 'for-next/spectre-bhb' into for-next/core 2022-03-14 19:08:31 +00:00
psci.c
ptrace.c ptrace: Create ptrace_report_syscall_{entry,exit} in ptrace.h 2022-03-10 13:35:08 -06:00
reloc_test_core.c
reloc_test_syms.S
relocate_kernel.S arm64: kexec: keep MMU enabled during kexec relocation 2021-10-01 13:31:00 +01:00
return_address.c arm64: Make return_address() use arch_stack_walk() 2021-12-10 14:06:04 +00:00
sdei.c arm64: kernel: add helper for booted at EL2 and not VHE 2021-10-01 13:30:59 +01:00
setup.c drivers/base/node: consolidate node device subsystem initialization in node_dev_init() 2022-03-22 15:57:10 -07:00
signal32.c arm64 updates for 5.15: 2021-09-01 15:04:29 -07:00
signal.c ptrace: Cleanups for v5.18 2022-03-28 17:29:53 -07:00
sigreturn32.S
sleep.S
smccc-call.S arm64: smccc: Save lr before calling __arm_smccc_sve_check() 2021-07-21 11:23:25 +01:00
smp_spin_table.c
smp.c arch/arm64: Fix topology initialization for core scheduling 2022-04-04 10:24:22 +01:00
stacktrace.c arm64: Mark start_backtrace() notrace and NOKPROBE_SYMBOL 2022-01-24 14:25:20 +00:00
suspend.c arm64: kasan: mte: use a constant kernel GCR_EL1 value 2021-08-02 18:14:21 +01:00
sys32.c
sys_compat.c arm64: drop unused includes of <linux/personality.h> 2022-03-08 10:23:42 +00:00
sys.c
syscall.c arm64: Snapshot thread flags 2021-12-01 00:06:44 +01:00
time.c arm64: Make profile_pc() use arch_stack_walk() 2021-12-10 14:06:04 +00:00
topology.c topology: Represent clusters of CPUs within a die 2021-10-15 11:25:15 +02:00
trace-events-emulation.h
traps.c asm-generic updates for 5.18 2022-03-23 18:03:08 -07:00
vdso32-wrap.S
vdso-wrap.S
vdso.c
vmlinux.lds.S arm64: entry: Allow the trampoline text to occupy multiple pages 2022-02-15 17:40:28 +00:00