From: Steven Rostedt <rostedt@goodmis.org>
To: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-rt-users <linux-rt-users@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
John Kacur <jkacur@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Sasha Levin <sasha.levin@oracle.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 3.14-rt] sched/numa: Fix task_numa_free() lockdep splat
Date: Tue, 27 May 2014 14:18:36 -0400 [thread overview]
Message-ID: <20140527141836.4f466086@gandalf.local.home> (raw)
In-Reply-To: <1400297819.9493.11.camel@marge.simpson.net>
[ moving this to LKML from linux-rt-users, as that's where it should be ]
On Sat, 17 May 2014 05:36:59 +0200
Mike Galbraith <umgwanakikbuti@gmail.com> wrote:
> 3.14-rt being build with a non-rt config is unlikely, but..
>
> >From 60e69eed85bb7b5198ef70643b5895c26ad76ef7 Mon Sep 17 00:00:00 2001
> From: Mike Galbraith <bitbucket@online.de>
> Date: Mon, 7 Apr 2014 10:55:15 +0200
> Subject: [PATCH] sched/numa: Fix task_numa_free() lockdep splat
>
> Sasha reported that lockdep claims that the following commit:
> made numa_group.lock interrupt unsafe:
>
> 156654f491dd ("sched/numa: Move task_numa_free() to __put_task_struct()")
>
> While I don't see how that could be, given the commit in question moved
> task_numa_free() from one irq enabled region to another, the below does
> make both gripes and lockups upon gripe with numa=fake=4 go away.
It wasn't the irqs that was causing the lockdep splat, but the
softirqs. You moved it into __put_task_struct() which is called as a
rcu callback that gets called from soft irqs. So yes, you need to
prevent softirqs from happening whenever you take the lock.
spin_lock_irq() is a bigger hammer than needed. The patch below should
be good enough.
I kept the double_lock_irq() as there is no double_lock_bh(). Should we
bother to make one?
-- Steve
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 7570dd9..f072ea9 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1497,7 +1497,7 @@ static void task_numa_placement(struct task_struct *p)
/* If the task is part of a group prevent parallel updates to group stats */
if (p->numa_group) {
group_lock = &p->numa_group->lock;
- spin_lock_irq(group_lock);
+ spin_lock_bh(group_lock);
}
/* Find the node with the highest number of faults */
@@ -1572,7 +1572,7 @@ static void task_numa_placement(struct task_struct *p)
}
}
- spin_unlock_irq(group_lock);
+ spin_unlock_bh(group_lock);
}
/* Preferred node as the node with the most faults */
@@ -1711,14 +1711,14 @@ void task_numa_free(struct task_struct *p)
void *numa_faults = p->numa_faults_memory;
if (grp) {
- spin_lock_irq(&grp->lock);
+ spin_lock_bh(&grp->lock);
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_bh(&grp->lock);
rcu_assign_pointer(p->numa_group, NULL);
put_numa_group(grp);
}
next prev parent reply other threads:[~2014-05-27 18:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 18:12 [ANNOUNCE] 3.14.3-rt5 Sebastian Andrzej Siewior
2014-05-09 22:54 ` Pavel Vasilyev
2014-05-13 15:33 ` Sebastian Andrzej Siewior
2014-05-10 4:15 ` Mike Galbraith
2014-05-13 15:40 ` Sebastian Andrzej Siewior
2014-05-14 3:10 ` Mike Galbraith
2014-05-16 13:53 ` [patch] rt/sched: fix resursion when CONTEXT_TRACKING and PREEMPT_LAZY are enabled Mike Galbraith
2014-05-25 8:16 ` [patch v2] " Mike Galbraith
2014-05-13 13:30 ` [ANNOUNCE] 3.14.3-rt5 Juri Lelli
2015-02-16 11:29 ` Sebastian Andrzej Siewior
2015-02-16 12:34 ` Juri Lelli
[not found] ` <1400297819.9493.11.camel@marge.simpson.net>
2014-05-27 18:18 ` Steven Rostedt [this message]
2014-05-27 18:25 ` [PATCH 3.14-rt] sched/numa: Fix task_numa_free() lockdep splat Peter Zijlstra
2014-05-27 18:52 ` Steven Rostedt
2014-05-27 18:53 ` Steven Rostedt
2014-06-05 14:33 ` [tip:sched/urgent] sched/numa: Fix use of spin_{un}lock_irq() when interrupts are disabled tip-bot for Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140527141836.4f466086@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=bigeasy@linutronix.de \
--cc=jkacur@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=sasha.levin@oracle.com \
--cc=tglx@linutronix.de \
--cc=umgwanakikbuti@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).