You are not logged in.

#1 2025-11-25 13:25:38

phil2sat
Member
Registered: 2025-11-25
Posts: 6

Kernel 6.17.9 panic when using CPU hotplug (zswap)

Summary:
Kernel 6.17.9 triggers a reproducible kernel panic when zswap is enabled and CPU hotplug is used (e.g., via GameMode park_cores).
Kernel 6.15.x works perfectly under identical conditions → regression.

System Information

CPU: AMD Ryzen 7 4700U (8C/8T)

Kernel: 6.17.8-arch1-1 (crashes), 6.15.x (working)

Distribution: Arch Linux

Hardware: Lenovo IdeaPad LNVNB161216

Trigger: GameMode dynamically parking CPU cores

GameMode config:

[cpu]
park_cores=1,3,5,7

Reproduction Steps

Enable GameMode with park_cores

Launch any Proton/Lutris game

GameMode parks CPU cores via CPU hotplug

System enters memory pressure

Immediate kernel panic in kswapd0

Crash Details

BUG: unable to handle page fault for address: ffff8e06b3b09000
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
Oops: Oops: 0002 [#1] SMP NOPTI

Call Trace:

_raw_spin_lock_bh+0x1b/0x40
crypto_acomp_lock_stream_bh+0x34/0xb0
zstd_compress+0x81/0x310
zswap_store+0x466/0xba0
swap_writeout+0x110/0x300
shmem_writeout+0x305/0x460
shrink_folio_list+0x5da/0xf20
evict_folios+0x2cd/0x790
kswapd+0x1d9/0x370

CR2 register:

CR2: ffff8e06b3b09000 (invalid per-CPU data address)

Analysis

The crash is caused by zswap using a per-CPU async compression context (acomp_ctx) belonging to a CPU that has just been taken offline.

Sequence:

GameMode parks CPU → CPU hot-plug offline event

zswap compression begins, storing a pointer to the per-CPU acomp_ctx

CPU goes offline → its per-CPU memory becomes invalid

kswapd0 tries to access the now-nonexistent per-CPU structure

→ _raw_spin_lock_bh() faults on an invalid GS address

→ kernel panic

This matches upstream reports:

Red Hat Bug
https://bugzilla.redhat.com/show_bug.cgi?id=2269550

LKML thread
https://lkml.org/lkml/2025/1/8/29

Proposed patch (not yet in mainline or Arch stable)
https://www.spinics.net/lists/stable/msg806293.html

Additional Confirmation

With zswap enabled:

echo 0 > /sys/devices/system/cpu/cpu7/online

→ immediate kernel panic

With zswap disabled:

echo 0 > /sys/module/zswap/parameters/enabled
echo 0 > /sys/devices/system/cpu/cpu7/online

CPU 7 goes offline cleanly

This confirms:
The bug is in zswap, not CPU hotplug itself.

Workarounds
1. Disable zswap completely (recommended until fixed)

Add to kernel command line:

zswap.enabled=0

2. Avoid CPU hotplug; use CPU pinning instead

GameMode:

[cpu]
;park_cores=1,3,5,7
pin_cores=0,2,4,6

Regression Window

6.15.x → OK

6.17.8 → panic
Likely introduced between 6.16 and 6.17 when zswap’s per-CPU async compressor code was reworked.

Last edited by phil2sat (2025-11-26 12:58:57)

Offline

#2 2025-11-25 16:27:37

system72
Member
Registered: 2025-11-22
Posts: 542
Website

Re: Kernel 6.17.9 panic when using CPU hotplug (zswap)

this looks like ai

Offline

#3 2025-11-25 17:30:26

phil2sat
Member
Registered: 2025-11-25
Posts: 6

Re: Kernel 6.17.9 panic when using CPU hotplug (zswap)

nah, its me, just researched and put all together with maybe a little bit of ai formatting help, lol.

just upgraded and bam, bluescreen, what the heck...

if im back home i try the patch again.

Offline

#4 2025-11-25 18:53:09

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,337

Re: Kernel 6.17.9 panic when using CPU hotplug (zswap)

Next time tell the AI to use https://bbs.archlinux.org/help.php#bbcode formatting tongue
For now please edit your post and provide that yourself, thanks smile

Kernel 6.15.x: Works perfectly with park_cores
Kernel 6.17.8: Instant panic with park_cores
Regression introduced somewhere between 6.15 and 6.17

zswap appears to be enabled by default even without explicit configuration

zswap used to be disabled for a couple of kernels, is/was it enabled on the unaffected 6.15 kernel(s)?

x-ref, https://bbs.archlinux.org/viewtopic.php?id=309640

Offline

#5 2025-11-26 12:21:08

phil2sat
Member
Registered: 2025-11-25
Posts: 6

Re: Kernel 6.17.9 panic when using CPU hotplug (zswap)

Fixed in 6.17.9

cat /sys/module/zswap/parameters/enabled                             
─────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
     │ File: /sys/module/zswap/parameters/enabled
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1 │ Y

echo 0 > /sys/devices/system/cpu/cpu7/online
dmesg
smpboot: CPU 7 is now offline

no panic...

Offline

#6 2025-11-26 12:58:20

phil2sat
Member
Registered: 2025-11-25
Posts: 6

Re: Kernel 6.17.9 panic when using CPU hotplug (zswap)

Not fixed if multiple CPU's go offline the error occurs again (GameMode)

Offline

#7 2025-12-01 17:24:20

gromit
Administrator
From: Germany
Registered: 2024-02-10
Posts: 1,498
Website

Re: Kernel 6.17.9 panic when using CPU hotplug (zswap)

Is the error still present on 6.18?

sudo pacman -U https://pkgbuild.com/~gromit/linux-bisection-kernels/linux-mainline-6.18-1-x86_64.pkg.tar.zst

Offline

Board footer

Powered by FluxBB