WARNING: at kernel/workqueue.c:1473 __queue_work+0x3b8/0x3d0

From: Corentin Labbe
Date: Mon Feb 17 2020 - 15:48:10 EST


Hello

When running some CI test jobs (targeting crypto tests), I always get the following WARNING:
[ 7.886361] ------------[ cut here ]------------
[ 7.886388] WARNING: CPU: 2 PID: 147 at kernel/workqueue.c:1473 __queue_work+0x3b8/0x3d0
[ 7.886394] Modules linked in: ghash_generic
[ 7.886409] CPU: 2 PID: 147 Comm: modprobe Not tainted 5.6.0-rc1-next-20200214-00068-g166c9264f0b1-dirty #545
[ 7.886414] Hardware name: Pine H64 model A (DT)
[ 7.886422] pstate: a0000085 (NzCv daIf -PAN -UAO)
[ 7.886429] pc : __queue_work+0x3b8/0x3d0
[ 7.886436] lr : __queue_work+0x1dc/0x3d0
[ 7.886440] sp : ffff800012073b50
[ 7.886445] x29: ffff800012073b50 x28: ffff8000117bb590
[ 7.886452] x27: 0000000000000100 x26: ffff80001132d018
[ 7.886460] x25: ffff800011336d58 x24: ffff800011629920
[ 7.886467] x23: ffff80001132d018 x22: 000000000000000e
[ 7.886474] x21: 0000000000000002 x20: ffff0000b9c08000
[ 7.886481] x19: ffff0000bd9b8400 x18: 0000000000000000
[ 7.886488] x17: 0000000000000000 x16: 0000000000000000
[ 7.886495] x15: 0000af8c526b5c68 x14: 02be881212d8d480
[ 7.886503] x13: 0000000000000352 x12: 0000000000000001
[ 7.886510] x11: 0000000000000400 x10: 0000000000000040
[ 7.886517] x9 : ffff80001163f5e8 x8 : ffff80001163f5e0
[ 7.886524] x7 : ffff0000b9800028 x6 : 0000000000000000
[ 7.886531] x5 : ffff0000b9800000 x4 : 0000000000000000
[ 7.886538] x3 : ffff0000bd9b4800 x2 : 0000000000000001
[ 7.886545] x1 : 0000000000000000 x0 : ffff8000117bb598
[ 7.886552] Call trace:
[ 7.886560] __queue_work+0x3b8/0x3d0
[ 7.886567] queue_work_on+0x6c/0x90
[ 7.886576] do_init_module+0x188/0x1f0
[ 7.886582] load_module+0x1d00/0x22b0
[ 7.886589] __do_sys_finit_module+0xd0/0xe8
[ 7.886595] __arm64_sys_finit_module+0x1c/0x28
[ 7.886605] el0_svc_common.constprop.0+0x68/0x160
[ 7.886613] do_el0_svc+0x20/0x80
[ 7.886621] el0_sync_handler+0x10c/0x180
[ 7.886627] el0_sync+0x140/0x180
[ 7.886638] ---[ end trace a44615ff285cb96c ]---
[ 7.886643] WARN for events

For finding what was cause this, I have added the following debug:
@@ -1468,8 +1470,10 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
/* pwq determined, queue */
trace_workqueue_queue_work(req_cpu, pwq, work);

- if (WARN_ON(!list_empty(&work->entry)))
+ if (WARN_ON(!list_empty(&work->entry))) {
+ pr_err("WARN for %s\n", wq->name);
goto out;
+ }

So it seems that it is a "events" workqueue that hit this problem.

Note that classic defconfig do not hit this problem, since it appears with the following config change:
-CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
+# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
+CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y

I dont see any relation between crypto and this problem, but this problem with this config change is reproductible.

Regards