Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1620156

Re: [PATCH -v6 11/13] futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock()

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH -v6 11/13] futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock()
Date 2017-04-10 18:10 +0200
Message-ID <tuK38-2W1-17@gated-at.bofh.it> (permalink)
References <tnM01-11I-7@gated-at.bofh.it> <tnM02-11I-25@gated-at.bofh.it> <tuJTv-2D4-91@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 10 Apr 2017, alexander.levin@verizon.com wrote:
> On Wed, Mar 22, 2017 at 11:35:58AM +0100, Peter Zijlstra wrote:
> > By changing futex_lock_pi() to use rt_mutex_*_proxy_lock() we arrive
> > at a point where all wait_list modifications are done under both
> > hb->lock and wait_lock.
> [...]
> 
> Hey Peter,
> 
> I'm seeing the following, which seems to be related to this patch:
> 
> [   21.762875] ODEBUG: free active (active state 0) object type: hrtimer hint: hrtimer_wakeup (kernel/time/hrtimer.c:1423)

> [   21.788050] debug_object_free (lib/debugobjects.c:603)
> [   21.791105] destroy_hrtimer_on_stack (kernel/time/hrtimer.c:427)
> [   21.791746] futex_lock_pi (kernel/futex.c:2740)
> [   21.800721] do_futex (kernel/futex.c:3399)
> [   21.818395] SyS_futex (kernel/futex.c:3447 kernel/futex.c:3415)
> [   21.822260] do_syscall_64 (arch/x86/entry/common.c:284)
> [   21.827328] entry_SYSCALL64_slow_path (arch/x86/entry/entry_64.S:249)

Yep, that rework dropped the hrtimer cancel. Fix below.

Thanks,

	tglx

8<------------------------

diff --git a/kernel/futex.c b/kernel/futex.c
index c3eebcdac206..7ac167683c9f 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2736,8 +2736,10 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags,
 out_put_key:
 	put_futex_key(&q.key);
 out:
-	if (to)
+	if (to) {
+		hrtimer_cancel(&to->timer);
 		destroy_hrtimer_on_stack(&to->timer);
+	}
 	return ret != -EINTR ? ret : -ERESTARTNOINTR;
 
 uaddr_faulted:

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH -v6 11/13] futex: Rework futex_lock_pi() to use  rt_mutex_*_proxy_lock() alexander.levin@verizon.com - 2017-04-10 18:00 +0200
  Re: [PATCH -v6 11/13] futex: Rework futex_lock_pi() to use  rt_mutex_*_proxy_lock() Thomas Gleixner <tglx@linutronix.de> - 2017-04-10 18:10 +0200
    [tip:locking/core] futex: Avoid freeing an active timer tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-04-14 11:40 +0200

csiph-web