Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755763AbbKDLzm (ORCPT ); Wed, 4 Nov 2015 06:55:42 -0500 Received: from casper.infradead.org ([85.118.1.10]:47757 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752448AbbKDLzl (ORCPT ); Wed, 4 Nov 2015 06:55:41 -0500 Date: Wed, 4 Nov 2015 12:55:38 +0100 From: Peter Zijlstra To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, George Spelvin , Thomas Gleixner , Davidlohr Bueso , Manfred Spraul , Andrew Morton Subject: Re: [PATCH v2] ipc/msg: Implement lockless pipelined wakeups Message-ID: <20151104115538.GK17308@twins.programming.kicks-ass.net> References: <1446563009-9076-1-git-send-email-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1446563009-9076-1-git-send-email-bigeasy@linutronix.de> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1147 Lines: 34 On Tue, Nov 03, 2015 at 04:03:29PM +0100, Sebastian Andrzej Siewior wrote: > - struct msg_msg *volatile r_msg; > + struct msg_msg *r_msg; > + wake_q_add(wake_q, msr->r_tsk); > msr->r_msg = msg; > + /* > + * Rely on the implicit cmpxchg barrier from > + * wake_q_add such that we can ensure that Davidlohr, didn't you want to make that cmpxchg_relaxed() or cmpxchg_release() ? > + * updating msr->r_msg is the last write > + * operation: As once set, the receiver can > + * continue, and if we don't have the reference Which seems to suggest you want to at least make that WRITE_ONCE() > + * count from the wake_q, yet, at that point we > + * can later have a use-after-free condition and > + * bogus wakeup. > + */ And I agree with DAvidlohr that the comment is placed oddly, one would expect it between wake_q_add() and the store in question. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/