From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
akpm@osdl.org, Peter Zijlstra <peterz@infradead.org>,
stable@kernel.org
Subject: [PATCH] hrtimer: prevent migration for raising softirq
Date: Thu, 3 Jul 2008 14:31:26 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.58.0807031428440.7798@gandalf.stny.rr.com> (raw)
Due to a possible deadlock, the waking of the softirq was pushed outside
of the hrtimer base locks. See commit 0c96c5979a522c3323c30a078a70120e29b5bdbc
Unfortunately this allows the task to migrate after setting up the softirq
and raising it. Since softirqs run a queue that is per-cpu we may raise the
softirq on the wrong CPU and this will keep the queued softirq task from
running.
To solve this issue, this patch disables preemption around the releasing
of the hrtimer lock and raising of the softirq.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/hrtimer.c | 8 ++++++++
1 file changed, 8 insertions(+)
Index: linus.git/kernel/hrtimer.c
===================================================================
--- linus.git.orig/kernel/hrtimer.c 2008-05-09 15:11:45.000000000 -0400
+++ linus.git/kernel/hrtimer.c 2008-07-03 14:07:30.000000000 -0400
@@ -1003,10 +1003,18 @@ hrtimer_start(struct hrtimer *timer, kti
*/
raise = timer->state == HRTIMER_STATE_PENDING;
+ /*
+ * We use preempt_disable to prevent this task from migrating after
+ * setting up the softirq and raising it. Otherwise, if me migrate
+ * we will raise the softirq on the wrong CPU.
+ */
+ preempt_disable();
+
unlock_hrtimer_base(timer, &flags);
if (raise)
hrtimer_raise_softirq();
+ preempt_enable();
return ret;
}
next reply other threads:[~2008-07-03 18:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-03 18:31 Steven Rostedt [this message]
2008-07-03 22:53 ` Andrew Morton
2008-07-04 1:56 ` Steven Rostedt
2008-07-04 2:03 ` Andrew Morton
2008-07-04 2:20 ` 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=Pine.LNX.4.58.0807031428440.7798@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=stable@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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
all inboxes | Powered by JetHome®