From: Steven Rostedt <rostedt@goodmis.org>
To: Esben Nielsen <simlo@phys.au.dk>
Cc: Bill Huey <billh@gnuppy.monkey.org>, Ingo Molnar <mingo@elte.hu>,
david singleton <dsingleton@mvista.com>,
linux-kernel@vger.kernel.org
Subject: Re: RT Mutex patch and tester [PREEMPT_RT]
Date: Mon, 23 Jan 2006 09:23:34 -0500 [thread overview]
Message-ID: <1138026214.6762.204.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0601231029090.5144-100000@lifa01.phys.au.dk>
On Mon, 2006-01-23 at 10:33 +0100, Esben Nielsen wrote:
> On Sun, 22 Jan 2006, Bill Huey wrote:
>
> > On Mon, Jan 23, 2006 at 01:20:12AM +0100, Esben Nielsen wrote:
> > > Here is the problem:
> > >
> > > Task B (non-RT) takes BKL. It then takes mutex 1. Then B
> > > tries to lock mutex 2, which is owned by task C. B goes blocks and releases the
> > > BKL. Our RT task A comes along and tries to get 1. It boosts task B
> > > which boosts task C which releases mutex 2. Now B can continue? No, it has
> > > to reaquire BKL! The netto effect is that our RT task A waits for BKL to
> > > be released without ever calling into a module using BKL. But just because
> > > somebody in some non-RT code called into a module otherwise considered
> > > safe for RT usage with BKL held, A must wait on BKL!
> >
> > True, that's major suckage, but I can't name a single place in the kernel that
> > does that.
>
> Sounds good. But someone might put it in...
Hmm, I wouldn't be surprised if this is done somewhere in the VFS layer.
>
> > Remember, BKL is now preemptible so the place that it might sleep
> > similar
> > to the above would be in spinlock_t definitions.
> I can't see that from how it works. It is explicitly made such that you
> are allowed to use semaphores with BKL held - and such that the BKL is
> released if you do.
Correct. I hope you didn't remove my comment in the rt.c about BKL
being a PITA :) (Ingo was nice enough to change my original patch to use
the acronym.)
>
> > But BKL is held across schedules()s
> > so that the BKL semantics are preserved.
> Only for spinlock_t now rt_mutex operation, not for semaphore/mutex
> operations.
> > Contending under a priority inheritance
> > operation isn't too much of a problem anyways since the use of it already
> > makes that
> > path indeterminant.
> The problem is that you might hit BKL because of what some other low
> priority task does, thus making your RT code indeterministic.
I disagree here. The fact that you grab a semaphore that may also be
grabbed by a path while holding the BKL means that grabbing that
semaphore may be blocked on the BKL too. So the length of grabbing a
semaphore that can be grabbed while also holding the BKL is the length
of the critical section of the semaphore + the length of the longest BKL
hold.
Just don't let your RT tasks grab semaphores that can be grabbed while
also holding the BKL :)
But the main point is that it is still deterministic. Just that it may
be longer than one thinks.
>
> > Even under contention, a higher priority task above A can still
> > run since the kernel is preemptive now even when manipulating BKL.
>
> No, A waits for BKL because it waits for B which waits for the BKL.
Right.
-- Steve
PS. I might actually get around to testing your patch today :) That is,
if -rt12 passes all my tests.
next prev parent reply other threads:[~2006-01-23 14:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-11 17:25 RT Mutex patch and tester [PREEMPT_RT] Esben Nielsen
2006-01-11 17:51 ` Steven Rostedt
2006-01-11 21:45 ` Esben Nielsen
2006-01-12 11:33 ` Bill Huey
2006-01-12 12:54 ` Esben Nielsen
2006-01-13 8:07 ` Bill Huey
2006-01-13 8:47 ` Esben Nielsen
2006-01-13 10:19 ` Bill Huey
2006-01-15 4:24 ` Bill Huey
2006-01-16 8:35 ` Esben Nielsen
2006-01-16 10:22 ` Bill Huey
2006-01-16 10:53 ` Bill Huey
2006-01-16 11:30 ` Esben Nielsen
[not found] ` <Pine.LNX.4.44L0.0601181120100.1993-201000@lifa02.phys.au.dk>
2006-01-18 10:38 ` Ingo Molnar
2006-01-18 12:49 ` Steven Rostedt
2006-01-18 14:18 ` Esben Nielsen
[not found] ` <Pine.LNX.4.44L0.0601230047290.31387-201000@lifa01.phys.au.dk>
2006-01-23 0:38 ` david singleton
2006-01-23 2:04 ` Bill Huey
2006-01-23 9:33 ` Esben Nielsen
2006-01-23 14:23 ` Steven Rostedt [this message]
2006-01-23 15:14 ` Esben Nielsen
2006-01-27 15:18 ` Esben Nielsen
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=1138026214.6762.204.camel@localhost.localdomain \
--to=rostedt@goodmis.org \
--cc=billh@gnuppy.monkey.org \
--cc=dsingleton@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=simlo@phys.au.dk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.