From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83BFDC43332 for ; Thu, 19 Mar 2020 09:01:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6644B20732 for ; Thu, 19 Mar 2020 09:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726663AbgCSJBF convert rfc822-to-8bit (ORCPT ); Thu, 19 Mar 2020 05:01:05 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:59964 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbgCSJBE (ORCPT ); Thu, 19 Mar 2020 05:01:04 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1jEr2O-0003WY-CF; Thu, 19 Mar 2020 10:00:24 +0100 Date: Thu, 19 Mar 2020 10:00:24 +0100 From: Sebastian Andrzej Siewior To: Thomas Gleixner Cc: LKML , Peter Zijlstra , Linus Torvalds , Ingo Molnar , Will Deacon , "Paul E . McKenney" , Joel Fernandes , Steven Rostedt , Randy Dunlap , Michael Ellerman , Arnd Bergmann , linuxppc-dev@lists.ozlabs.org, Logan Gunthorpe , Kurt Schwemmer , Bjorn Helgaas , linux-pci@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Kalle Valo , "David S. Miller" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Oleg Nesterov , Davidlohr Bueso Subject: Re: [patch V2 07/15] powerpc/ps3: Convert half completion to rcuwait Message-ID: <20200319090024.wbrywc77tff3ro7i@linutronix.de> References: <20200318204302.693307984@linutronix.de> <20200318204408.102694393@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <20200318204408.102694393@linutronix.de> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2020-03-18 21:43:09 [+0100], Thomas Gleixner wrote: > --- a/arch/powerpc/platforms/ps3/device-init.c > +++ b/arch/powerpc/platforms/ps3/device-init.c > @@ -725,12 +728,12 @@ static int ps3_notification_read_write(s > unsigned long flags; > int res; > > - init_completion(&dev->done); > spin_lock_irqsave(&dev->lock, flags); > res = write ? lv1_storage_write(dev->sbd.dev_id, 0, 0, 1, 0, lpar, > &dev->tag) > : lv1_storage_read(dev->sbd.dev_id, 0, 0, 1, 0, lpar, > &dev->tag); > + dev->done = false; > spin_unlock_irqrestore(&dev->lock, flags); > if (res) { > pr_err("%s:%u: %s failed %d\n", __func__, __LINE__, op, res); > @@ -738,14 +741,10 @@ static int ps3_notification_read_write(s > } > pr_debug("%s:%u: notification %s issued\n", __func__, __LINE__, op); > > - res = wait_event_interruptible(dev->done.wait, > - dev->done.done || kthread_should_stop()); > + rcuwait_wait_event(&dev->wait, dev->done || kthread_should_stop(), TASK_IDLE); > + … Not sure it matters but this struct `dev' is allocated on stack. Should the interrupt fire *before* rcuwait_wait_event() set wait.task to NULL then it is of random value on the first invocation of rcuwait_wake_up(). -> diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c index 197347c3c0b24..e87360a0fb40d 100644 --- a/arch/powerpc/platforms/ps3/device-init.c +++ b/arch/powerpc/platforms/ps3/device-init.c @@ -809,6 +809,7 @@ static int ps3_probe_thread(void *data) } spin_lock_init(&dev.lock); + rcuwait_init(&dev.wait); res = request_irq(irq, ps3_notification_interrupt, 0, "ps3_notification", &dev); Sebastian From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 908DDC4332B for ; Thu, 19 Mar 2020 09:45:35 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 477F520722 for ; Thu, 19 Mar 2020 09:45:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 477F520722 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48jhq000MyzDqT9 for ; Thu, 19 Mar 2020 20:45:31 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linutronix.de (client-ip=2a0a:51c0:0:12e:550::1; helo=galois.linutronix.de; envelope-from=bigeasy@linutronix.de; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linutronix.de Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA256 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48jhnF1ZsszDqT5 for ; Thu, 19 Mar 2020 20:44:01 +1100 (AEDT) Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1jEr2O-0003WY-CF; Thu, 19 Mar 2020 10:00:24 +0100 Date: Thu, 19 Mar 2020 10:00:24 +0100 From: Sebastian Andrzej Siewior To: Thomas Gleixner Subject: Re: [patch V2 07/15] powerpc/ps3: Convert half completion to rcuwait Message-ID: <20200319090024.wbrywc77tff3ro7i@linutronix.de> References: <20200318204302.693307984@linutronix.de> <20200318204408.102694393@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20200318204408.102694393@linutronix.de> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-usb@vger.kernel.org, Peter Zijlstra , linux-pci@vger.kernel.org, Oleg Nesterov , netdev@vger.kernel.org, Joel Fernandes , Will Deacon , Ingo Molnar , Davidlohr Bueso , "Paul E . McKenney" , Logan Gunthorpe , Linus Torvalds , Arnd Bergmann , Steven Rostedt , Bjorn Helgaas , Kurt Schwemmer , Kalle Valo , Felipe Balbi , Greg Kroah-Hartman , Randy Dunlap , linux-wireless@vger.kernel.org, LKML , linuxppc-dev@lists.ozlabs.org, "David S. Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 2020-03-18 21:43:09 [+0100], Thomas Gleixner wrote: > --- a/arch/powerpc/platforms/ps3/device-init.c > +++ b/arch/powerpc/platforms/ps3/device-init.c > @@ -725,12 +728,12 @@ static int ps3_notification_read_write(s > unsigned long flags; > int res; > =20 > - init_completion(&dev->done); > spin_lock_irqsave(&dev->lock, flags); > res =3D write ? lv1_storage_write(dev->sbd.dev_id, 0, 0, 1, 0, lpar, > &dev->tag) > : lv1_storage_read(dev->sbd.dev_id, 0, 0, 1, 0, lpar, > &dev->tag); > + dev->done =3D false; > spin_unlock_irqrestore(&dev->lock, flags); > if (res) { > pr_err("%s:%u: %s failed %d\n", __func__, __LINE__, op, res); > @@ -738,14 +741,10 @@ static int ps3_notification_read_write(s > } > pr_debug("%s:%u: notification %s issued\n", __func__, __LINE__, op); > =20 > - res =3D wait_event_interruptible(dev->done.wait, > - dev->done.done || kthread_should_stop()); > + rcuwait_wait_event(&dev->wait, dev->done || kthread_should_stop(), TASK= _IDLE); > + =E2=80=A6 Not sure it matters but this struct `dev' is allocated on stack. Should the interrupt fire *before* rcuwait_wait_event() set wait.task to NULL then it is of random value on the first invocation of rcuwait_wake_up(). -> diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platfo= rms/ps3/device-init.c index 197347c3c0b24..e87360a0fb40d 100644 --- a/arch/powerpc/platforms/ps3/device-init.c +++ b/arch/powerpc/platforms/ps3/device-init.c @@ -809,6 +809,7 @@ static int ps3_probe_thread(void *data) } =20 spin_lock_init(&dev.lock); + rcuwait_init(&dev.wait); =20 res =3D request_irq(irq, ps3_notification_interrupt, 0, "ps3_notification", &dev); Sebastian