Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755196AbcKJSN7 (ORCPT ); Thu, 10 Nov 2016 13:13:59 -0500 Received: from mail-ua0-f193.google.com ([209.85.217.193]:33485 "EHLO mail-ua0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754572AbcKJSN5 (ORCPT ); Thu, 10 Nov 2016 13:13:57 -0500 MIME-Version: 1.0 In-Reply-To: <1478801227-65527-1-git-send-email-briannorris@chromium.org> References: <1478801227-65527-1-git-send-email-briannorris@chromium.org> From: Dmitry Torokhov Date: Thu, 10 Nov 2016 10:13:55 -0800 Message-ID: Subject: Re: [PATCH] PM / wakeirq: report wakeup events in dedicated wake-IRQs To: Brian Norris Cc: "Rafael J . Wysocki" , Pavel Machek , Len Brown , Greg Kroah-Hartman , lkml , Brian Norris , "linux-pm@vger.kernel.org" , Tony Lindgren Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1681 Lines: 50 On Thu, Nov 10, 2016 at 10:07 AM, Brian Norris wrote: > It's important that user space can figure out what device woke the > system from suspend -- e.g., for debugging, or for implementing > conditional wake behavior. Dedicated wakeup IRQs don't currently do > that. > > Let's report the event (pm_wakeup_event()) and also allow drivers to > synchronize with these events in their resume path (hence, disable_irq() > instead of disable_irq_nosync()). Hmm, dev_pm_disable_wake_irq() is called from rpm_suspend()/rpm_resume() that take dev->power.lock spinlock and disable interrupts. Dropping _nosync() feels dangerous. > > Signed-off-by: Brian Norris > --- > drivers/base/power/wakeirq.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c > index 0d77cd6fd8d1..c35b2db1194c 100644 > --- a/drivers/base/power/wakeirq.c > +++ b/drivers/base/power/wakeirq.c > @@ -139,6 +139,8 @@ static irqreturn_t handle_threaded_wake_irq(int irq, void *_wirq) > struct wake_irq *wirq = _wirq; > int res; > > + pm_wakeup_event(wirq->dev, 0); > + > /* We don't want RPM_ASYNC or RPM_NOWAIT here */ > res = pm_runtime_resume(wirq->dev); > if (res < 0) > @@ -240,7 +242,7 @@ void dev_pm_disable_wake_irq(struct device *dev) > struct wake_irq *wirq = dev->power.wakeirq; > > if (wirq && wirq->dedicated_irq) > - disable_irq_nosync(wirq->irq); > + disable_irq(wirq->irq); > } > EXPORT_SYMBOL_GPL(dev_pm_disable_wake_irq); > > -- > 2.8.0.rc3.226.g39d4020 > -- Dmitry