* [PATCH V6] Report interrupt(s) that caused system wakeup
[not found] <[PATCH V6] Report interrupt(s) that caused system wakeup>
@ 2015-08-27 20:00 ` Alexandra Yates
2015-08-27 20:00 ` Alexandra Yates
2015-08-28 7:40 ` Thomas Gleixner
0 siblings, 2 replies; 8+ messages in thread
From: Alexandra Yates @ 2015-08-27 20:00 UTC (permalink / raw)
To: tglx, rjw, kristen.c.accardi, linux-pm; +Cc: ayates1
From: ayates1 <alexandra.yates@intel.com>
Hi Rafael,
The current patch reflects the changes requested by Thomas Gleixner.
Please accept my patch.
Thank you,
Alexandra.
Alexandra Yates (1):
Report interrupt(s) that caused system wakeup
Documentation/ABI/testing/sysfs-power | 11 +++++++++++
drivers/base/power/wakeup.c | 33 ++++++++++++++++++++++++++++++++-
include/linux/suspend.h | 5 +++--
kernel/irq/pm.c | 2 +-
kernel/power/main.c | 23 +++++++++++++++++++++++
5 files changed, 70 insertions(+), 4 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH V6] Report interrupt(s) that caused system wakeup
2015-08-27 20:00 ` [PATCH V6] Report interrupt(s) that caused system wakeup Alexandra Yates
@ 2015-08-27 20:00 ` Alexandra Yates
2015-09-07 22:16 ` Rafael J. Wysocki
2015-08-28 7:40 ` Thomas Gleixner
1 sibling, 1 reply; 8+ messages in thread
From: Alexandra Yates @ 2015-08-27 20:00 UTC (permalink / raw)
To: tglx, rjw, kristen.c.accardi, linux-pm; +Cc: Alexandra Yates
This feature reports which IRQs cause the system to wakeup from sleep last
time it was suspended.
It adds a new sysfs attribute under /sys/power/ named: pm_last_wakeup_irqs
when read, will return a list of IRQs that caused the system to wakeup.
That will be useful for system wakeup diagnostics.
Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
---
Documentation/ABI/testing/sysfs-power | 11 +++++++++++
drivers/base/power/wakeup.c | 33 ++++++++++++++++++++++++++++++++-
include/linux/suspend.h | 5 +++--
kernel/irq/pm.c | 2 +-
kernel/power/main.c | 23 +++++++++++++++++++++++
5 files changed, 70 insertions(+), 4 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power
index f455181..4f9cc3a 100644
--- a/Documentation/ABI/testing/sysfs-power
+++ b/Documentation/ABI/testing/sysfs-power
@@ -256,3 +256,14 @@ Description:
Writing a "1" enables this printing while writing a "0"
disables it. The default value is "0". Reading from this file
will display the current value.
+
+What: /sys/power/pm_last_wakeup_irqs
+Date: April 2015
+Contact: Alexandra Yates <alexandra.yates@linux.intel.org>
+Description:
+ The /sys/power/pm_last_wakeup_irqs file allows user space
+ to identify and report the IRQs responsible for waking the
+ system up from sleep. The IRQD_WAKEUP_TRIGGERED flag is set and
+ reported when the given IRQ fires after it has been armed for
+ system wakeup. This output is useful for system wakeup
+ diagnostics.
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 51f15bc..0f6cc55 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -28,6 +28,9 @@ bool events_check_enabled __read_mostly;
/* If set and the system is suspending, terminate the suspend. */
static bool pm_abort_suspend __read_mostly;
+/* IRQ number which causes system wakeup */
+static unsigned int wakeup_irq;
+
/*
* Combined counters of registered wakeup events and wakeup events in progress.
* They need to be modified together atomically, so it's better to use one
@@ -858,8 +861,9 @@ bool pm_wakeup_pending(void)
return ret || pm_abort_suspend;
}
-void pm_system_wakeup(void)
+void pm_system_irq_wakeup(unsigned int irq_number)
{
+ wakeup_irq = irq_number;
pm_abort_suspend = true;
freeze_wake();
}
@@ -870,6 +874,33 @@ void pm_wakeup_clear(void)
pm_abort_suspend = false;
}
+#ifdef CONFIG_PM_SLEEP_DEBUG
+/*
+ * pm_get_last_wakeup_irqs - gets interrupt number that
+ * caused the system to wake up from suspend-to-idle.
+ * @buf: keeps track of the irqs that casued the system to wakeup
+ */
+ssize_t pm_get_last_wakeup_irqs(char *buf, size_t size)
+{
+ char *str = buf;
+ char *end = buf + size;
+
+ if (!pm_abort_suspend)
+ return 0;
+
+ /* If pm_abort_suspend is not set, the previous suspend was aborted
+ * before arming the wakeup IRQs, so avoid printing stale information
+ * in that case.
+ */
+ str += scnprintf(str, end - str, "%d ", wakeup_irq);
+
+ if (str != buf)
+ str--;
+
+ return (str - buf);
+}
+#endif /* CONFIG_PM_SLEEP_DEBUG */
+
/**
* pm_get_wakeup_count - Read the number of registered wakeup events.
* @count: Address to store the value at.
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 5efe743..86ab316 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -378,6 +378,7 @@ void restore_processor_state(void);
/* kernel/power/main.c */
extern int register_pm_notifier(struct notifier_block *nb);
extern int unregister_pm_notifier(struct notifier_block *nb);
+extern ssize_t pm_get_last_wakeup_irqs(char *buf, size_t size);
#define pm_notifier(fn, pri) { \
static struct notifier_block fn##_nb = \
@@ -389,7 +390,7 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
extern bool events_check_enabled;
extern bool pm_wakeup_pending(void);
-extern void pm_system_wakeup(void);
+extern void pm_system_irq_wakeup(unsigned int);
extern void pm_wakeup_clear(void);
extern bool pm_get_wakeup_count(unsigned int *count, bool block);
extern bool pm_save_wakeup_count(unsigned int count);
@@ -438,7 +439,7 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
static inline bool pm_wakeup_pending(void) { return false; }
-static inline void pm_system_wakeup(void) {}
+static inline void pm_system_irq_wakeup(unsigned int) {}
static inline void pm_wakeup_clear(void) {}
static inline void lock_system_sleep(void) {}
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
index d22786a..46068a1 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;
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 63d395b..6e550c0 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -272,6 +272,28 @@ static inline void pm_print_times_init(void)
{
pm_print_times_enabled = !!initcall_debug;
}
+
+static ssize_t pm_last_wakeup_irqs_show(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ char *buf)
+{
+ size_t ret;
+
+ ret = pm_get_last_wakeup_irqs(buf, PAGE_SIZE);
+ if (ret)
+ buf[ret++] = '\n';
+
+ return ret;
+}
+
+static ssize_t pm_last_wakeup_irqs_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t n)
+{
+ return -EINVAL;
+}
+power_attr(pm_last_wakeup_irqs);
+
#else /* !CONFIG_PM_SLEEP_DEBUG */
static inline void pm_print_times_init(void) {}
#endif /* CONFIG_PM_SLEEP_DEBUG */
@@ -604,6 +626,7 @@ static struct attribute * g[] = {
#endif
#ifdef CONFIG_PM_SLEEP_DEBUG
&pm_print_times_attr.attr,
+ &pm_last_wakeup_irqs_attr.attr,
#endif
#endif
#ifdef CONFIG_FREEZER
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH V6] Report interrupt(s) that caused system wakeup
2015-08-27 20:00 ` [PATCH V6] Report interrupt(s) that caused system wakeup Alexandra Yates
2015-08-27 20:00 ` Alexandra Yates
@ 2015-08-28 7:40 ` Thomas Gleixner
1 sibling, 0 replies; 8+ messages in thread
From: Thomas Gleixner @ 2015-08-28 7:40 UTC (permalink / raw)
To: Alexandra Yates; +Cc: rjw, kristen.c.accardi, linux-pm, ayates1
On Thu, 27 Aug 2015, Alexandra Yates wrote:
> From: ayates1 <alexandra.yates@intel.com>
>
> Hi Rafael,
>
> The current patch reflects the changes requested by Thomas Gleixner.
>
> Please accept my patch.
-ENOPATCH
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V6] Report interrupt(s) that caused system wakeup
2015-08-27 20:00 ` Alexandra Yates
@ 2015-09-07 22:16 ` Rafael J. Wysocki
2015-09-08 14:18 ` Alan Stern
2015-09-09 0:56 ` Rafael J. Wysocki
0 siblings, 2 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2015-09-07 22:16 UTC (permalink / raw)
To: Alexandra Yates; +Cc: tglx, kristen.c.accardi, linux-pm
On Thursday, August 27, 2015 01:00:43 PM Alexandra Yates wrote:
> This feature reports which IRQs cause the system to wakeup from sleep last
> time it was suspended.
>
> It adds a new sysfs attribute under /sys/power/ named: pm_last_wakeup_irqs
> when read, will return a list of IRQs that caused the system to wakeup.
> That will be useful for system wakeup diagnostics.
>
> Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
> ---
> Documentation/ABI/testing/sysfs-power | 11 +++++++++++
> drivers/base/power/wakeup.c | 33 ++++++++++++++++++++++++++++++++-
> include/linux/suspend.h | 5 +++--
> kernel/irq/pm.c | 2 +-
> kernel/power/main.c | 23 +++++++++++++++++++++++
> 5 files changed, 70 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power
> index f455181..4f9cc3a 100644
> --- a/Documentation/ABI/testing/sysfs-power
> +++ b/Documentation/ABI/testing/sysfs-power
> @@ -256,3 +256,14 @@ Description:
> Writing a "1" enables this printing while writing a "0"
> disables it. The default value is "0". Reading from this file
> will display the current value.
> +
> +What: /sys/power/pm_last_wakeup_irqs
There will be only one now, so I'll call it simply "pm_wakeup_irq".
> +Date: April 2015
> +Contact: Alexandra Yates <alexandra.yates@linux.intel.org>
> +Description:
> + The /sys/power/pm_last_wakeup_irqs file allows user space
> + to identify and report the IRQs responsible for waking the
> + system up from sleep. The IRQD_WAKEUP_TRIGGERED flag is set and
> + reported when the given IRQ fires after it has been armed for
> + system wakeup. This output is useful for system wakeup
> + diagnostics.
> diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
> index 51f15bc..0f6cc55 100644
> --- a/drivers/base/power/wakeup.c
> +++ b/drivers/base/power/wakeup.c
> @@ -28,6 +28,9 @@ bool events_check_enabled __read_mostly;
> /* If set and the system is suspending, terminate the suspend. */
> static bool pm_abort_suspend __read_mostly;
>
> +/* IRQ number which causes system wakeup */
> +static unsigned int wakeup_irq;
> +
> /*
> * Combined counters of registered wakeup events and wakeup events in progress.
> * They need to be modified together atomically, so it's better to use one
> @@ -858,8 +861,9 @@ bool pm_wakeup_pending(void)
> return ret || pm_abort_suspend;
> }
>
> -void pm_system_wakeup(void)
You can't replace pm_system_wakeup() with the new thing, because it is used
beyond the IRQ subsystem. You can make pm_system_irq_wakeup() call
pm_system_wakeup().
> +void pm_system_irq_wakeup(unsigned int irq_number)
> {
> + wakeup_irq = irq_number;
> pm_abort_suspend = true;
> freeze_wake();
> }
> @@ -870,6 +874,33 @@ void pm_wakeup_clear(void)
> pm_abort_suspend = false;
> }
>
> +#ifdef CONFIG_PM_SLEEP_DEBUG
> +/*
> + * pm_get_last_wakeup_irqs - gets interrupt number that
> + * caused the system to wake up from suspend-to-idle.
> + * @buf: keeps track of the irqs that casued the system to wakeup
> + */
> +ssize_t pm_get_last_wakeup_irqs(char *buf, size_t size)
> +{
> + char *str = buf;
> + char *end = buf + size;
> +
> + if (!pm_abort_suspend)
> + return 0;
> +
> + /* If pm_abort_suspend is not set, the previous suspend was aborted
> + * before arming the wakeup IRQs, so avoid printing stale information
> + * in that case.
> + */
> + str += scnprintf(str, end - str, "%d ", wakeup_irq);
Why do we need the extra space?
Why do we need str? It should be sufficient to do
return pm_abort_suspend ? scnprintf(str, size, "%u", wakeup_irq) : 0;
as the whole function body, shouldn't it?
But I think it would be cleaner to simply make wakeup_irq extern and read it
from main.c instead of doing this here.
> +
> + if (str != buf)
> + str--;
> +
> + return (str - buf);
> +}
> +#endif /* CONFIG_PM_SLEEP_DEBUG */
> +
> /**
> * pm_get_wakeup_count - Read the number of registered wakeup events.
> * @count: Address to store the value at.
> diff --git a/include/linux/suspend.h b/include/linux/suspend.h
> index 5efe743..86ab316 100644
> --- a/include/linux/suspend.h
> +++ b/include/linux/suspend.h
> @@ -378,6 +378,7 @@ void restore_processor_state(void);
> /* kernel/power/main.c */
> extern int register_pm_notifier(struct notifier_block *nb);
> extern int unregister_pm_notifier(struct notifier_block *nb);
> +extern ssize_t pm_get_last_wakeup_irqs(char *buf, size_t size);
>
> #define pm_notifier(fn, pri) { \
> static struct notifier_block fn##_nb = \
> @@ -389,7 +390,7 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
> extern bool events_check_enabled;
>
> extern bool pm_wakeup_pending(void);
> -extern void pm_system_wakeup(void);
> +extern void pm_system_irq_wakeup(unsigned int);
> extern void pm_wakeup_clear(void);
> extern bool pm_get_wakeup_count(unsigned int *count, bool block);
> extern bool pm_save_wakeup_count(unsigned int count);
> @@ -438,7 +439,7 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
> #define pm_notifier(fn, pri) do { (void)(fn); } while (0)
>
> static inline bool pm_wakeup_pending(void) { return false; }
> -static inline void pm_system_wakeup(void) {}
> +static inline void pm_system_irq_wakeup(unsigned int) {}
> static inline void pm_wakeup_clear(void) {}
>
> static inline void lock_system_sleep(void) {}
> diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
> index d22786a..46068a1 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;
> diff --git a/kernel/power/main.c b/kernel/power/main.c
> index 63d395b..6e550c0 100644
> --- a/kernel/power/main.c
> +++ b/kernel/power/main.c
> @@ -272,6 +272,28 @@ static inline void pm_print_times_init(void)
> {
> pm_print_times_enabled = !!initcall_debug;
> }
> +
> +static ssize_t pm_last_wakeup_irqs_show(struct kobject *kobj,
> + struct kobj_attribute *attr,
> + char *buf)
> +{
> + size_t ret;
> +
> + ret = pm_get_last_wakeup_irqs(buf, PAGE_SIZE);
> + if (ret)
> + buf[ret++] = '\n';
> +
> + return ret;
> +}
> +
> +static ssize_t pm_last_wakeup_irqs_store(struct kobject *kobj,
> + struct kobj_attribute *attr,
> + const char *buf, size_t n)
> +{
> + return -EINVAL;
> +}
> +power_attr(pm_last_wakeup_irqs);
> +
> #else /* !CONFIG_PM_SLEEP_DEBUG */
> static inline void pm_print_times_init(void) {}
> #endif /* CONFIG_PM_SLEEP_DEBUG */
> @@ -604,6 +626,7 @@ static struct attribute * g[] = {
> #endif
> #ifdef CONFIG_PM_SLEEP_DEBUG
> &pm_print_times_attr.attr,
> + &pm_last_wakeup_irqs_attr.attr,
> #endif
> #endif
> #ifdef CONFIG_FREEZER
>
Thanks,
Rafael
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V6] Report interrupt(s) that caused system wakeup
2015-09-07 22:16 ` Rafael J. Wysocki
@ 2015-09-08 14:18 ` Alan Stern
2015-09-08 15:09 ` Rafael J. Wysocki
2015-09-09 0:56 ` Rafael J. Wysocki
1 sibling, 1 reply; 8+ messages in thread
From: Alan Stern @ 2015-09-08 14:18 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Alexandra Yates, tglx, kristen.c.accardi, linux-pm
On Tue, 8 Sep 2015, Rafael J. Wysocki wrote:
> On Thursday, August 27, 2015 01:00:43 PM Alexandra Yates wrote:
> > This feature reports which IRQs cause the system to wakeup from sleep last
> > time it was suspended.
A minor complaint... This doesn't actually report which IRQs caused
the system to wake up. In reality, it reports all the wakeup-enabled
IRQs that have occurred since the system went to sleep. _One_ of those
IRQs was responsible for waking the system up, but the others weren't.
In fact, even that previous sentence need not be true. If a
wakeup-enabled IRQ occurs at the right point during a system sleep
transition, it can cause the entire transition to be aborted. The
sleep returns to normal operation without ever going fully to sleep.
Thus, it would be more accurate to say above that one of those IRQs was
responsible for waking the system up or preventing the system from
going to sleep.
Alan Stern
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V6] Report interrupt(s) that caused system wakeup
2015-09-08 14:18 ` Alan Stern
@ 2015-09-08 15:09 ` Rafael J. Wysocki
0 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2015-09-08 15:09 UTC (permalink / raw)
To: Alan Stern; +Cc: Alexandra Yates, tglx, kristen.c.accardi, linux-pm
On Tuesday, September 08, 2015 10:18:46 AM Alan Stern wrote:
> On Tue, 8 Sep 2015, Rafael J. Wysocki wrote:
>
> > On Thursday, August 27, 2015 01:00:43 PM Alexandra Yates wrote:
> > > This feature reports which IRQs cause the system to wakeup from sleep last
> > > time it was suspended.
>
> A minor complaint... This doesn't actually report which IRQs caused
> the system to wake up. In reality, it reports all the wakeup-enabled
> IRQs that have occurred since the system went to sleep.
The current version of the patch reports the last one to be precisie.
It should report the first one though I think.
> _One_ of those IRQs was responsible for waking the system up, but the
> others weren't.
>
> In fact, even that previous sentence need not be true. If a
> wakeup-enabled IRQ occurs at the right point during a system sleep
> transition, it can cause the entire transition to be aborted. The
> sleep returns to normal operation without ever going fully to sleep.
>
> Thus, it would be more accurate to say above that one of those IRQs was
> responsible for waking the system up or preventing the system from
> going to sleep.
Right.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V6] Report interrupt(s) that caused system wakeup
2015-09-07 22:16 ` Rafael J. Wysocki
2015-09-08 14:18 ` Alan Stern
@ 2015-09-09 0:56 ` Rafael J. Wysocki
2015-09-10 2:57 ` Alexandra Yates
1 sibling, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2015-09-09 0:56 UTC (permalink / raw)
To: Alexandra Yates; +Cc: tglx, kristen.c.accardi, linux-pm
On Tuesday, September 08, 2015 12:16:37 AM Rafael J. Wysocki wrote:
> On Thursday, August 27, 2015 01:00:43 PM Alexandra Yates wrote:
> > This feature reports which IRQs cause the system to wakeup from sleep last
> > time it was suspended.
> >
> > It adds a new sysfs attribute under /sys/power/ named: pm_last_wakeup_irqs
> > when read, will return a list of IRQs that caused the system to wakeup.
> > That will be useful for system wakeup diagnostics.
> >
> > Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
> > ---
> > Documentation/ABI/testing/sysfs-power | 11 +++++++++++
> > drivers/base/power/wakeup.c | 33 ++++++++++++++++++++++++++++++++-
> > include/linux/suspend.h | 5 +++--
> > kernel/irq/pm.c | 2 +-
> > kernel/power/main.c | 23 +++++++++++++++++++++++
> > 5 files changed, 70 insertions(+), 4 deletions(-)
> >
> > diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power
> > index f455181..4f9cc3a 100644
> > --- a/Documentation/ABI/testing/sysfs-power
> > +++ b/Documentation/ABI/testing/sysfs-power
> > @@ -256,3 +256,14 @@ Description:
> > Writing a "1" enables this printing while writing a "0"
> > disables it. The default value is "0". Reading from this file
> > will display the current value.
> > +
> > +What: /sys/power/pm_last_wakeup_irqs
>
> There will be only one now, so I'll call it simply "pm_wakeup_irq".
>
> > +Date: April 2015
> > +Contact: Alexandra Yates <alexandra.yates@linux.intel.org>
> > +Description:
> > + The /sys/power/pm_last_wakeup_irqs file allows user space
> > + to identify and report the IRQs responsible for waking the
> > + system up from sleep. The IRQD_WAKEUP_TRIGGERED flag is set and
> > + reported when the given IRQ fires after it has been armed for
> > + system wakeup. This output is useful for system wakeup
> > + diagnostics.
> > diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
> > index 51f15bc..0f6cc55 100644
> > --- a/drivers/base/power/wakeup.c
> > +++ b/drivers/base/power/wakeup.c
> > @@ -28,6 +28,9 @@ bool events_check_enabled __read_mostly;
> > /* If set and the system is suspending, terminate the suspend. */
> > static bool pm_abort_suspend __read_mostly;
> >
> > +/* IRQ number which causes system wakeup */
> > +static unsigned int wakeup_irq;
> > +
> > /*
> > * Combined counters of registered wakeup events and wakeup events in progress.
> > * They need to be modified together atomically, so it's better to use one
> > @@ -858,8 +861,9 @@ bool pm_wakeup_pending(void)
> > return ret || pm_abort_suspend;
> > }
> >
> > -void pm_system_wakeup(void)
>
> You can't replace pm_system_wakeup() with the new thing, because it is used
> beyond the IRQ subsystem. You can make pm_system_irq_wakeup() call
> pm_system_wakeup().
>
> > +void pm_system_irq_wakeup(unsigned int irq_number)
> > {
> > + wakeup_irq = irq_number;
> > pm_abort_suspend = true;
> > freeze_wake();
> > }
One more point.
We need this to register the first wakeup interrupt and ignore the next
ones, but this code will simply register the last wakeup interrupt during
the cycle.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V6] Report interrupt(s) that caused system wakeup
2015-09-09 0:56 ` Rafael J. Wysocki
@ 2015-09-10 2:57 ` Alexandra Yates
0 siblings, 0 replies; 8+ messages in thread
From: Alexandra Yates @ 2015-09-10 2:57 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: tglx, kristen.c.accardi, linux-pm
Hi,
On 09/08/2015 05:56 PM, Rafael J. Wysocki wrote:
> On Tuesday, September 08, 2015 12:16:37 AM Rafael J. Wysocki wrote:
>> On Thursday, August 27, 2015 01:00:43 PM Alexandra Yates wrote:
>>> This feature reports which IRQs cause the system to wakeup from sleep last
>>> time it was suspended.
>>>
>>> It adds a new sysfs attribute under /sys/power/ named: pm_last_wakeup_irqs
>>> when read, will return a list of IRQs that caused the system to wakeup.
>>> That will be useful for system wakeup diagnostics.
>>>
>>> Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
>>> ---
>>> Documentation/ABI/testing/sysfs-power | 11 +++++++++++
>>> drivers/base/power/wakeup.c | 33 ++++++++++++++++++++++++++++++++-
>>> include/linux/suspend.h | 5 +++--
>>> kernel/irq/pm.c | 2 +-
>>> kernel/power/main.c | 23 +++++++++++++++++++++++
>>> 5 files changed, 70 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power
>>> index f455181..4f9cc3a 100644
>>> --- a/Documentation/ABI/testing/sysfs-power
>>> +++ b/Documentation/ABI/testing/sysfs-power
>>> @@ -256,3 +256,14 @@ Description:
>>> Writing a "1" enables this printing while writing a "0"
>>> disables it. The default value is "0". Reading from this file
>>> will display the current value.
>>> +
>>> +What: /sys/power/pm_last_wakeup_irqs
>> There will be only one now, so I'll call it simply "pm_wakeup_irq".
>>
>>> +Date: April 2015
>>> +Contact: Alexandra Yates <alexandra.yates@linux.intel.org>
>>> +Description:
>>> + The /sys/power/pm_last_wakeup_irqs file allows user space
>>> + to identify and report the IRQs responsible for waking the
>>> + system up from sleep. The IRQD_WAKEUP_TRIGGERED flag is set and
>>> + reported when the given IRQ fires after it has been armed for
>>> + system wakeup. This output is useful for system wakeup
>>> + diagnostics.
>>> diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
>>> index 51f15bc..0f6cc55 100644
>>> --- a/drivers/base/power/wakeup.c
>>> +++ b/drivers/base/power/wakeup.c
>>> @@ -28,6 +28,9 @@ bool events_check_enabled __read_mostly;
>>> /* If set and the system is suspending, terminate the suspend. */
>>> static bool pm_abort_suspend __read_mostly;
>>>
>>> +/* IRQ number which causes system wakeup */
>>> +static unsigned int wakeup_irq;
>>> +
>>> /*
>>> * Combined counters of registered wakeup events and wakeup events in progress.
>>> * They need to be modified together atomically, so it's better to use one
>>> @@ -858,8 +861,9 @@ bool pm_wakeup_pending(void)
>>> return ret || pm_abort_suspend;
>>> }
>>>
>>> -void pm_system_wakeup(void)
>> You can't replace pm_system_wakeup() with the new thing, because it is used
>> beyond the IRQ subsystem. You can make pm_system_irq_wakeup() call
>> pm_system_wakeup().
>>
>>> +void pm_system_irq_wakeup(unsigned int irq_number)
>>> {
>>> + wakeup_irq = irq_number;
>>> pm_abort_suspend = true;
>>> freeze_wake();
>>> }
> One more point.
>
> We need this to register the first wakeup interrupt and ignore the next
> ones, but this code will simply register the last wakeup interrupt during
> the cycle.
>
> Thanks,
> Rafael
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Just sent patch V7. It includes changes for the feedback received from
Rafael, Alan, Thomas and Yan.
Thank you all for your review. Rafael. Please accept V7 of the patch.
--
Thank you,
<Alexandra>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-09-10 2:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <[PATCH V6] Report interrupt(s) that caused system wakeup>
2015-08-27 20:00 ` [PATCH V6] Report interrupt(s) that caused system wakeup Alexandra Yates
2015-08-27 20:00 ` Alexandra Yates
2015-09-07 22:16 ` Rafael J. Wysocki
2015-09-08 14:18 ` Alan Stern
2015-09-08 15:09 ` Rafael J. Wysocki
2015-09-09 0:56 ` Rafael J. Wysocki
2015-09-10 2:57 ` Alexandra Yates
2015-08-28 7:40 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).