Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031161AbbDWWRw (ORCPT ); Thu, 23 Apr 2015 18:17:52 -0400 Received: from www.linutronix.de ([62.245.132.108]:39189 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758227AbbDWWRu (ORCPT ); Thu, 23 Apr 2015 18:17:50 -0400 Date: Fri, 24 Apr 2015 00:18:00 +0200 (CEST) From: Thomas Gleixner To: Sebastian Andrzej Siewior cc: Manfred Spraul , LKML , Peter Zijlstra , Ingo Molnar , Darren Hart , Steven Rostedt , fredrik.markstrom@windriver.com, Davidlohr Bueso , "Paul E. McKenney" Subject: Re: [PATCH v2] ipc/mqueue: remove STATE_PENDING In-Reply-To: <20150410143726.GD3057@linutronix.de> Message-ID: References: <1428419030-20030-1-git-send-email-bigeasy@linutronix.de> <1428419030-20030-4-git-send-email-bigeasy@linutronix.de> <55241851.7060704@colorfullife.com> <20150410143726.GD3057@linutronix.de> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1393 Lines: 51 On Fri, 10 Apr 2015, Sebastian Andrzej Siewior wrote: > >And: please test it, too. (patch the kernel so that you can trigger > >this case). > > Why patch? Isn't this triggered if you have a reader waiting and you > send a message? Manfred referred to the exit race. Though you can spare that exercise as it is safe by definition if you hold a ref on the task. Can you please convert that over to Peters lockless wake queues so we do not reimplement the same thing open coded here. > +static struct task_struct *pipelined_send(struct mqueue_inode_info *info, > struct msg_msg *message, > struct ext_wait_queue *receiver) > { > + struct task_struct *r_task; > + > receiver->msg = message; > list_del(&receiver->list); > - receiver->state = STATE_PENDING; > - wake_up_process(receiver->task); > + r_task = receiver->task; > + get_task_struct(r_task); > smp_wmb(); While we are at it. The barrier here and the one in pipelined_receive are not documented and they are missing a proper pairing on the read side. The comment which you removed was pretty vague about the purpose of the barrier as well. Thanks, tglx -- 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/