Skip to contentSkip to conversation

add flag IRQF_NO_SUSPEND in 'struct irqaction'

PATCH In review Guanqun Lu 3 participants 6 messages Jul 13, 2009 – Jul 15, 2009

Subsystems (4)
lore
Share & tools
lore
author
#1 lore raw

PATCH 2/3 add IRQF_NO_SUSPEND for 'bind_ipi_to_irqhandler'

In reply to Guanqun Lu

This function exports the ipi functionality to kernel, and the corresponding irq should not be disabled during host S3 suspend.

---
 drivers/xen/events.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/xen/events.c +1 -0
index 97f4b39..58606d5 100644
@@ -532,6 +532,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
 	if (irq < 0)
 		return irq;
 
+	irqflags |= IRQF_NO_SUSPEND;
 	retval = request_irq(irq, handler, irqflags, devname, dev_id);
 	if (retval != 0) {
 		unbind_from_irq(irq);
Signature · 1 line
1.6.1.rc3

Guanqun Lu

author
#0 lore raw

PATCH 1/3 add flag IRQF_NO_SUSPEND in 'struct irqaction'

We currently only bypass IRQF_TIMER in '__disable_irq', but Xen specific IRQs should not be disabled either. This commit adds a new flag to accompolish this goal without being mixed up with IRQF_TIMER flag.

---
 include/linux/interrupt.h |    1 +
 kernel/irq/manage.c       |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)
include/linux/interrupt.h +1 -0
index 8a9613d..8ad2b6f 100644
@@ -58,6 +58,7 @@
 #define IRQF_PERCPU		0x00000400
 #define IRQF_NOBALANCING	0x00000800
 #define IRQF_IRQPOLL		0x00001000
+#define IRQF_NO_SUSPEND		0x00002000
 
 typedef irqreturn_t (*irq_handler_t)(int, void *);
 
kernel/irq/manage.c +2 -1
index 1516ab7..f814678 100644
@@ -165,7 +165,8 @@ static inline int setup_affinity(unsigned int irq, struct irq_desc *desc)
 void __disable_irq(struct irq_desc *desc, unsigned int irq, bool suspend)
 {
 	if (suspend) {
-		if (!desc->action || (desc->action->flags & IRQF_TIMER))
+		if (!desc->action ||
+		    (desc->action->flags & (IRQF_TIMER | IRQF_NO_SUSPEND)))
 			return;
 		desc->status |= IRQ_SUSPENDED;
 	}
Signature · 1 line
1.6.1.rc3
author
#2 lore raw

PATCH 3/3 add IRQF_TIMER to Xen timer.

In reply to Guanqun Lu

This flag tells the kernel that this irq should not be disabled during host S3 suspend.

---
 arch/x86/xen/time.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/xen/time.c +1 -1
index 14f2406..ae42832 100644
@@ -429,7 +429,7 @@ void xen_setup_timer(int cpu)
 		name = "<timer kasprintf failed>";
 
 	irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
-				      IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING,
+				      IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER,
 				      name, NULL);
 
 	evt = &per_cpu(xen_clock_events, cpu);
Signature · 1 line
1.6.1.rc3
#3 lore raw
In reply to Guanqun Lu

Hi Jeremy,

Forget to mention, this series of patches are targeting for pv_ops dom0 host S3.

We have tried the host S3 branch (xen-tip/dom0/acpi) and find host S3 will hang at disable_nonboot_cpus. the root cause is that suspend_device_irqs () unfortunately will disable the irq of XEN_CALL_FUNCTION_SINGLE_VECTOR IPI and xen_timer_interrupt VIRQ, which however are required by disable_nonboot_cpus. To fix this issue, flag IRQF_NO_SUSPEND is added to Xen IPI and IRQF_TIMER is added to xen_timer_interrupt VIRQ, to notify suspend_device_irqs not to disable these irqs when suspend.

After applying this series of patches to xen-tip/dom0/acpi branch, and rebasing xen-tip/dom0/acpi to xen-tip/master, the pv_ops dom0 host S3 is working in our side.

Best Regards
Ke

Quoted 55 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Guanqun Lu
Sent: Tuesday, July 14, 2009 5:44 PM
To: [email protected]
Cc: Lu, Guanqun
Subject: [Xen-devel] [PATCH 1/3] add flag IRQF_NO_SUSPEND in 'struct irqaction'

We currently only bypass IRQF_TIMER in '__disable_irq', but Xen specific IRQs should not be disabled either. This commit adds a new flag to accompolish this goal without being mixed up with IRQF_TIMER flag.

---

include/linux/interrupt.h |    1 +
kernel/irq/manage.c       |    3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
include/linux/interrupt.h +1 -0
index 8a9613d..8ad2b6f 100644
@@ -58,6 +58,7 @@
 #define IRQF_PERCPU		0x00000400
 #define IRQF_NOBALANCING	0x00000800
 #define IRQF_IRQPOLL		0x00001000
+#define IRQF_NO_SUSPEND		0x00002000
 
 typedef irqreturn_t (*irq_handler_t)(int, void *);
 
kernel/irq/manage.c +2 -1
index 1516ab7..f814678 100644
@@ -165,7 +165,8 @@ static inline int setup_affinity(unsigned int irq, struct
 irq_desc *desc)
 void __disable_irq(struct irq_desc *desc, unsigned int irq, bool suspend)
 {
 	if (suspend) {
-		if (!desc->action || (desc->action->flags & IRQF_TIMER))
+		if (!desc->action ||
+		    (desc->action->flags & (IRQF_TIMER | IRQF_NO_SUSPEND)))
 			return;
 		desc->status |= IRQ_SUSPENDED;
	}

--
1.6.1.rc3

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
Quoted 8 lines · Ke

Hi Jeremy,

Forget to mention, this series of patches are targeting for pv_ops dom0 host S3.

We have tried the host S3 branch (xen-tip/dom0/acpi) and find host S3 will hang at disable_nonboot_cpus. the root cause is that suspend_device_irqs () unfortunately will disable the irq of XEN_CALL_FUNCTION_SINGLE_VECTOR IPI and xen_timer_interrupt VIRQ, which however are required by disable_nonboot_cpus. To fix this issue, flag IRQF_NO_SUSPEND is added to Xen IPI and IRQF_TIMER is added to xen_timer_interrupt VIRQ, to notify suspend_device_irqs not to disable these irqs when suspend.

After applying this series of patches to xen-tip/dom0/acpi branch, and rebasing xen-tip/dom0/acpi to xen-tip/master, the pv_ops dom0 host S3 is working in our side.

Thanks for debugging that. Could you send me a patch? Is the IRQF_NO_SUSPEND flag something you've had to add?

Thanks,

J

#5 lore raw
Quoted 27 lines

-----Original Message-----
From: Jeremy Fitzhardinge [mailto:[email protected]]
Sent: Wednesday, July 15, 2009 4:01 AM
To: Yu, Ke
Cc: [email protected]; Lu, Guanqun
Subject: Re: [Xen-devel] [PATCH 1/3] add flag IRQF_NO_SUSPEND in 'struct irqaction'

Quoted 3 lines · Ke

Hi Jeremy,

Forget to mention, this series of patches are targeting for pv_ops dom0

host S3.

Quoted 2 lines

We have tried the host S3 branch (xen-tip/dom0/acpi) and find host S3 will

hang at disable_nonboot_cpus. the root cause is that suspend_device_irqs () unfortunately will disable the irq of XEN_CALL_FUNCTION_SINGLE_VECTOR IPI and xen_timer_interrupt VIRQ, which however are required by disable_nonboot_cpus. To fix this issue, flag IRQF_NO_SUSPEND is added to Xen IPI and IRQF_TIMER is added to xen_timer_interrupt VIRQ, to notify suspend_device_irqs not to disable these irqs when suspend.

Quoted 2 lines

After applying this series of patches to xen-tip/dom0/acpi branch, and

rebasing xen-tip/dom0/acpi to xen-tip/master, the pv_ops dom0 host S3 is working in our side.

Quoted 1 line
Quoted 6 lines

Thanks for debugging that. Could you send me a patch? Is the IRQF_NO_SUSPEND flag something you've had to add?

Thanks,

J

The three patches Guanqun posted has all the fixes I mentioned. I just add some background here for better understanding :)

For the flag IRQF_NO_SUSPEND, indeed, we can use IRQF_TIMER to achieve the same functionality, but this does not match the semantic of IRQF_TIMER, since it is used for timer, while xen IPI obviously is not. There is similar discussion in LKML thread http://marc.info/?l=linux-kernel&m=123561730928222&w=2 where Ingo suggested to add new flag IRQF_NO_SUSPEND instead of using the existing IRQF_TIMER. Although the IRQF_NO_SUSPEND is not added finally due to that issue is fixed in another way. This thread implies IRQF_NO_SUSPEND is more clean in this case.

Best Regards
Ke