Skip to content

Commit

Permalink
s390: Fix unmatched preempt_disable() on exit
Browse files Browse the repository at this point in the history
exit_thread_runtime_instr() may return with preemption disabled,
leading to the following lockdep splat:

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:586
in_atomic(): 1, irqs_disabled(): 0, pid: 565, name: kworker/u2:0
no locks held by kworker/u2:0/565.
CPU: 0 PID: 565 Comm: kworker/u2:0 Not tainted 3.16.81-00145-gafe1c874fa44 #1
       00000000025dbbd8 00000000025dbbe8 0000000000000002 0000000000000000 
       00000000025dbc78 00000000025dbbf0 00000000025dbbf0 000000000098c55c 
       0000000000000000 00000000025d05b8 00000000025d1590 0000000000000000 
       0000000000000000 000000000000000c 00000000025dbbd8 0000000000000070 
       00000000009b7220 000000000098c55c 00000000025dbbd8 00000000025dbc20 
Call Trace:
([<000000000098c4ce>] show_trace+0xb6/0xd8)
 [<000000000098c592>] show_stack+0xa2/0xd8
 [<0000000000992c04>] dump_stack+0xc4/0x118
 [<0000000000191e20>] __might_sleep+0x230/0x238
 [<000000000099fbb0>] mutex_lock_nested+0x48/0x3d8
 [<000000000025e33e>] perf_event_exit_task+0x36/0x398
 [<0000000000158536>] do_exit+0x3ae/0xca0
 [<0000000000175826>] ____call_usermodehelper+0x136/0x148
 [<00000000009a550a>] kernel_thread_starter+0x6/0xc
 [<00000000009a5504>] kernel_thread_starter+0x0/0xc

This was fixed by commit 8d9047f "s390/runtime instrumentation:
simplify task exit handling" upstream, but that won't apply here.

Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  • Loading branch information
Ben Hutchings committed Feb 11, 2020
1 parent 1ce4b52 commit 3617d01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/s390/kernel/runtime_instr.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ void exit_thread_runtime_instr(void)
{
struct task_struct *task = current;

preempt_disable();
if (!task->thread.ri_cb)
return;
preempt_disable();
disable_runtime_instr();
kfree(task->thread.ri_cb);
task->thread.ri_signum = 0;
Expand Down

0 comments on commit 3617d01

Please sign in to comment.