Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752030AbbHSRud (ORCPT ); Wed, 19 Aug 2015 13:50:33 -0400 Received: from rhlx01.hs-esslingen.de ([129.143.116.10]:53294 "EHLO rhlx01.hs-esslingen.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751860AbbHSRuc (ORCPT ); Wed, 19 Aug 2015 13:50:32 -0400 Date: Wed, 19 Aug 2015 19:50:30 +0200 From: Andreas Mohr To: Andreas Mohr Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, "Rafael J. Wysocki" , Matthew Garrett , Thomas Gleixner Subject: Re: pm: record / retain actual reason of last system wakeup?? Message-ID: <20150819175030.GA4846@rhlx01.hs-esslingen.de> References: <20150602190702.GA9112@rhlx01.hs-esslingen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150602190702.GA9112@rhlx01.hs-esslingen.de> X-Priority: none User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3571 Lines: 110 Hi, [lkml.org info remains broken --> "special" reply rather than proper chain :(] On Tue, Jun 02, 2015 at 09:07:02PM +0200, Andreas Mohr wrote: > Hi, > > I'm wondering whether we're actually recording / retaining > any info about the precise reason for the machine wakeup > that was responsible for having woken up the current (continued) session > (e.g. WOL, RTC, configured keyboard wakeup, ...). I was very happy to find that you are now actually working on this remaining deficiency (kudos!): "Re: [PATCH v5] Report interrupt(s) that caused system wakeup" https://lkml.org/lkml/2015/8/17/607 > diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c > index d22786a6dbde..46068a1e0e07 100644 > --- a/kernel/irq/pm.c > +++ b/kernel/irq/pm.c > @@ -21,7 +21,7 @@ bool irq_pm_check_wakeup(struct irq_desc *desc) > desc->istate |= IRQS_SUSPENDED | IRQS_PENDING; > desc->depth++; > irq_disable(desc); > - pm_system_wakeup(); > + pm_system_irq_wakeup(irq_desc_get_irq(desc)); > return true; > } > return false; The way I see it is that perhaps the call interface (various kernel layers to central pm layer) could be something like supplying minimal info (performance!! no string handling, no complications, just numeric crap) to central info layer (i.e., pm) - proposed pm_system_irq_wakeup() signature sounds exactly right here, BUT: I would correct naming to use pm_system_wakeup_by_FOO() instead, to properly retain the known prefix (pm_system_wakeup(), anyone?). I.e. pm_system_wakeup_by_irq() pm_system_wakeup_by_timer() (which would be _by_irq() instead in most cases, but perhaps sometimes not...). and perhaps then still a pm_system_wakeup_by_specific(const char *subsystem, const char *specifics). And pm would then be able to publish this raw minimal information submitted by various sub systems in a sufficiently cooked, verbose, strictly defined future-proof manner (originating subsystem info of wakeup source, special identifier of wakeup source / specifics, ...). And this cooked data assembled upon user space query time only ideally (cook up info strings from pre-submitted literals once requested). Rather than using /sys/power/ named:pm_last_wakeup_irqs ( https://lkml.org/lkml/2015/8/17/607 ) one could name it more generically e.g. pm_last_wakeup_source or possibly better pm_last_wakeup_reason or pm_last_wakeup_reason_info only, with content format then being something like [subsystem description]: [subsystem specifics] , e.g.: ACPI IRQ: 13 platform IRQ: 72 GPIO button: 13 (would usually be configured/notified via IRQ subsystem instead though) However the question then could be whether its content would remain simple enough, else necessitating higher parser complexity on clients' side (or should instead split sysfs interface into pm_last_wakeup_reason_type [or ..._info?] and pm_last_wakeup_reason_details nodes? - c.f. sysfs node design guidelines somewhere below Documentation/ or so...). Anyway, we probably should not use per-subsystem nodes such as pm_last_wakeup_irqs since we might then end up having to offer *multiple* nodes with the user then having to figure out which particular node actually currently provides info about last wakeup. Thanks, Andreas Mohr -- 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/