From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751743AbcJJLkw (ORCPT ); Mon, 10 Oct 2016 07:40:52 -0400 Received: from merlin.infradead.org ([205.233.59.134]:56342 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751130AbcJJLkv (ORCPT ); Mon, 10 Oct 2016 07:40:51 -0400 Date: Mon, 10 Oct 2016 13:40:10 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: mingo@kernel.org, juri.lelli@arm.com, rostedt@goodmis.org, xlpang@redhat.com, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, jdesfossez@efficios.com, bristot@redhat.com Subject: Re: [RFC][PATCH 4/4] futex: Rewrite FUTEX_UNLOCK_PI Message-ID: <20161010114010.GM3568@worktop.programming.kicks-ass.net> References: <20161003091234.879763059@infradead.org> <20161003091847.704255067@infradead.org> <20161007112143.GJ3117@twins.programming.kicks-ass.net> <20161008165540.GI3568@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 10, 2016 at 12:17:48PM +0200, Thomas Gleixner wrote: > There is another problem with all that racing against fixup_owner() > resp. fixup_pi_state_owner(). > > I fear, we need to rethink this whole locking/protection scheme from > scratch. So for pi_state (ie, the attach_to_pi_state() vs put_pi_state() race) I can see two options, either we re-take hb->lock after we've completed the futex_unlock_pi() in order to drop it, which is cringe worthy, or we make pi_state RCU freed and replace that WARN_ON() in attach_to_pi_state() with an atomic_inc_not_zero() and deal with the fail case by going back to the caller and treating it like !top_waiter. As to the rt_mutex vs futex state coherence, I think I can do all of that with rt_mutex::wait_lock held, the alternative is doing part with hb->lock and part with rt_mutex::wait_lock and parts with both, but that's already hurting my head and I didn't even try yet. Let me think a wee bit more on this..