Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933969AbcKJStP (ORCPT ); Thu, 10 Nov 2016 13:49:15 -0500 Received: from mail-pf0-f169.google.com ([209.85.192.169]:33584 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933753AbcKJStO (ORCPT ); Thu, 10 Nov 2016 13:49:14 -0500 Date: Thu, 10 Nov 2016 10:49:10 -0800 From: Brian Norris To: Dmitry Torokhov Cc: "Rafael J . Wysocki" , Pavel Machek , Len Brown , Greg Kroah-Hartman , lkml , Brian Norris , "linux-pm@vger.kernel.org" , Tony Lindgren Subject: Re: [PATCH] PM / wakeirq: report wakeup events in dedicated wake-IRQs Message-ID: <20161110184910.GA135921@google.com> References: <1478801227-65527-1-git-send-email-briannorris@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1264 Lines: 27 On Thu, Nov 10, 2016 at 10:13:55AM -0800, Dmitry Torokhov wrote: > 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. Indeed. So how do you suggest we get sane wakeup reports? Every device or bus that's going to use the dedicated wake APIs has to synchronize_irq() [1] in their resume() routine? Seems like an odd implementation detail to have to remember (and therefore most drivers will get it wrong). Brian [1] Or maybe at least create a helper API that will extract the dedicated wake IRQ number and do the synchronize_irq() for us, so drivers don't have to stash this separately (or poke at dev->power.wakeirq->irq) for no good reason.