Report interrupt that caused system wakeup
Subsystems (5)
A message that is not in the archive (sent off-list or not yet received): [PATCH V8] Report interrupt that caused system wakeup
PATCH v8 1/1 Report interrupt that caused system wakeup
This feature reports the IRQ that was armed for system wakeup after the system was last time suspended. It adds a new sysfs attribute under /sys/power/ named: pm_last_wakeup_irq
This feature will be useful for system wakeup diagnostics of spurious wakeup interrupts.
--- Documentation/ABI/testing/sysfs-power | 11 +++++++++++ drivers/base/power/wakeup.c | 12 ++++++++++++ include/linux/suspend.h | 8 +++++++- kernel/irq/pm.c | 4 ++-- kernel/power/main.c | 19 +++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-)
Documentation/ABI/testing/sysfs-power +11 -0
@@ -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_irq +Date: April 2015 +Contact: Alexandra Yates <[email protected]> +Description: + The /sys/power/pm_last_wakeup_irq file reports to user space + the IRQ that was armed for system wakeup and occurred since + suspend_device_irqs() was last called. + + This output is useful for system wakeup diagnostics of spurious + wakeup interrupts.
drivers/base/power/wakeup.c +12 -0
@@ -870,6 +870,18 @@ void pm_wakeup_clear(void) pm_abort_suspend = false; } +void pm_system_irq_wakeup (unsigned int irq_number) +{ +if (wakeup_irq ==0 ) + wakeup_irq = irq_number; +pm_system_wakeup (); +} + +void pm_last_wakeup_irq_reset (void ) +{ + wakeup_irq =0 ; +} +/** * pm_get_wakeup_count - Read the number of registered wakeup events. * @count: Address to store the value at.
include/linux/suspend.h +7 -1
@@ -371,6 +371,9 @@ static inline bool hibernation_available(void) { return false; }extern struct mutex pm_mutex; +/* IRQ number which causes system wakeup */ +extern unsigned int wakeup_irq; +#ifdef CONFIG_PM_SLEEP void save_processor_state (void );void restore_processor_state (void );
@@ -378,7 +381,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 void pm_last_wakeup_irq_reset (void );#define pm_notifier (fn, pri) { \ static struct notifier_block fn##_nb = \ { .notifier_call = fn, .priority = pri }; \
@@ -391,6 +394,7 @@ extern bool events_check_enabled;extern bool pm_wakeup_pending (void );extern void pm_system_wakeup (void );extern void pm_wakeup_clear (void ); +extern void pm_system_irq_wakeup (unsigned int );extern bool pm_get_wakeup_count (unsigned int *count,bool block);extern bool pm_save_wakeup_count (unsigned int count);extern void pm_wakep_autosleep_enabled (bool set);
@@ -440,6 +444,8 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)static inline bool pm_wakeup_pending (void ) {return false; }static inline void pm_system_wakeup (void ) {}static inline void pm_wakeup_clear (void ) {} +static inline void pm_system_irq_wakeup (unsigned int ) {} +static inline void pm_last_wakeup_irq_reset (void ){};static inline void lock_system_sleep (void ) {}static inline void unlock_system_sleep (void ) {}
kernel/irq/pm.c +2 -2
@@ -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;
@@ -118,7 +118,7 @@ void suspend_device_irqs(void) {struct irq_desc *desc;int irq; - +pm_last_wakeup_irq_reset ();for_each_irq_desc (irq, desc) {unsigned long flags;bool sync;
kernel/power/main.c +19 -0
@@ -272,6 +272,24 @@ static inline void pm_print_times_init(void) { pm_print_times_enabled = !!initcall_debug; } + +unsigned int wakeup_irq; +EXPORT_SYMBOL_GPL (wakeup_irq); +static ssize_t pm_last_wakeup_irq_show (struct kobject *kobj, +struct kobj_attribute *attr, +char *buf) +{ +return wakeup_irq ?sprintf (buf,"%u\n" , wakeup_irq) : -EINVAL ; +} + +static ssize_t pm_last_wakeup_irq_store (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t n) +{ +return -EINVAL ; +} +power_attr (pm_last_wakeup_irq); +#else /* !CONFIG_PM_SLEEP_DEBUG */ static inline void pm_print_times_init (void ) {}#endif /* CONFIG_PM_SLEEP_DEBUG */
@@ -604,6 +622,7 @@ static struct attribute * g[] = {#endif #ifdef CONFIG_PM_SLEEP_DEBUG &pm_print_times_attr.attr, + &pm_last_wakeup_irq_attr.attr,#endif #endif #ifdef CONFIG_FREEZER
Signature · 1 line
1.9.1
Quoted 3 lines · Alexandra Yates
This feature reports the IRQ that was armed for system wakeup after the system was last time suspended. It adds a new sysfs attribute under
/sys/power/named:pm_last_wakeup_irq
What about changing it this way:
Add a sysfs attribute, /sys/power/pm_wakeup_irq, reporting the IRQ number of the first wakeup interrupt (that is, the first interrupt from an IRQ line armed for system wakeup) seen by the kernel during the most recent system suspend/resume cycle.
Quoted 17 lines
This feature will be useful for system wakeup diagnostics of spurious wakeup interrupts.
Signed-off-by Alexandra Yates <[email protected]>--- Documentation/ABI/testing/sysfs-power | 11 +++++++++++ drivers/base/power/wakeup.c | 12 ++++++++++++ include/linux/suspend.h | 8 +++++++- kernel/irq/pm.c | 4 ++-- kernel/power/main.c | 19 +++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-)Documentation/ABI/testing/sysfs-power +0
-0
Documentation/ABI/testing/sysfs-power Description: · line 260
Quoted 5 lines
Documentation/ABI/testing/sysfs-power +2
-0@@ -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_irq
I'd change that to /sys/power/pm_wakeup_irq
Documentation/ABI/testing/sysfs-power Description: · line 266
Quoted 6 lines
Documentation/ABI/testing/sysfs-power +6
-0+Date: April 2015 +Contact: Alexandra Yates <[email protected]> +Description: + The /sys/power/pm_last_wakeup_irq file reports to user space + the IRQ that was armed for system wakeup and occurred since + suspend_device_irqs() was last called.
And here I'd say:
The /sys/power/pm_wakeup_irq file reports to user space the IRQ number of the first wakeup interrupt (that is, the first interrupt from an IRQ line armed for system wakeup) seen by the kernel during the most recent system suspend/resume cycle.
Quoted 8 lines
Documentation/ABI/testing/sysfs-power +3
-0+ + This output is useful for system wakeup diagnostics of spurious + wakeup interrupts.drivers/base/power/wakeup.c +0
-0
drivers/base/power/wakeup.c void pm_wakeup_clear(void) · line 877
Quoted 8 lines
drivers/base/power/wakeup.c +5
-0@@ -870,6 +870,18 @@ void pm_wakeup_clear(void) pm_abort_suspend = false; } +void pm_system_irq_wakeup (unsigned int irq_number) +{ +if (wakeup_irq ==0 ) + wakeup_irq = irq_number; +pm_system_wakeup ();
I'm wondering if we need to call pm_system_wakeup() in the wakeup_irq != 0 case?
If wakeup_irq != 0, pm_system_wakeup() has been called (at least) once already and it is not necessary to call it more than once. Or am I missing anything?
drivers/base/power/wakeup.c void pm_wakeup_clear(void) · line 883
Quoted 6 lines
drivers/base/power/wakeup.c +6
-0+} + +void pm_last_wakeup_irq_reset (void ) +{ + wakeup_irq =0 ; +}
Why don't you clear wakeup_irq in pm_wakeup_clear()? Can it actually change between the time when pm_wakeup_clear() is called and when suspend_device_irqs() runs?
Quoted 71 lines
drivers/base/power/wakeup.c +1
-0+/** * pm_get_wakeup_count - Read the number of registered wakeup events. * @count: Address to store the value at. include/linux/suspend.h +7
-1@@ -371,6 +371,9 @@ static inline bool hibernation_available(void) { return false; }extern struct mutex pm_mutex; +/* IRQ number which causes system wakeup */ +extern unsigned int wakeup_irq; +#ifdef CONFIG_PM_SLEEP void save_processor_state (void );void restore_processor_state (void );@@ -378,7 +381,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 void pm_last_wakeup_irq_reset (void );#define pm_notifier (fn, pri) { \ static struct notifier_block fn##_nb = \ { .notifier_call = fn, .priority = pri }; \@@ -391,6 +394,7 @@ extern bool events_check_enabled;extern bool pm_wakeup_pending (void );extern void pm_system_wakeup (void );extern void pm_wakeup_clear (void ); +extern void pm_system_irq_wakeup (unsigned int );extern bool pm_get_wakeup_count (unsigned int *count,bool block);extern bool pm_save_wakeup_count (unsigned int count);extern void pm_wakep_autosleep_enabled (bool set);@@ -440,6 +444,8 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)static inline bool pm_wakeup_pending (void ) {return false; }static inline void pm_system_wakeup (void ) {}static inline void pm_wakeup_clear (void ) {} +static inline void pm_system_irq_wakeup (unsigned int ) {} +static inline void pm_last_wakeup_irq_reset (void ){};static inline void lock_system_sleep (void ) {}static inline void unlock_system_sleep (void ) {}kernel/irq/pm.c +2
-2@@ -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;@@ -118,7 +118,7 @@ void suspend_device_irqs(void) {struct irq_desc *desc;int irq; - +pm_last_wakeup_irq_reset ();for_each_irq_desc (irq, desc) {unsigned long flags;bool sync;kernel/power/main.c +0
-0
kernel/power/main.c static inline void pm_print_times_init(void) · line 277
Quoted 6 lines
kernel/power/main.c +3
-0@@ -272,6 +272,24 @@ static inline void pm_print_times_init(void) { pm_print_times_enabled = !!initcall_debug; } + +unsigned int wakeup_irq; +EXPORT_SYMBOL_GPL (wakeup_irq);
It doesn't have to be exported to modules.
kernel/power/main.c static inline void pm_print_times_init(void) · line 282
Quoted 5 lines
kernel/power/main.c +5
-0+static ssize_t pm_last_wakeup_irq_show (struct kobject *kobj, +struct kobj_attribute *attr, +char *buf) +{ +return wakeup_irq ?sprintf (buf,"%u\n" , wakeup_irq) : -EINVAL ;
-EINVAL means "invalid argument", which is not the case here.
I'd use -ENODATA.
Quoted 15 lines
kernel/power/main.c +10
-0+} + +static ssize_t pm_last_wakeup_irq_store (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t n) +{ +return -EINVAL ; +} +power_attr (pm_last_wakeup_irq); +#else /* !CONFIG_PM_SLEEP_DEBUG */ static inline void pm_print_times_init (void ) {}#endif /* CONFIG_PM_SLEEP_DEBUG */
kernel/power/main.c static struct attribute * g[] = { · line 628
Quoted 7 lines
kernel/power/main.c +1
-0@@ -604,6 +622,7 @@ static struct attribute * g[] = {#endif #ifdef CONFIG_PM_SLEEP_DEBUG &pm_print_times_attr.attr, + &pm_last_wakeup_irq_attr.attr,#endif #endif #ifdef CONFIG_FREEZER
Thanks,
Rafael
Hi Rafael,
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Alexandra Yates
This feature reports the IRQ that was armed for system wakeup after the system was last time suspended. It adds a new sysfs attribute under
/sys/power/named:pm_last_wakeup_irq
Sounds good
Quoted 62 lines
What about changing it this way:
Add a sysfs attribute,
/sys/power/pm_wakeup_irq, reporting the IRQ number of the first wakeup interrupt (that is, the first interrupt from an IRQ line armed for system wakeup) seen by the kernel during the most recent system suspend/resume cycle.Quoted 17 lines
This feature will be useful for system wakeup diagnostics of spurious wakeup interrupts.
Signed-off-by Alexandra Yates <[email protected]>--- Documentation/ABI/testing/sysfs-power | 11 +++++++++++ drivers/base/power/wakeup.c | 12 ++++++++++++ include/linux/suspend.h | 8 +++++++- kernel/irq/pm.c | 4 ++-- kernel/power/main.c | 19 +++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-)Documentation/ABI/testing/sysfs-power +0
-0Documentation/ABI/testing/sysfs-power Description: · line 260
Quoted 5 lines
Documentation/ABI/testing/sysfs-power +2
-0@@ -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_irqI'd change that to
/sys/power/pm_wakeup_irqDocumentation/ABI/testing/sysfs-power Description: · line 266
Quoted 6 lines
Documentation/ABI/testing/sysfs-power +6
-0+Date: April 2015 +Contact: Alexandra Yates <[email protected]> +Description: + The /sys/power/pm_last_wakeup_irq file reports to user space + the IRQ that was armed for system wakeup and occurred since + suspend_device_irqs() was last called.And here I'd say:
The
/sys/power/pm_wakeup_irqfile reports to user space the IRQ number of the first wakeup interrupt (that is, the first interrupt from an IRQ line armed for system wakeup) seen by the kernel during the most recent system suspend/resume cycle.Quoted 8 lines
Documentation/ABI/testing/sysfs-power +3
-0+ + This output is useful for system wakeup diagnostics of spurious + wakeup interrupts.drivers/base/power/wakeup.c +0
-0drivers/base/power/wakeup.c void pm_wakeup_clear(void) · line 877
Quoted 8 lines
drivers/base/power/wakeup.c +5
-0@@ -870,6 +870,18 @@ void pm_wakeup_clear(void) pm_abort_suspend = false; } +void pm_system_irq_wakeup (unsigned int irq_number) +{ +if (wakeup_irq ==0 ) + wakeup_irq = irq_number; +pm_system_wakeup ();I'm wondering if we need to call
pm_system_wakeup()in thewakeup_irq!= 0 case?
Quoted 2 lines
If
wakeup_irq!= 0,pm_system_wakeup()has been called (at least) once already and it is not necessary to call it more than once. Or am I missing anything?
Here I'm following Thomas advice to create pm_system_irq_wakeup to handle the storage of wakeup_irq I'm simply calling/wrapping pm_system_wakeup() since it was originally called from pm_system_irq_wakeup()with out other additional conditionals.
I think doing anything else here may have unwanted results. The core functionality of
the code can be changed but I think that should be another patch. one targeted towards performance optimization. Please let me know and I could add this to my to do list.
Quoted 6 lines
drivers/base/power/wakeup.c void pm_wakeup_clear(void) · line 883
Quoted 6 lines
drivers/base/power/wakeup.c +6
-0+} + +void pm_last_wakeup_irq_reset (void ) +{ + wakeup_irq =0 ; +}
Will do, good idea.
Quoted 108 lines
Why don't you clear
wakeup_irqinpm_wakeup_clear()? Can it actually change between the time whenpm_wakeup_clear()is called and whensuspend_device_irqs()runs?Quoted 71 lines
drivers/base/power/wakeup.c +1
-0+/** * pm_get_wakeup_count - Read the number of registered wakeup events. * @count: Address to store the value at. include/linux/suspend.h +7
-1@@ -371,6 +371,9 @@ static inline bool hibernation_available(void) { return false; }extern struct mutex pm_mutex; +/* IRQ number which causes system wakeup */ +extern unsigned int wakeup_irq; +#ifdef CONFIG_PM_SLEEP void save_processor_state (void );void restore_processor_state (void );@@ -378,7 +381,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 void pm_last_wakeup_irq_reset (void );#define pm_notifier (fn, pri) { \ static struct notifier_block fn##_nb = \ { .notifier_call = fn, .priority = pri }; \@@ -391,6 +394,7 @@ extern bool events_check_enabled;extern bool pm_wakeup_pending (void );extern void pm_system_wakeup (void );extern void pm_wakeup_clear (void ); +extern void pm_system_irq_wakeup (unsigned int );extern bool pm_get_wakeup_count (unsigned int *count,bool block);extern bool pm_save_wakeup_count (unsigned int count);extern void pm_wakep_autosleep_enabled (bool set);@@ -440,6 +444,8 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)static inline bool pm_wakeup_pending (void ) {return false; }static inline void pm_system_wakeup (void ) {}static inline void pm_wakeup_clear (void ) {} +static inline void pm_system_irq_wakeup (unsigned int ) {} +static inline void pm_last_wakeup_irq_reset (void ){};static inline void lock_system_sleep (void ) {}static inline void unlock_system_sleep (void ) {}kernel/irq/pm.c +2
-2@@ -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;@@ -118,7 +118,7 @@ void suspend_device_irqs(void) {struct irq_desc *desc;int irq; - +pm_last_wakeup_irq_reset ();for_each_irq_desc (irq, desc) {unsigned long flags;bool sync;kernel/power/main.c +0
-0kernel/power/main.c static inline void pm_print_times_init(void) · line 277
Quoted 6 lines
kernel/power/main.c +3
-0@@ -272,6 +272,24 @@ static inline void pm_print_times_init(void) { pm_print_times_enabled = !!initcall_debug; } + +unsigned int wakeup_irq; +EXPORT_SYMBOL_GPL (wakeup_irq);It doesn't have to be exported to modules.
kernel/power/main.c static inline void pm_print_times_init(void) · line 282
Quoted 5 lines
kernel/power/main.c +5
-0+static ssize_t pm_last_wakeup_irq_show (struct kobject *kobj, +struct kobj_attribute *attr, +char *buf) +{ +return wakeup_irq ?sprintf (buf,"%u\n" , wakeup_irq) : -EINVAL ;
-EINVALmeans "invalid argument", which is not the case here.I'd use
-ENODATA.Quoted 16 lines
kernel/power/main.c +10
-0+} + +static ssize_t pm_last_wakeup_irq_store (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buf,size_t n) +{ +return -EINVAL ; +} +power_attr (pm_last_wakeup_irq); +#else /* !CONFIG_PM_SLEEP_DEBUG */ static inline void pm_print_times_init (void ) {}#endif /* CONFIG_PM_SLEEP_DEBUG */ @@ -604,6 +622,7 @@ static struct attribute * g[] = {#endif #ifdef CONFIG_PM_SLEEP_DEBUG
Quoted 10 lines
kernel/power/main.c static struct attribute * g[] = { · line 628
Quoted 6 lines
kernel/power/main.c +1
-0&pm_print_times_attr.attr, + &pm_last_wakeup_irq_attr.attr,#endif #endif #ifdef CONFIG_FREEZER Thanks,
Rafael
I'm sending patch v9 for your review.
Signature · 2 lines
Thank you, <Alexandra>
Quoted 72 lines · Alexandra Yates
Hi Rafael,
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Alexandra Yates
This feature reports the IRQ that was armed for system wakeup after the system was last time suspended. It adds a new sysfs attribute under
/sys/power/named:pm_last_wakeup_irqSounds good
Quoted 62 lines
What about changing it this way:
Add a sysfs attribute,
/sys/power/pm_wakeup_irq, reporting the IRQ number of the first wakeup interrupt (that is, the first interrupt from an IRQ line armed for system wakeup) seen by the kernel during the most recent system suspend/resume cycle.Quoted 17 lines
This feature will be useful for system wakeup diagnostics of spurious wakeup interrupts.
Signed-off-by Alexandra Yates <[email protected]>--- Documentation/ABI/testing/sysfs-power | 11 +++++++++++ drivers/base/power/wakeup.c | 12 ++++++++++++ include/linux/suspend.h | 8 +++++++- kernel/irq/pm.c | 4 ++-- kernel/power/main.c | 19 +++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-)Documentation/ABI/testing/sysfs-power +0
-0Documentation/ABI/testing/sysfs-power Description: · line 260
Quoted 5 lines
Documentation/ABI/testing/sysfs-power +2
-0@@ -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_irqI'd change that to
/sys/power/pm_wakeup_irqDocumentation/ABI/testing/sysfs-power Description: · line 266
Quoted 6 lines
Documentation/ABI/testing/sysfs-power +6
-0+Date: April 2015 +Contact: Alexandra Yates <[email protected]> +Description: + The /sys/power/pm_last_wakeup_irq file reports to user space + the IRQ that was armed for system wakeup and occurred since + suspend_device_irqs() was last called.And here I'd say:
The
/sys/power/pm_wakeup_irqfile reports to user space the IRQ number of the first wakeup interrupt (that is, the first interrupt from an IRQ line armed for system wakeup) seen by the kernel during the most recent system suspend/resume cycle.Quoted 8 lines
Documentation/ABI/testing/sysfs-power +3
-0+ + This output is useful for system wakeup diagnostics of spurious + wakeup interrupts.drivers/base/power/wakeup.c +0
-0drivers/base/power/wakeup.c void pm_wakeup_clear(void) · line 877
Quoted 8 lines
drivers/base/power/wakeup.c +5
-0@@ -870,6 +870,18 @@ void pm_wakeup_clear(void) pm_abort_suspend = false; } +void pm_system_irq_wakeup (unsigned int irq_number) +{ +if (wakeup_irq ==0 ) + wakeup_irq = irq_number; +pm_system_wakeup ();I'm wondering if we need to call
pm_system_wakeup()in thewakeup_irq!= 0 case?Quoted 2 lines
If
wakeup_irq!= 0,pm_system_wakeup()has been called (at least) once already and it is not necessary to call it more than once. Or am I missing anything?
Quoted 12 lines
Here I'm following Thomas advice to create
pm_system_irq_wakeupto handle the
storage ofwakeup_irqI'm simply calling/wrappingpm_system_wakeup()since it was
originally called from pm_system_irq_wakeup()with out other additional conditionals.
I think doing anything else here may have unwanted results. The core
functionality of
the code can be changed but I think that should be another patch. one targeted towards
performance optimization. Please let me know and I could add this to my to do list.
My point is that you can do
if (wakeup_irq == 0) {
wakeup_irq = irq_number;
pm_system_wakeup();
}instead of calling pm_system_wakeup() unconditionally even if wakeup_irq != 0, can't you?
Thanks,
Rafael
Quoted 87 lines · Rafael J. Wysocki
Quoted 72 lines · Alexandra Yates
Hi Rafael,
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Alexandra Yates
This feature reports the IRQ that was armed for system wakeup after the system was last time suspended. It adds a new sysfs attribute under
/sys/power/named:pm_last_wakeup_irqSounds good
Quoted 62 lines
What about changing it this way:
Add a sysfs attribute,
/sys/power/pm_wakeup_irq, reporting the IRQ number of the first wakeup interrupt (that is, the first interrupt from an IRQ line armed for system wakeup) seen by the kernel during the most recent system suspend/resume cycle.Quoted 17 lines
This feature will be useful for system wakeup diagnostics of spurious wakeup interrupts.
Signed-off-by Alexandra Yates <[email protected]>--- Documentation/ABI/testing/sysfs-power | 11 +++++++++++ drivers/base/power/wakeup.c | 12 ++++++++++++ include/linux/suspend.h | 8 +++++++- kernel/irq/pm.c | 4 ++-- kernel/power/main.c | 19 +++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-)Documentation/ABI/testing/sysfs-power +0
-0Documentation/ABI/testing/sysfs-power Description: · line 260
Quoted 5 lines
Documentation/ABI/testing/sysfs-power +2
-0@@ -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_irqI'd change that to
/sys/power/pm_wakeup_irqDocumentation/ABI/testing/sysfs-power Description: · line 266
Quoted 6 lines
Documentation/ABI/testing/sysfs-power +6
-0+Date: April 2015 +Contact: Alexandra Yates <[email protected]> +Description: + The /sys/power/pm_last_wakeup_irq file reports to user space + the IRQ that was armed for system wakeup and occurred since + suspend_device_irqs() was last called.And here I'd say:
The
/sys/power/pm_wakeup_irqfile reports to user space the IRQ number of the first wakeup interrupt (that is, the first interrupt from an IRQ line armed for system wakeup) seen by the kernel during the most recent system suspend/resume cycle.Quoted 8 lines
Documentation/ABI/testing/sysfs-power +3
-0+ + This output is useful for system wakeup diagnostics of spurious + wakeup interrupts.drivers/base/power/wakeup.c +0
-0drivers/base/power/wakeup.c void pm_wakeup_clear(void) · line 877
Quoted 8 lines
drivers/base/power/wakeup.c +5
-0@@ -870,6 +870,18 @@ void pm_wakeup_clear(void) pm_abort_suspend = false; } +void pm_system_irq_wakeup (unsigned int irq_number) +{ +if (wakeup_irq ==0 ) + wakeup_irq = irq_number; +pm_system_wakeup ();I'm wondering if we need to call
pm_system_wakeup()in thewakeup_irq!= 0 case?Quoted 2 lines
If
wakeup_irq!= 0,pm_system_wakeup()has been called (at least) once already and it is not necessary to call it more than once. Or am I missing anything?Quoted 12 lines
Here I'm following Thomas advice to create
pm_system_irq_wakeupto handle the
storage ofwakeup_irqI'm simply calling/wrappingpm_system_wakeup()since it was
originally called from pm_system_irq_wakeup()with out other additional conditionals.
I think doing anything else here may have unwanted results. The core
functionality of
the code can be changed but I think that should be another patch. one targeted towards
performance optimization. Please let me know and I could add this to my to do list.My point is that you can do
Quoted 7 lines
if (wakeup_irq == 0) { wakeup_irq = irq_number; pm_system_wakeup(); }instead of calling
pm_system_wakeup()unconditionally even ifwakeup_irq!= 0, can't you?
My concern is how this change would impact any other IRQs that were armed.
Apparently from my testing there is no further impact.
The patch was sent with version10. In case there are issues patch V09 doesn't include this change.
Quoted 4 lines
Thanks,
Rafael
Signature · 2 lines
Thank you, <Alexandra>
Quoted 73 lines · Rafael J. Wysocki
Quoted 72 lines · Alexandra Yates
Hi Rafael,
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Alexandra Yates
This feature reports the IRQ that was armed for system wakeup after the system was last time suspended. It adds a new sysfs attribute under
/sys/power/named:pm_last_wakeup_irqSounds good
Quoted 64 lines
What about changing it this way:
Add a sysfs attribute,
/sys/power/pm_wakeup_irq, reporting the IRQ number of the first wakeup interrupt (that is, the first interrupt from an IRQ line armed for system wakeup) seen by the kernel during the most recent system suspend/resume cycle.Quoted 17 lines
This feature will be useful for system wakeup diagnostics of spurious wakeup interrupts.
Signed-off-by Alexandra Yates <[email protected]>--- Documentation/ABI/testing/sysfs-power | 11 +++++++++++ drivers/base/power/wakeup.c | 12 ++++++++++++ include/linux/suspend.h | 8 +++++++- kernel/irq/pm.c | 4 ++-- kernel/power/main.c | 19 +++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-)Documentation/ABI/testing/sysfs-power +0
-0Documentation/ABI/testing/sysfs-power Description: · line 260
Quoted 5 lines
Documentation/ABI/testing/sysfs-power +2
-0@@ -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_irqI'd change that to
/sys/power/pm_wakeup_irqDocumentation/ABI/testing/sysfs-power Description: · line 266
Quoted 6 lines
Documentation/ABI/testing/sysfs-power +6
-0+Date: April 2015 +Contact: Alexandra Yates <[email protected]> +Description: + The /sys/power/pm_last_wakeup_irq file reports to user space + the IRQ that was armed for system wakeup and occurred since + suspend_device_irqs() was last called.And here I'd say:
The
/sys/power/pm_wakeup_irqfile reports to user space the IRQ number of the first wakeup interrupt (that is, the first interrupt from an IRQ line armed for system wakeup) seen by the kernel during the most recent system suspend/resume cycle.Quoted 8 lines
Documentation/ABI/testing/sysfs-power +3
-0+ + This output is useful for system wakeup diagnostics of spurious + wakeup interrupts.drivers/base/power/wakeup.c +0
-0drivers/base/power/wakeup.c void pm_wakeup_clear(void) · line 877
Quoted 8 lines
drivers/base/power/wakeup.c +5
-0@@ -870,6 +870,18 @@ void pm_wakeup_clear(void) pm_abort_suspend = false; } +void pm_system_irq_wakeup (unsigned int irq_number) +{ +if (wakeup_irq ==0 ) + wakeup_irq = irq_number; +pm_system_wakeup ();I'm wondering if we need to call
pm_system_wakeup()in thewakeup_irq!= 0 case?If
wakeup_irq!= 0,pm_system_wakeup()has been called (at least) once already and it is not necessary to call it more than once. Or am I missing anything?
Quoted 12 lines
Quoted 4 lines
Here I'm following Thomas advice to create
pm_system_irq_wakeupto handle the
storage ofwakeup_irqI'm simply calling/wrappingpm_system_wakeup()since it wasQuoted 8 lines
originally called from pm_system_irq_wakeup()with out other additional conditionals.
I think doing anything else here may have unwanted results. The core
functionality of
the code can be changed but I think that should be another patch. one targeted towards
performance optimization. Please let me know and I could add this to my to do list.
My concern is how this change would impact any other IRQs that were armed.
Apparently from my testing there is no further impact.
The patch was sent with version10. In case there are issues patch V09 doesn't include this change.
Quoted 18 lines
My point is that you can do
if (wakeup_irq == 0) { wakeup_irq = irq_number; pm_system_wakeup(); }instead of calling
pm_system_wakeup()unconditionally even ifwakeup_irq!= 0, can't you?Thanks,
Rafael--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Thank you, <Alexandra>