Skip to contentSkip to conversation

irq: enable suspended EARLY_RESUME irqs forcefully if not resumed

PATCH In review Laxman Dewangan 3 participants 6 messages Jul 9, 2013 – Jul 31, 2013 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irq: enable suspended EARLY_RESUME irqs forcefully if not resumed

When system enters into suspend, it disable all irqs in single function call. This disables EARLY_RESUME irqs also along with normal irqs.

The EARLY_RESUME irqs get enabled in sys_core_ops->resume and non-EARLY_RESUME irqs get enabled in normal system resume path.

When suspend_noirq failed or suspend is aborted for any reason, the EARLY_RESUME irqs do not get enabled as sys_core_ops->resume() call did not happen. It only enables the non-EARLY_RESUME irqs in normal disable for remaining life of system.

Add checks on normal irq_resume() whether EARLY_RESUME irqs have been enabled or not and if not then enable it forcefully.

---
 kernel/irq/pm.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
kernel/irq/pm.c +10 -0
index cb228bf..e8a1427 100644
@@ -13,6 +13,8 @@
 
 #include "internals.h"
 
+static bool early_resume_irq_suspended;
+
 /**
  * suspend_device_irqs - disable all currently enabled interrupt lines
  *
@@ -37,6 +39,7 @@ void suspend_device_irqs(void)
 	for_each_irq_desc(irq, desc)
 		if (desc->istate & IRQS_SUSPENDED)
 			synchronize_irq(irq);
+	early_resume_irq_suspended = true;
 }
 EXPORT_SYMBOL_GPL(suspend_device_irqs);
 
@@ -67,6 +70,7 @@ static void resume_irqs(bool want_early)
 static void irq_pm_syscore_resume(void)
 {
 	resume_irqs(true);
+	early_resume_irq_suspended = false;
 }
 
 static struct syscore_ops irq_pm_syscore_ops = {
@@ -87,9 +91,15 @@ device_initcall(irq_pm_init_ops);
  * Enable all non-%IRQF_EARLY_RESUME interrupt lines previously
  * disabled by suspend_device_irqs() that have the IRQS_SUSPENDED flag
  * set as well as those with %IRQF_FORCE_RESUME.
+ * Also enable IRQF_EARLY_RESUME irqs if it is not enabled by syscore_ops
+ * resume path.
  */
 void resume_device_irqs(void)
 {
+	if (early_resume_irq_suspended) {
+		pr_err("%s: Resuming IRQF_EARLY_RESUME forcefully\n", __func__);
+		irq_pm_syscore_resume();
+	}
 	resume_irqs(false);
 }
 EXPORT_SYMBOL_GPL(resume_device_irqs);
Signature · 1 line
1.7.1.1
#1 lore raw

Hi Thomas,

Quoted 12 lines · Laxman Dewangan

When system enters into suspend, it disable all irqs in single function call. This disables EARLY_RESUME irqs also along with normal irqs.

The EARLY_RESUME irqs get enabled in sys_core_ops->resume and non-EARLY_RESUME irqs get enabled in normal system resume path.

When suspend_noirq failed or suspend is aborted for any reason, the EARLY_RESUME irqs do not get enabled as sys_core_ops->resume() call did not happen. It only enables the non-EARLY_RESUME irqs in normal disable for remaining life of system.

Quoted 5 lines

Add checks on normal irq_resume() whether EARLY_RESUME irqs have been enabled or not and if not then enable it forcefully.

---

Any feedback on this patch please?

Thanks,
Laxman

#2 lore raw
In reply to Laxman Dewangan
Quoted 16 lines · Laxman Dewangan

When system enters into suspend, it disable all irqs in single function call. This disables EARLY_RESUME irqs also along with normal irqs.

The EARLY_RESUME irqs get enabled in sys_core_ops->resume and non-EARLY_RESUME irqs get enabled in normal system resume path.

When suspend_noirq failed or suspend is aborted for any reason, the EARLY_RESUME irqs do not get enabled as sys_core_ops->resume() call did not happen. It only enables the non-EARLY_RESUME irqs in normal disable for remaining life of system.

Add checks on normal irq_resume() whether EARLY_RESUME irqs have been enabled or not and if not then enable it forcefully.

Review

Quoted 2 lines
(quoted diff) +2 -0
+static bool early_resume_irq_suspended;
+

Instead of doing that status dance, we could simply reenable all interrupts in irq_resume(). There's nothing wrong to unmask the few IRQF_EARLY_RESUME interrupts again.

Just the XEN ones might be upset. Konrad ?

Thanks,

tglx

kernel/irq/pm.c +1 -1
Index: linux-2.6/kernel/irq/pm.c
===================================================================
@@ -50,7 +50,7 @@ static void resume_irqs(bool want_early)
 		bool is_early = desc->action &&
 			desc->action->flags & IRQF_EARLY_RESUME;
 
-		if (is_early != want_early)
+		if (!is_early && want_early)
 			continue;
 
 		raw_spin_lock_irqsave(&desc->lock, flags);
#3 lore raw
Quoted 17 lines · Thomas Gleixner
Quoted 16 lines · Laxman Dewangan

When system enters into suspend, it disable all irqs in single function call. This disables EARLY_RESUME irqs also along with normal irqs.

The EARLY_RESUME irqs get enabled in sys_core_ops->resume and non-EARLY_RESUME irqs get enabled in normal system resume path.

When suspend_noirq failed or suspend is aborted for any reason, the EARLY_RESUME irqs do not get enabled as sys_core_ops->resume() call did not happen. It only enables the non-EARLY_RESUME irqs in normal disable for remaining life of system.

Add checks on normal irq_resume() whether EARLY_RESUME irqs have been enabled or not and if not then enable it forcefully.

Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+static bool early_resume_irq_suspended;
+

Instead of doing that status dance, we could simply reenable all interrupts in irq_resume(). There's nothing wrong to unmask the few IRQF_EARLY_RESUME interrupts again.

Just the XEN ones might be upset. Konrad ?

It should not. I did test it and it ran just fine throught the gauntlet test - but let me check it with me looking at the console.

Quoted 18 lines

Thanks,

tglx

Index: linux-2.6/kernel/irq/pm.c
===================================================================

kernel/irq/pm.c +1 -1
@@ -50,7 +50,7 @@ static void resume_irqs(bool want_early)
 		bool is_early = desc->action &&
 			desc->action->flags & IRQF_EARLY_RESUME;
 
-		if (is_early != want_early)
+		if (!is_early && want_early)
 			continue;
 
 		raw_spin_lock_irqsave(&desc->lock, flags);
#4 lore raw
Quoted 25 lines · Konrad Rzeszutek Wilk
Quoted 24 lines · Thomas Gleixner
Quoted 16 lines · Laxman Dewangan

When system enters into suspend, it disable all irqs in single function call. This disables EARLY_RESUME irqs also along with normal irqs.

The EARLY_RESUME irqs get enabled in sys_core_ops->resume and non-EARLY_RESUME irqs get enabled in normal system resume path.

When suspend_noirq failed or suspend is aborted for any reason, the EARLY_RESUME irqs do not get enabled as sys_core_ops->resume() call did not happen. It only enables the non-EARLY_RESUME irqs in normal disable for remaining life of system.

Add checks on normal irq_resume() whether EARLY_RESUME irqs have been enabled or not and if not then enable it forcefully.

Review

Quoted 2 lines
(quoted diff) +2 -0
+static bool early_resume_irq_suspended;
+

Instead of doing that status dance, we could simply reenable all interrupts in irq_resume(). There's nothing wrong to unmask the few IRQF_EARLY_RESUME interrupts again.

Quoted 4 lines
Quoted 1 line

Just the XEN ones might be upset. Konrad ?

It should not. I did test it and it ran just fine throught the gauntlet test - but let me check it with me looking at the console.

It is good. You can add an Acked-by-and-Tested-by from me if you would like. Thanks!

Quoted 19 lines
Quoted 19 lines

Thanks,

tglx

Index: linux-2.6/kernel/irq/pm.c
===================================================================

kernel/irq/pm.c +1 -1
@@ -50,7 +50,7 @@ static void resume_irqs(bool want_early)
 		bool is_early = desc->action &&
 			desc->action->flags & IRQF_EARLY_RESUME;
 
-		if (is_early != want_early)
+		if (!is_early && want_early)
 			continue;
 
 		raw_spin_lock_irqsave(&desc->lock, flags);
author Acked-by
#5 lore raw
Quoted 25 lines · Konrad Rzeszutek Wilk
Quoted 24 lines · Konrad Rzeszutek Wilk
Quoted 23 lines · Thomas Gleixner
Quoted 16 lines · Laxman Dewangan

When system enters into suspend, it disable all irqs in single function call. This disables EARLY_RESUME irqs also along with normal irqs.

The EARLY_RESUME irqs get enabled in sys_core_ops->resume and non-EARLY_RESUME irqs get enabled in normal system resume path.

When suspend_noirq failed or suspend is aborted for any reason, the EARLY_RESUME irqs do not get enabled as sys_core_ops->resume() call did not happen. It only enables the non-EARLY_RESUME irqs in normal disable for remaining life of system.

Add checks on normal irq_resume() whether EARLY_RESUME irqs have been enabled or not and if not then enable it forcefully.

Review

Quoted 2 lines
(quoted diff) +2 -0
+static bool early_resume_irq_suspended;
+

Instead of doing that status dance, we could simply reenable all interrupts in irq_resume(). There's nothing wrong to unmask the few IRQF_EARLY_RESUME interrupts again.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Just the XEN ones might be upset. Konrad ?

It should not. I did test it and it ran just fine throught the gauntlet test - but let me check it with me looking at the console.

It is good. You can add an Acked-by-and-Tested-by from me if you would like. Thanks!

Hi Thomas,
Can your change be applied now if this is good? I am fine with the following change. If you want, I can send this change through patch or you can take my Ack, whatever is good.

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

Thanks,

tglx

Index: linux-2.6/kernel/irq/pm.c
===================================================================

kernel/irq/pm.c +1 -1
@@ -50,7 +50,7 @@ static void resume_irqs(bool want_early)
  		bool is_early = desc->action &&
  			desc->action->flags & IRQF_EARLY_RESUME;
 
-		if (is_early != want_early)
+		if (!is_early && want_early)
  			continue;
 
  		raw_spin_lock_irqsave(&desc->lock, flags);