From: Mike Galbraith <efault@gmx.de>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [ANNOUNCE] v4.11.5-rt1
Date: Sun, 18 Jun 2017 08:46:15 +0200 [thread overview]
Message-ID: <1497768375.8055.12.camel@gmx.de> (raw)
In-Reply-To: <1497687277.6908.31.camel@gmx.de>
On Sat, 2017-06-17 at 10:14 +0200, Mike Galbraith wrote:
>
>... the RT workaround in futex.c induces
> grumbling in nonrt builds with PREEMPT_COUNT enabled.
A trivial way to fix it up is to...
futex: Fix migrate_disable/enable workaround for !PREEMPT_RT_FULL
The imbalance fixed by aed0f50e58eb only exists for PREEMPT_RT_FULL,
and creates for other PREEMPT_COUNT configs. Create/use _rt variants
of migrate_disable/enable() which are compiled away when not needed.
Signed-off-by: Mike Galbraith <efault@gmx.de>
Fixes: aed0f50e58eb ("futex: workaround migrate_disable/enable in different context")
---
include/linux/preempt.h | 11 +++++++++++
kernel/futex.c | 8 ++++----
2 files changed, 15 insertions(+), 4 deletions(-)
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -227,12 +227,21 @@ do { \
extern void migrate_disable(void);
extern void migrate_enable(void);
+#ifdef CONFIG_PREEMPT_RT_FULL
+#define migrate_disable_rt() migrate_disable()
+#define migrate_enable_rt() migrate_enable()
+#else
+static inline void migrate_disable_rt(void) { }
+static inline void migrate_enable_rt(void) { }
+#endif
int __migrate_disabled(struct task_struct *p);
#else
#define migrate_disable() barrier()
#define migrate_enable() barrier()
+static inline void migrate_disable_rt(void) { }
+static inline void migrate_enable_rt(void) { }
static inline int __migrate_disabled(struct task_struct *p)
{
return 0;
@@ -323,6 +332,8 @@ do { \
#define migrate_disable() barrier()
#define migrate_enable() barrier()
+static inline void migrate_disable_rt(void) { }
+static inline void migrate_enable_rt(void) { }
static inline int __migrate_disabled(struct task_struct *p)
{
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2690,12 +2690,12 @@ static int futex_lock_pi(u32 __user *uad
* one migrate_disable() pending in the slow-path which is reversed
* after the raw_spin_unlock_irq() where we leave the atomic context.
*/
- migrate_disable();
+ migrate_disable_rt();
spin_unlock(q.lock_ptr);
ret = __rt_mutex_start_proxy_lock(&q.pi_state->pi_mutex, &rt_waiter, current);
raw_spin_unlock_irq(&q.pi_state->pi_mutex.wait_lock);
- migrate_enable();
+ migrate_enable_rt();
if (ret) {
if (ret == 1)
@@ -2846,13 +2846,13 @@ static int futex_unlock_pi(u32 __user *u
* won't undo the migrate_disable() which was issued when
* locking hb->lock.
*/
- migrate_disable();
+ migrate_disable_rt();
spin_unlock(&hb->lock);
/* Drops pi_state->pi_mutex.wait_lock */
ret = wake_futex_pi(uaddr, uval, pi_state);
- migrate_enable();
+ migrate_enable_rt();
put_pi_state(pi_state);
next prev parent reply other threads:[~2017-06-18 6:46 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-16 10:56 [ANNOUNCE] v4.11.5-rt1 Sebastian Andrzej Siewior
2017-06-17 8:14 ` Mike Galbraith
2017-06-18 6:46 ` Mike Galbraith [this message]
2017-06-19 8:52 ` Sebastian Andrzej Siewior
2017-06-19 10:14 ` Mike Galbraith
2017-06-19 10:44 ` Sebastian Andrzej Siewior
2017-06-19 11:31 ` Mike Galbraith
2017-06-19 11:50 ` Sebastian Andrzej Siewior
2017-06-19 12:55 ` Mike Galbraith
2017-06-19 14:06 ` Sebastian Andrzej Siewior
2017-06-19 14:36 ` Mike Galbraith
2017-06-19 15:03 ` Sebastian Andrzej Siewior
2017-06-19 16:14 ` Mike Galbraith
2017-06-19 16:27 ` Sebastian Andrzej Siewior
2017-06-19 16:46 ` Mike Galbraith
2017-06-19 14:08 ` Steven Rostedt
2017-06-19 14:13 ` Sebastian Andrzej Siewior
2017-06-19 14:41 ` Steven Rostedt
2017-06-19 16:29 ` Mike Galbraith
2017-06-20 7:45 ` Mike Galbraith
2017-06-22 16:34 ` Sebastian Andrzej Siewior
2017-06-22 17:30 ` Mike Galbraith
2017-06-22 21:36 ` Thomas Gleixner
2017-06-23 2:00 ` Mike Galbraith
2017-06-23 12:48 ` Sebastian Andrzej Siewior
2017-06-18 17:01 ` [patch-rt] rtmutex: Fix lock stealing logic Mike Galbraith
2017-06-23 7:37 ` [patch-rt v2] " Mike Galbraith
2017-06-23 10:07 ` Mike Galbraith
2017-06-26 13:47 ` Sebastian Andrzej Siewior
2017-06-23 13:33 ` Steven Rostedt
2017-06-23 14:07 ` Mike Galbraith
2017-06-23 14:14 ` 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=1497768375.8055.12.camel@gmx.de \
--to=efault@gmx.de \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).