From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Arnaud Lacombe <lacombar@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
laijs@cn.fujitsu.com, darren@dvhart.com, rostedt@goodmis.org,
mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] rtmutex: Permit rt_mutex_unlock() to be invoked with irqs disabled
Date: Sat, 20 Aug 2011 10:09:32 -0700 [thread overview]
Message-ID: <20110820170932.GA4261@linux.vnet.ibm.com> (raw)
In-Reply-To: <CACqU3MWYTzueDrvDqzq8_SB3WS6CWy-rJ=ZQC+QBHN8vkAwtnQ@mail.gmail.com>
On Fri, Aug 19, 2011 at 09:31:05PM -0400, Arnaud Lacombe wrote:
> Hi,
>
> On Sun, Jul 24, 2011 at 11:56 AM, Paul E. McKenney
> <paulmck@linux.vnet.ibm.com> wrote:
> > On Sun, Jul 24, 2011 at 11:00:41AM +0200, Thomas Gleixner wrote:
> >> On Sat, 23 Jul 2011, Paul E. McKenney wrote:
> >> > On Sun, Jul 24, 2011 at 02:05:13AM +0200, Thomas Gleixner wrote:
> >> > > On Sun, 24 Jul 2011, Thomas Gleixner wrote:
> >> > > > > > Thomas, I'm inclined to merge this, any objections?
> >> > > > >
> >> > > > > FWIW, it has been passing tests here.
> >> > > >
> >> > > > If it's only the unlock path, I'm fine with that change.
> >> > > >
> >> > > > Acked-by-me
> >> > >
> >> > > Hrmpft. That's requiring all places to take the lock irq safe. Not
> >> > > really amused. For -RT that's a hotpath and we can really do without
> >> > > the irq fiddling there. That needs a bit more thought.
> >> >
> >> > Indeed... If I make only some of the lock acquisitions irq safe, lockdep
> >> > will yell at me. And rightfully so, as that could result in deadlock.
> >> >
> >> > So, what did you have in mind?
> >>
> >> Have no real good idea yet for this. Could you grab rt and check
> >> whether you can observe any impact when the patch is applied?
> >
> > Hmmm, wait a minute... There might be a way to do this with zero
> > impact on the fastpath, given that I am allocating an rt_mutex on
> > the stack that is used only by RCU priority boosting, and that only
> > rt_mutex_init_proxy_locked(), rt_mutex_lock(), and rt_mutex_unlock()
> > are used.
> >
> > So I could do the following:
> >
> > o Use lockdep_set_class_and_name() to make the ->wait_lock()
> > field of my rt_mutex have a separate lockdep class. I guess
> > I should allocate a global variable for lock_class_key
> > rather than allocating it on the stack. ;-)
> >
> > o Make all calls from RCU priority boosting to rt_mutex_lock()
> > and rt_mutex_unlock() have irqs disabled.
> >
> > o Make __rt_mutex_slowlock() do the following when sleeping:
> >
> > raw_spin_unlock(&lock->wait_lock);
> >
> > debug_rt_mutex_print_deadlock(waiter);
> >
> > {
> > int was_disabled = irqs_disabled();
> >
> > if (was_disabled)
> > local_irq_enable();
> >
> FWIW, the final construct you opted for in -next:
>
> if (was_disabled = irqs_disabled())
> local_irq_enable();
>
> triggers:
>
> /linux/linux/kernel/rtmutex.c: In function '__rt_mutex_slowlock':
> /linux/linux/kernel/rtmutex.c:605:3: warning: suggest parentheses
> around assignment used as truth value
But I -do- have parentheses around that assignment!!!
Sigh, gcc strikes again. Does the following patch help? If so, I will
fold it into commit 83841f02.
Thanx, Paul
------------------------------------------------------------------------
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 0222e34..2548f44 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -602,7 +602,8 @@ __rt_mutex_slowlock(struct rt_mutex *lock, int state,
raw_spin_unlock(&lock->wait_lock);
- if (was_disabled = irqs_disabled())
+ was_disabled = irqs_disabled();
+ if (was_disabled)
local_irq_enable();
debug_rt_mutex_print_deadlock(waiter);
prev parent reply other threads:[~2011-08-20 17:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-19 20:14 [PATCH RFC] rtmutex: Permit rt_mutex_unlock() to be invoked with irqs disabled Paul E. McKenney
2011-07-21 11:32 ` Peter Zijlstra
2011-07-23 22:03 ` Paul E. McKenney
2011-07-23 23:20 ` Thomas Gleixner
2011-07-24 0:05 ` Thomas Gleixner
2011-07-24 5:17 ` Paul E. McKenney
2011-07-24 9:00 ` Thomas Gleixner
2011-07-24 15:56 ` Paul E. McKenney
2011-08-20 1:31 ` Arnaud Lacombe
2011-08-20 17:09 ` Paul E. McKenney [this message]
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=20110820170932.GA4261@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=darren@dvhart.com \
--cc=lacombar@gmail.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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