* [PATCH] sched/numa: Fix use of spin_{un}lock_irq() when interrupts are disabled
@ 2014-05-27 19:52 Steven Rostedt
2014-05-27 20:20 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2014-05-27 19:52 UTC (permalink / raw)
To: LKML; +Cc: Peter Zijlstra, Thomas Gleixner, Mike Galbraith
As Peter Zijlstra told me, we have the following path:
do_exit()
exit_itimers()
itimer_delete()
spin_lock_irqsave(&timer->it_lock, &flags);
timer_delete_hook(timer);
kc->timer_del(timer) := posix_cpu_timer_del()
put_task_struct()
__put_task_struct()
task_numa_free()
spin_lock(&grp->lock);
Which means that task_numa_free() can be called with interrupts
disabled, which means that we should not be using spin_lock_irq() but
spin_lock_irqsave() instead. Otherwise we are enabling interrupts while
holding an interrupt unsafe lock!
Link: http://lkml.kernel.org/r/20140527182541.GH11096@twins.programming.kicks-ass.net
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 7570dd9..3ea16b0 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1707,18 +1707,19 @@ no_join:
void task_numa_free(struct task_struct *p)
{
struct numa_group *grp = p->numa_group;
- int i;
void *numa_faults = p->numa_faults_memory;
+ unsigned long flags;
+ int i;
if (grp) {
- spin_lock_irq(&grp->lock);
+ spin_lock_irqsave(&grp->lock, flags);
for (i = 0; i < NR_NUMA_HINT_FAULT_STATS *
nr_node_ids; i++) grp->faults[i] -= p->numa_faults_memory[i];
grp->total_faults -= p->total_numa_faults;
list_del(&p->numa_entry);
grp->nr_tasks--;
- spin_unlock_irq(&grp->lock);
+ spin_unlock_irqrestore(&grp->lock, flags);
rcu_assign_pointer(p->numa_group, NULL);
put_numa_group(grp);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched/numa: Fix use of spin_{un}lock_irq() when interrupts are disabled
2014-05-27 19:52 [PATCH] sched/numa: Fix use of spin_{un}lock_irq() when interrupts are disabled Steven Rostedt
@ 2014-05-27 20:20 ` Eric Dumazet
2014-05-27 21:03 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2014-05-27 20:20 UTC (permalink / raw)
To: Steven Rostedt; +Cc: LKML, Peter Zijlstra, Thomas Gleixner, Mike Galbraith
On Tue, 2014-05-27 at 15:52 -0400, Steven Rostedt wrote:
> As Peter Zijlstra told me, we have the following path:
>
> do_exit()
> exit_itimers()
> itimer_delete()
> spin_lock_irqsave(&timer->it_lock, &flags);
> timer_delete_hook(timer);
> kc->timer_del(timer) := posix_cpu_timer_del()
> put_task_struct()
> __put_task_struct()
> task_numa_free()
> spin_lock(&grp->lock);
>
>
> Which means that task_numa_free() can be called with interrupts
> disabled, which means that we should not be using spin_lock_irq() but
> spin_lock_irqsave() instead. Otherwise we are enabling interrupts while
> holding an interrupt unsafe lock!
>
> Link: http://lkml.kernel.org/r/20140527182541.GH11096@twins.programming.kicks-ass.net
>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
Your patch was mangled it seems...
Fixes: 60e69eed85bb ("sched/numa: Fix task_numa_free() lockdep splat")
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched/numa: Fix use of spin_{un}lock_irq() when interrupts are disabled
2014-05-27 20:20 ` Eric Dumazet
@ 2014-05-27 21:03 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2014-05-27 21:03 UTC (permalink / raw)
To: Eric Dumazet; +Cc: LKML, Peter Zijlstra, Thomas Gleixner, Mike Galbraith
On Tue, 27 May 2014 13:20:25 -0700
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Your patch was mangled it seems...
Grumble. One of these days I'm going to hack the claws-mail client to
fix it's random decisions to "format" the entire email :-p
>
> Fixes: 60e69eed85bb ("sched/numa: Fix task_numa_free() lockdep splat")
Thanks, I should have included that in my v2.
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-27 21:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-27 19:52 [PATCH] sched/numa: Fix use of spin_{un}lock_irq() when interrupts are disabled Steven Rostedt
2014-05-27 20:20 ` Eric Dumazet
2014-05-27 21:03 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®