From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751034AbdFRGq3 (ORCPT ); Sun, 18 Jun 2017 02:46:29 -0400 Received: from mout.gmx.net ([212.227.15.15]:55057 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922AbdFRGq1 (ORCPT ); Sun, 18 Jun 2017 02:46:27 -0400 Message-ID: <1497768375.8055.12.camel@gmx.de> Subject: Re: [ANNOUNCE] v4.11.5-rt1 From: Mike Galbraith To: Sebastian Andrzej Siewior , Thomas Gleixner Cc: LKML , linux-rt-users , Steven Rostedt Date: Sun, 18 Jun 2017 08:46:15 +0200 In-Reply-To: <1497687277.6908.31.camel@gmx.de> References: <20170616105610.rbc6itylcrsla56l@linutronix.de> <1497687277.6908.31.camel@gmx.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:NUdOExIUZo7cGu7jLWSBJenuHooKRBySbMHGEKC82NXyJmBrQS6 M2xtxVnn7vJwKYk4n2saWLGB+qTZTosXWUzIqXfPDphSOt30pAjylj/XPhXKqWoI2vm1NBI WvikwaZQA2Zm6mX7KnFOPMpSex35tPJUx5VRbBNobSTH5fDYYbeer15bNVAeoPr9CV0BnZF stC8fnEuJFCf5LtM0sAzg== X-UI-Out-Filterresults: notjunk:1;V01:K0:9BwHclQeWLk=:JjJPjB6Xx3tf8q7JJrMHRA 5NyAANe1702TfZo28Jgp5KsrZQzVEvkZtCT1M5mM+TqHJ+aAkekbXg6zRlGVFBIKPyZs5YyB2 IpAaTFdFgUun2Bw4vg3cE0jouxxibe/MXzmIYxUgCIXnxSapXW3AB4tE1urerrwyXe/l4bjnn OfCI9dixYauS8SYrNCbFkjhqsR80v27JSvo51ouq2l5Il2s42bI2Vk+5eyd0KLo1O1d8Dx5Yn csYJAnX7+Bg6HGT2M5HNtrSd00TpuIcioGbSQmekVr6IqGtkUE25pwxUh/YyUuDMHpgee1bFf kRLjKQmfktVcrhi85ppeWCqdxq+DMQtISLPWOYrTNTgixfgKGSuERt3pakbd0glk+OgI1ntuT iquidnt+/kAr7uhnVkSFjTpkFWrO/t9AJY4OwyaxRbtNUT2FQ6iE3JJ543YgQUNDU6SPKqRqV e6NhwzYSpXMnutZ0jTuWMkZvnbTMctPPVPME/h5ejzqWl5NViMRYS9mhJ5/64WxUO1ZPcmEqC Mr3Zb17Vrkhexq7V0i230xR3iD/lI8QAk4NHgnIY5HY42CsDFKOqe95hCq7sHsXSLYcu1K+cT va6yOYXGiaTfdmWgDl2tcvCOJQLPWSwSSTxh2ooflzXCFywumC9kJriB+i/o4UZKWCSQKsSFs 7sOslbCIbcmNd91d7Vm176tFznwNsx+Z470ZM1veUydpxwERlZqahcGYTlGvBp/wkcW6H0xag TQkMRNvhNR5z+Orh8YoJjmDuNCq58XhPw2m+E1XeIC4MfW1Y4pm9Wsdx2phQILIl848pusaYp E1IW1Qc Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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);