linux/arch/s390/include/asm
Thomas Richter 9ecc4d0338 s390/pai: Support CPU hotplug for PMU PAI
The command 'perf stat -e pai_crypto/CRYPTO_ALL/ -- <command>'
crashes the kernel when CPUs are hotplug added during that run.

Root cause is the missing allocation of per-CPU data structures
for that new CPU. The allocation is dynamic and the first
event that has task context creates such a structure for
each online CPU. This is not sufficient. CPUs may be offline
during event creation and can be set online during the
perf run time. For example commands

 # echo 0 > /sys/devices/system/cpu/cpu1/online
 # perf stat -e cycles -i -- stress-ng -t10s --matrix X
 # sleep 1
 # echo 1 > /sys/devices/system/cpu/cpu1/online

Currently without a CPU hotplug handler, that new CPU has no
per-CPU data infrastructure. The scheduler runs PMU call back
function pai_add() to install the PMU support for that CPU before
the task is being scheduled on that new CPU.
In pai_add() instructions

    mp = this_cpu_ptr(pai_root[idx].mapptr);
    cpump = mp->mapptr;

return a NULL pointer and the result is a kernel panic as variable
cpump is used inside that function.

Add CPU hotplug support for CPU add and delete and create
the necessary per-CPU data infrastructure during CPU hotplug
add processing. Same for CPU hotplug remove.
This is done when the CPU is offline to ensure the data structures
are available when CPU is made online and tasks are scheduled on it.

[hca@linux.ibm.com: fixup error path in pai_init()]

Cc: stable@vger.kernel.org # v6.19
Fixes: 582cc1b28e ("s390/pai_ext: Enable per-task and system-wide sampling event")
Fixes: 9f66572f28 ("s390/pai_crypto: Enable per-task and system-wide sampling event")
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Jan Polensky <japo@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2026-09-08 15:53:40 +02:00
..
trace s390/ap: Introduce new AP nqap and dqap trace events 2025-10-21 11:09:21 +02:00
vdso s390/processor: Implement cpu_relax() with cpu serialization 2026-05-20 09:48:04 +02:00
abs_lowcore.h s390/lowcore: Convert relocated lowcore alternative to machine feature 2025-03-04 17:18:05 +01:00
access-regs.h s390/acrs: cleanup access register handling 2024-02-12 15:03:33 +01:00
airq.h s390/airq: remove lsi_mask from airq_struct 2023-08-30 11:03:28 +02:00
alternative.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
ap.h s390/ap: Fix queue depth field length 2026-07-31 13:31:30 +02:00
appldata.h s390: Convert MACHINE_IS_[LPAR|VM|KVM], etc, machine_is_[lpar|vm|kvm]() 2025-03-04 17:18:07 +01:00
arch_hweight.h s390: Use MARCH_HAS_*_FEATURES defines 2024-09-07 17:12:42 +02:00
arch-stackprotector.h s390: Add stackprotector support 2025-11-24 11:45:21 +01:00
archrandom.h
asce.h s390/mm: Reimplement lazy ASCE handling 2025-04-14 11:23:21 +02:00
asm-const.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
asm-extable.h s390: Add support for DCACHE_WORD_ACCESS (again) 2026-07-30 00:29:11 +02:00
asm-prototypes.h s390/tishift: Convert __ashlti3(), __ashrti3(), __lshrti3() to C 2026-06-10 16:55:22 +02:00
asm.h s390/asm: Let __HAVE_ASM_FLAG_OUTPUTS__ define 1 2026-01-17 15:52:49 +01:00
atomic_ops.h s390: Remove superfluous newlines from inline assemblies 2025-09-29 13:52:08 +02:00
atomic.h s390/atomic: Provide arch_atomic_*_and_test() implementations 2024-12-15 16:19:03 +01:00
barrier.h s390/barrier: Use alternative instead of ifdef for bcr_serialize() 2026-05-20 09:48:03 +02:00
bitops.h more s390 updates for 6.18 merge window 2025-10-09 10:51:43 -07:00
boot_data.h s390/boot: Add timestamps to early boot messages 2025-01-26 17:24:02 +01:00
bug.h s390 updates for 7.2 merge window 2026-06-16 05:08:13 +05:30
cache.h
ccwdev.h Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (headers) 2026-07-03 07:38:16 +02:00
ccwgroup.h
cfi.h s390/bpf: Add kCFI support 2026-08-05 15:16:54 +02:00
checksum.h s390: Remove superfluous newlines from inline assemblies 2025-09-29 13:52:08 +02:00
chpid.h
chsc.h s390/chsc: use notifier for AP configuration changes 2024-04-09 17:29:55 +02:00
cio.h s390/tape: Introduce idal buffer array 2025-10-21 10:25:55 +02:00
clocksource.h
clp.h
cmb.h
cmpxchg.h s390/cmpxchg: Fix KASAN stack-out-of-bounds in atomic helpers 2026-06-10 16:25:13 +02:00
cpacf.h s390/cpacf: Unpoison instruction results 2026-08-31 16:25:38 +02:00
cpcmd.h
cpu_mf-insn.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
cpu_mf.h s390: Use inline qualifier for all EX_TABLE and ALTERNATIVE inline assemblies 2025-03-18 17:13:51 +01:00
cpu.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
cpufeature.h s390/mm: Remove cpu_has_idte() 2025-11-06 14:12:31 +01:00
cputime.h s390/idle: remove arch_cpu_idle_time() and corresponding code 2023-02-09 20:11:23 +01:00
crw.h
css_chars.h s390/qdio: Rename feature flag aif_osa to aif_qdio 2025-01-03 11:00:53 +01:00
ctlreg.h s390: Remove superfluous newlines from inline assemblies 2025-09-29 13:52:08 +02:00
current.h s390/current: Implement current with inline assembly 2025-03-18 17:13:04 +01:00
dat-bits.h KVM: s390: Add P bit in table entry bitfields, move union vaddress 2026-02-04 17:00:08 +01:00
debug.h s390/debug: Add s390dbf kernel parameter 2026-05-11 16:42:31 +02:00
delay.h
diag.h s390: Use inline qualifier for all EX_TABLE and ALTERNATIVE inline assemblies 2025-03-18 17:13:51 +01:00
diag288.h watchdog: diag288_wdt: Implement module autoload 2025-04-16 09:26:49 +02:00
dis.h
dma-types.h s390/mm: provide simple ARCH_HAS_DEBUG_VIRTUAL support 2024-03-13 09:23:49 +01:00
dma.h s390/mm: fix MAX_DMA_ADDRESS physical vs virtual confusion 2023-09-05 20:12:51 +02:00
dwarf.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
eadm.h s390/cio: use bitwise types to allow for type checking 2024-03-13 09:23:46 +01:00
ebcdic.h s390/ebcdic: Fix length decrement in codepage_convert() 2025-01-13 09:50:18 +01:00
elf.h s390/syscalls: Remove system call table pointer from thread_struct 2025-11-17 11:10:39 +01:00
entry-common.h randomize_kstack: Unify random source across arches 2026-03-24 21:12:03 -07:00
entry-percpu.h s390/percpu: Infrastructure for more efficient this_cpu operations 2026-06-03 15:32:46 +02:00
exec.h
extable.h
extmem.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
facility.h s390/facilities: Fix warning about shadow of global variable 2024-10-10 15:32:43 +02:00
fault.h s390/mm: move translation-exception identification structure to fault.h 2023-10-23 18:21:22 +02:00
fcx.h s390/cio: use bitwise types to allow for type checking 2024-03-13 09:23:46 +01:00
fprobe.h fprobe: Add fprobe_header encoding feature 2024-12-26 10:50:05 -05:00
fpu-insn-asm.h s390/fpu: Move GR_NUM / VX_NUM macros to separate header file 2026-06-03 15:32:44 +02:00
fpu-insn.h s390/fpu: Move GR_NUM / VX_NUM macros to separate header file 2026-06-03 15:32:44 +02:00
fpu-types.h s390/checksum: provide vector register variant of csum_partial() 2024-02-16 14:30:17 +01:00
fpu.h s390/vx: Convert cpu_has_vx() to cpu feature function 2025-03-04 17:18:07 +01:00
ftrace.h s390: Remove compat support 2025-11-17 11:10:38 +01:00
ftrace.lds.h
futex.h s390/mm: Reimplement lazy ASCE handling 2025-04-14 11:23:21 +02:00
gmap_helpers.h KVM: s390: Avoid potentially sleeping while atomic when zapping pages 2026-06-02 16:46:41 +02:00
hardirq.h s390: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
hiperdispatch.h s390/hiperdispatch: Introduce hiperdispatch 2024-08-29 22:56:35 +02:00
hugetlb.h s390 updates for 7.3 merge window 2026-08-23 10:26:44 -07:00
hw_irq.h
idals.h Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
idle.h s390/idle: Remove idle time and count sysfs files 2026-06-15 16:33:40 +02:00
insn-common-asm.h s390/fpu: Move GR_NUM / VX_NUM macros to separate header file 2026-06-03 15:32:44 +02:00
io.h - The 6 patch series "Enable strict percpu address space checks" from 2025-04-01 09:29:18 -07:00
ipl.h
irq_work.h arch: consolidate arch_irq_work_raise prototypes 2023-11-23 11:32:29 +01:00
irq.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
irqflags.h s390/irqflags: Add out-of-line definitions of arch_local_irq_*() for KMSAN 2026-08-11 16:42:18 +02:00
isc.h
itcw.h
jump_label.h s390/jump_label: Implement ARCH_STATIC_BRANCH_JUMP_ASM and ARCH_STATIC_BRANCH_ASM macros 2026-06-10 16:25:13 +02:00
kasan.h s390/kasan: move shadow mapping to decompressor 2023-03-20 11:02:51 +01:00
Kbuild ring-buffer: Flush and stop persistent ring buffer on panic 2026-05-21 08:20:58 -04:00
kdebug.h
kexec.h s390/kdump: Provide is_kdump_kernel() implementation 2024-10-25 16:03:23 +02:00
kfence.h s390/kfence: Split kfence pool into 4k mappings in arch_kfence_init_pool() 2025-03-18 17:13:05 +01:00
kmsan.h s390/kmsan: Fix merge conflict with get_lowcore() introduction 2024-07-23 16:01:51 +02:00
kprobes.h kprobes: unify kprobes_exceptions_nofify() prototypes 2023-11-10 19:59:05 +09:00
kvm_host_s390_types.h KVM: s390: Move kvm_host definitions to kvm_host_s390 2026-08-13 08:54:51 +02:00
kvm_host_s390.h KVM: s390: gmap: Make storage keys optional 2026-08-13 08:55:09 +02:00
kvm_host_types.h KVM: s390: Move kvm_host definitions to kvm_host_s390 2026-08-13 08:54:51 +02:00
kvm_host.h KVM: s390: Move PGM code definitions to asm/kvm_host.h 2026-08-13 08:54:59 +02:00
kvm_para.h s390: Remove superfluous newlines from inline assemblies 2025-09-29 13:52:08 +02:00
linkage.h s390: Implement _THIS_IP_ using inline asm 2026-05-30 11:33:32 +02:00
lowcore.h s390/preempt: Enable HAS_SEPARATE_PREEMPT_RESCHED_BITS 2026-08-10 10:50:20 +02:00
maccess.h s390/mm: define Real Memory Copy size and mask macros 2023-08-16 15:13:02 +02:00
machine.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
march.h s390: Allow to compile with z17 optimizations 2025-04-09 12:12:41 +02:00
mem_encrypt.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
mmu_context.h KVM: s390: Switch to new gmap 2026-02-04 17:00:10 +01:00
mmu.h KVM: S390: Remove PGSTE code from linux/s390 mm 2026-02-04 17:00:10 +01:00
module.h s390/module: Provide find_section() helper 2024-09-13 17:28:36 +02:00
msi.h
nmi.h KVM: s390: Fix memory corruption by not reinjecting CK machine checks 2026-08-11 10:45:56 +02:00
nospec-branch.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
nospec-insn.h s390/vmlinux.lds.S: Prevent thunk functions from getting placed with normal text 2025-10-14 14:45:21 -07:00
numa.h
os_info.h s390/os_info: Fix array size in struct os_info 2024-04-29 17:33:29 +02:00
page-states.h s390: Remove __bootdata annotations from declarations 2024-12-15 16:19:04 +01:00
page.h mm: convert do_brk_flags() to use vma_flags_t 2026-04-05 13:53:40 -07:00
pai.h s390/pai: Support CPU hotplug for PMU PAI 2026-09-08 15:53:40 +02:00
pci_clp.h s390/pci: check for relaxed translation capability 2025-02-21 12:01:57 +01:00
pci_debug.h
pci_dma.h iommu/s390: allow larger region tables 2025-04-17 16:43:12 +02:00
pci_insn.h iommu/s390: Make attach succeed when the device was surprise removed 2025-09-05 15:11:09 +02:00
pci_io.h s390/Kconfig: Define non-zero ILLEGAL_POINTER_VALUE 2026-01-27 12:21:20 +01:00
pci.h vfio-pci/zdev: Add a device feature for error information 2026-08-13 11:36:55 -06:00
percpu.h s390/percpu: Fix MVIY_PERCPU() with older binutils 2026-08-13 16:56:45 +02:00
perf_event.h Performance events changes for v6.13: 2024-11-19 13:34:06 -08:00
pfault.h s390/pfault: cleanup inline assemblies 2023-07-29 14:57:18 +02:00
pgalloc.h KVM: S390: Remove PGSTE code from linux/s390 mm 2026-02-04 17:00:10 +01:00
pgtable.h mm: decouple protnone helpers from CONFIG_NUMA_BALANCING 2026-08-04 19:18:36 -07:00
physmem_info.h s390/boot: Add physmem tracking debug support 2025-01-26 17:24:02 +01:00
pkey.h s390/crypto: Replace cond_resched() with msleep(1) 2026-08-05 15:16:54 +02:00
pnet.h
preempt.h s390/preempt: Enable HAS_SEPARATE_PREEMPT_RESCHED_BITS 2026-08-10 10:50:20 +02:00
processor.h s390/topology: Switch to common cpu capacity code 2026-08-31 16:25:39 +02:00
ptrace.h s390/traps: Remove PIF_GUEST_FAULT 2026-07-30 00:29:08 +02:00
purgatory.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
qdio.h s390/cio: use bitwise types to allow for type checking 2024-03-13 09:23:46 +01:00
runtime_instr.h
runtime-const.h s390/runtime-const: Introduce runtime_const_mask_32() 2026-07-29 13:17:52 +02:00
rwonce.h s390: Remove superfluous newlines from inline assemblies 2025-09-29 13:52:08 +02:00
schid.h
sclp.h s390/sclp: Allow SCLP Action Qualifiers for Spyre card status reporting 2026-07-31 13:31:30 +02:00
scsw.h s390/cio: use bitwise types to allow for type checking 2024-03-13 09:23:46 +01:00
seccomp.h s390: Remove compat support 2025-11-17 11:10:38 +01:00
sections.h s390/amode31: change type of __samode31, __eamode31, etc 2023-08-30 11:03:27 +02:00
set_memory.h - The series "zram: optimal post-processing target selection" from 2024-11-23 09:58:07 -08:00
setup.h s390/setup: Drop stale ident_map_size declaration 2026-03-05 21:08:50 +01:00
signal.h
sigp.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
skey.h s390/skey: Provide infrastructure for executing with non-default access key 2025-06-29 13:12:02 +02:00
smp.h s390/topology: Switch to common cpu capacity code 2026-08-31 16:25:39 +02:00
softirq_stack.h s390: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
sparsemem.h s390/sparsemem: Provide phys_to_target_node() with CONFIG_NUMA 2024-11-07 10:33:44 +01:00
spinlock_types.h Improve consistency of '#error' directive messages 2024-11-11 17:17:04 -08:00
spinlock.h s390: Remove superfluous newlines from inline assemblies 2025-09-29 13:52:08 +02:00
stackprotector.h s390: Add stackprotector support 2025-11-24 11:45:21 +01:00
stacktrace.h KVM: s390: vsie: Avoid injecting machine check on signal 2026-03-16 16:56:39 +01:00
stp.h s390/time: Add PtP driver 2024-10-30 17:02:39 -07:00
string.h s390/string: Remove strlcat() implementation 2026-05-30 11:37:25 +02:00
syscall_wrapper.h s390: Remove compat support 2025-11-17 11:10:38 +01:00
syscall.h syscall_user_dispatch: Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH 2026-07-14 16:34:07 +02:00
sysinfo.h s390/sysinfo: Move stsi() to header file 2025-03-04 17:18:07 +01:00
text-patching.h
thread_info.h s390: Enable TIF_POLLING_NRFLAG 2026-07-08 17:03:28 +02:00
timex.h treewide: Remove CLOCK_TICK_RATE 2026-07-15 15:04:55 +02:00
tlb.h Loongarch: 2026-02-13 11:31:15 -08:00
tlbflush.h s390/mm: Remove unused flush_tlb() 2025-11-14 11:34:27 +01:00
tod_types.h s390/timex: Move union tod_clock type to separate header 2026-06-15 16:33:40 +02:00
topology.h s390/smp: Add support for HOTPLUG_SMT 2025-03-31 12:20:39 +02:00
tpi.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
trace_clock.h s390/tracing: Add s390-tod clock 2026-05-26 08:15:41 +02:00
types.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
uaccess.h uaccess: unify inline vs outline copy_{from,to}_user() selection 2026-05-28 21:24:44 -07:00
unistd.h s390/syscalls: Switch to generic system call table generation 2025-11-17 11:10:39 +01:00
unwind.h
uprobes.h
user.h
uv.h KVM: s390: Remove cond_resched() calls 2026-08-05 15:16:54 +02:00
vdso-symbols.h s390/vdso: Rename vdso64 to vdso 2025-11-25 15:28:07 +01:00
vdso.h s390: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers 2025-06-16 16:23:02 +02:00
vmalloc.h
vmlinux.lds.h
vtime.h s390/irq/idle: Use stcke instead of stckf for time stamps 2026-06-15 16:33:40 +02:00
vtimer.h
word-at-a-time.h s390: Add support for DCACHE_WORD_ACCESS (again) 2026-07-30 00:29:11 +02:00