From: Steven Rostedt <rostedt@goodmis.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: dwalker@mvista.com, linux-kernel@vger.kernel.org
Subject: Re: 2.6.13-rt1
Date: Mon, 29 Aug 2005 23:33:50 -0400 [thread overview]
Message-ID: <1125372830.6096.7.camel@localhost.localdomain> (raw)
In-Reply-To: <20050829084829.GA23176@elte.hu>
Ingo,
I just found another deadlock in the pi_lock logic. The PI logic is
very dependent on the P1->L1->P2->L2->P3 order. But our good old friend
is back, the BKL.
Since the BKL is let go and regrabbed even if a task is grabbing another
lock, it messes up the order. For example, it can do the following:
L1->P1->L2->P2->L1 if L1 is the BKL. Luckly, (and I guess there's
really no other way) the BKL is only held by those that are currently
running, or at least not blocked on anyone. So I added code in the
pi_setprio code to test if the next lock in the loop is the BKL and if
so, if its owner is the current task. If so, the loop is broken.
Without this patch, I would constantly get lock ups on shutdown where it
sends SIGTERM to all the processes. It usually would lock up on the
killing of udev. But with the patch, I've shutdown a few times already
and no lockups so far.
-- Steve
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Index: linux_realtime_goliath/kernel/rt.c
===================================================================
--- linux_realtime_goliath/kernel/rt.c (revision 308)
+++ linux_realtime_goliath/kernel/rt.c (working copy)
@@ -816,6 +816,21 @@
l = w->lock;
TRACE_BUG_ON_LOCKED(!lock);
+ /*
+ * The BKL can really be a pain. It can happen that the lock
+ * we are blocked on is owned by a task that is waiting for
+ * the BKL, and we own it. So, if this is the BKL and we own
+ * it, then end the loop here.
+ */
+ if (unlikely(l == &kernel_sem.lock) && lock_owner(l) == current_thread_info()) {
+ /*
+ * No locks are held for locks, so fool the unlocking code
+ * by thinking the last lock was the original.
+ */
+ l = lock;
+ break;
+ }
+
if (l != lock)
__raw_spin_lock(&l->wait_lock);
next prev parent reply other threads:[~2005-08-30 3:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-29 8:48 2.6.13-rt1 Ingo Molnar
2005-08-29 11:09 ` 2.6.13-rt1 Steven Rostedt
2005-08-29 11:18 ` 2.6.13-rt1 Ingo Molnar
2005-08-29 15:04 ` 2.6.13-rt1 Daniel Walker
2005-08-29 15:18 ` 2.6.13-rt1 Ingo Molnar
2005-08-29 15:19 ` 2.6.13-rt1 Daniel Walker
2005-08-30 3:33 ` Steven Rostedt [this message]
2005-08-30 5:53 ` 2.6.13-rt1 Ingo Molnar
2005-08-30 13:06 ` 2.6.13-rt1 Steven Rostedt
2005-08-30 22:34 ` 2.6.13-rt1 Daniel Walker
2005-08-31 1:10 ` 2.6.13-rt1 Steven Rostedt
2005-08-30 22:42 ` [PATCH] PREEMPT_RT vermagic Daniel Walker
2005-08-31 7:20 ` Ingo Molnar
2005-08-31 14:29 ` Tom Rini
2005-08-31 15:19 ` Tom Rini
-- strict thread matches above, loose matches on Subject: below --
2005-08-29 13:02 2.6.13-rt1 Hubert Tonneau
2005-08-29 16:11 ` 2.6.13-rt1 Bill Davidsen
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=1125372830.6096.7.camel@localhost.localdomain \
--to=rostedt@goodmis.org \
--cc=dwalker@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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