Re: [PATCH 1/4] workqueue: Reap workers via kthread_stop() and remove detach_completion

From: Marc Hartmayer
Date: Tue Sep 10 2024 - 05:47:22 EST


On Tue, Jul 23, 2024 at 06:19 PM +0200, "Marc Hartmayer" <mhartmay@xxxxxxxxxxxxx> wrote:
> On Fri, Jun 21, 2024 at 03:32 PM +0800, Lai Jiangshan <jiangshanlai@xxxxxxxxx> wrote:
>> From: Lai Jiangshan <jiangshan.ljs@xxxxxxxxxxxx>
>>
>> The code to kick off the destruction of workers is now in a process
>> context (idle_cull_fn()), so kthread_stop() can be used in the process
>> context to replace the work of pool->detach_completion.
>>
>> The wakeup in wake_dying_workers() is unneeded after this change, but it
>> is harmless, jut keep it here until next patch renames wake_dying_workers()
>> rather than renaming it again and again.
>>
>> Cc: Valentin Schneider <vschneid@xxxxxxxxxx>
>> Signed-off-by: Lai Jiangshan <jiangshan.ljs@xxxxxxxxxxxx>
>> ---
>> kernel/workqueue.c | 35 +++++++++++++++++++----------------
>> 1 file changed, 19 insertions(+), 16 deletions(-)
>>
>

Hi Lai,

I’m not sure if this NULL-pointer crash is related to this patch series
or not. But it is triggered by the same test that also triggered the
other problem that I reported.

[ 23.133876] Unable to handle kernel pointer dereference in virtual kernel address space
[ 23.133950] Failing address: 0000000000000000 TEID: 0000000000000483
[ 23.133954] Fault in home space mode while using kernel ASCE.
[ 23.133957] AS:000000001b8f0007 R3:0000000056cf4007 S:0000000056cf3800 P:000000000000003d
[ 23.134207] Oops: 0004 ilc:2 [#1] SMP
[ 23.134273] Modules linked in: essiv authenc dm_crypt encrypted_keys loop pkey zcrypt s390_trng rng_core ghash_s390 prng chacha_s390 libchacha aes_s390 des_s390 virtio_console libdes vmw_vsock_virtio_transport vmw_vsock_virtio_transport_common sha3_512_s390 vsock sha3_256_s390 sha512_s390 sha256_s390 sha1_s390 sha_common vfio_ccw mdev vfio_iommu_type1 vfio sch_fq_codel drm i2c_core drm_panel_orientation_quirks configfs autofs4
[ 23.134386] CPU: 0 UID: 0 PID: 376 Comm: kworker/u10:2 Not tainted 6.11.0-20240902.rc6.git1.67784a74e258.300.fc40.s390x+git #1
[ 23.134394] Hardware name: IBM 8561 T01 703 (KVM/Linux)
[ 23.134406] Workqueue: 0x0 ()
[ 23.134440] Krnl PSW : 0404c00180000000 0000024e326caf28 (worker_thread+0x48/0x430)
[ 23.134471] R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
[ 23.134474] Krnl GPRS: 0000000058778000 0000000000000000 0000024e00000001 0000000058778000
[ 23.134476] 0000000000000000 0000000058778000 0000000057b8e240 0000000000000002
[ 23.134480] 0000000000000000 0000000000000028 0000000000000000 0000000057b8e240
[ 23.134481] 0000000058778000 0000000058778000 0000024e326caf18 000001ce32953d88
[ 23.134499] Krnl Code: 0000024e326caf1c: acfcf0c8 stnsm 200(%r15),252
[ 23.134499] 0000024e326caf20: a7180000 lhi %r1,0
[ 23.134499] #0000024e326caf24: 582083ac l %r2,940(%r8)
[ 23.134499] >0000024e326caf28: ba12a000 cs %r1,%r2,0(%r10)
[ 23.134499] 0000024e326caf2c: a77400cf brc 7,0000024e326cb0ca
[ 23.134499] 0000024e326caf30: 5800b078 l %r0,120(%r11)
[ 23.134499] 0000024e326caf34: a7010002 tmll %r0,2
[ 23.134499] 0000024e326caf38: a77400d4 brc 7,0000024e326cb0e0
[ 23.134516] Call Trace:
[ 23.134520] [<0000024e326caf28>] worker_thread+0x48/0x430
[ 23.134525] ([<0000024e326caf18>] worker_thread+0x38/0x430)
[ 23.134528] [<0000024e326d3a3e>] kthread+0x11e/0x130
[ 23.134533] [<0000024e3264b0dc>] __ret_from_fork+0x3c/0x60
[ 23.134536] [<0000024e333fb37a>] ret_from_fork+0xa/0x38
[ 23.134552] Last Breaking-Event-Address:
[ 23.134553] [<0000024e333f4c04>] mutex_unlock+0x24/0x30
[ 23.134562] Kernel panic - not syncing: Fatal exception: panic_on_oops

This happened with Linux
6.11.0-20240902.rc6.git1.67784a74e258.300.fc40.s390x (using defconfig),
but also with an older commit
6.11.0-20240719.rc0.git15.720261cfc732.300.fc40.s390x on s390x (both
kernels contain your patches). I have not bisected/debugged the
problem yet, but you may have an idea already. Will try to reproduce the
problem and give you more debug information.

Thanks!

[…snip]

--
Kind regards / Beste Grüße
Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294