Skip to contentSkip to conversation

x86/xen: resume timer irqs early

PATCH In review David Vrabel 3 participants 7 messages Aug 7, 2014 – Aug 8, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/xen: resume timer irqs early

If the timer irqs are resumed during device resume it is possible in certain circumstances for the resume to hang early on, before device interrupts are resumed.

It is not entirely clear what is occuring the point of the hang but I think a task necessary for the resume calls schedule_timeout(), waiting for a timer interrupt (which never arrives). This failure may require specific tasks to be running on the other VCPUs to trigger (processes are not frozen during a suspend/resume if PREEMPT is disabled).

Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in syscore_resume().

Also add IRQF_NO_SUSPEND as it is not necessary to suspend the timer interrupts and IRQF_FORCE_RESUME was already set.

---
 arch/x86/xen/time.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/xen/time.c +4 -2
index 7b78f88..90dd311 100644
@@ -443,8 +443,10 @@ void xen_setup_timer(int cpu)
 		name = "<timer kasprintf failed>";
 
 	irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
-				      IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER|
-				      IRQF_FORCE_RESUME,
+				      IRQF_PERCPU | IRQF_NOBALANCING
+				      | IRQF_TIMER
+				      | IRQF_NO_SUSPEND | IRQF_FORCE_RESUME
+				      | IRQF_EARLY_RESUME,
 				      name, NULL);
 	(void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX);
 
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 11 lines · David Vrabel

If the timer irqs are resumed during device resume it is possible in certain circumstances for the resume to hang early on, before device interrupts are resumed.

It is not entirely clear what is occuring the point of the hang but I think a task necessary for the resume calls schedule_timeout(), waiting for a timer interrupt (which never arrives). This failure may require specific tasks to be running on the other VCPUs to trigger (processes are not frozen during a suspend/resume if PREEMPT is disabled).

Quoted 5 lines

Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in syscore_resume().

Also add IRQF_NO_SUSPEND as it is not necessary to suspend the timer interrupts and IRQF_FORCE_RESUME was already set.

IRQF_NO_SUSPEND is a component of IRQF_TIMER.

-boris

Quoted 23 lines
---
  arch/x86/xen/time.c |    6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/xen/time.c +4 -2
index 7b78f88..90dd311 100644
@@ -443,8 +443,10 @@ void xen_setup_timer(int cpu)
  		name = "<timer kasprintf failed>";
 
  	irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
-				      IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER|
-				      IRQF_FORCE_RESUME,
+				      IRQF_PERCPU | IRQF_NOBALANCING
+				      | IRQF_TIMER
+				      | IRQF_NO_SUSPEND | IRQF_FORCE_RESUME
+				      | IRQF_EARLY_RESUME,
  				      name, NULL);
  	(void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX);
 
#2 lore raw
Quoted 12 lines · Boris Ostrovsky
Quoted 11 lines · David Vrabel

If the timer irqs are resumed during device resume it is possible in certain circumstances for the resume to hang early on, before device interrupts are resumed.

It is not entirely clear what is occuring the point of the hang but I think a task necessary for the resume calls schedule_timeout(), waiting for a timer interrupt (which never arrives). This failure may require specific tasks to be running on the other VCPUs to trigger (processes are not frozen during a suspend/resume if PREEMPT is disabled).

Quoted 8 lines
Quoted 5 lines

Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in syscore_resume().

Also add IRQF_NO_SUSPEND as it is not necessary to suspend the timer interrupts and IRQF_FORCE_RESUME was already set.

IRQF_NO_SUSPEND is a component of IRQF_TIMER.

So it is. How about this instead?

8<----------------------------
x86/xen: resume timer irqs early

If the timer irqs are resumed during device resume it is possible in certain circumstances for the resume to hang early on, before device interrupts are resumed.

It is not entirely clear what is occuring the point of the hang but I think a task necessary for the resume calls schedule_timeout(), waiting for a timer interrupt (which never arrives). This failure may require specific tasks to be running on the other VCPUs to trigger (processes are not frozen during a suspend/resume if PREEMPT is disabled).

Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in syscore_resume().

---
 arch/x86/xen/time.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/xen/time.c +1 -1
index 7b78f88..5718b0b 100644
@@ -444,7 +444,7 @@ void xen_setup_timer(int cpu)
 
 	irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
 				      IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER|
-				      IRQF_FORCE_RESUME,
+				      IRQF_FORCE_RESUME|IRQF_EARLY_RESUME,
 				      name, NULL);
 	(void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX);
 
Signature · 1 line
1.7.10.4
reviewer Reviewed-by
#3 lore raw
Quoted 13 lines · David Vrabel
Quoted 12 lines · Boris Ostrovsky
Quoted 11 lines · David Vrabel

If the timer irqs are resumed during device resume it is possible in certain circumstances for the resume to hang early on, before device interrupts are resumed.

It is not entirely clear what is occuring the point of the hang but I think a task necessary for the resume calls schedule_timeout(), waiting for a timer interrupt (which never arrives). This failure may require specific tasks to be running on the other VCPUs to trigger (processes are not frozen during a suspend/resume if PREEMPT is disabled).

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in syscore_resume().

Also add IRQF_NO_SUSPEND as it is not necessary to suspend the timer interrupts and IRQF_FORCE_RESUME was already set.

IRQF_NO_SUSPEND is a component of IRQF_TIMER.

So it is. How about this instead?

The change makes sense so

but I am curious whether you actually were able to prove that it in fact fixes the hang (the description doesn't make it clear).

-boris

Quoted 36 lines

8<----------------------------
x86/xen: resume timer irqs early

If the timer irqs are resumed during device resume it is possible in certain circumstances for the resume to hang early on, before device interrupts are resumed.

It is not entirely clear what is occuring the point of the hang but I think a task necessary for the resume calls schedule_timeout(), waiting for a timer interrupt (which never arrives). This failure may require specific tasks to be running on the other VCPUs to trigger (processes are not frozen during a suspend/resume if PREEMPT is disabled).

Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in syscore_resume().

---
  arch/x86/xen/time.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/xen/time.c +1 -1
index 7b78f88..5718b0b 100644
@@ -444,7 +444,7 @@ void xen_setup_timer(int cpu)
 
  	irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
  				      IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER|
-				      IRQF_FORCE_RESUME,
+				      IRQF_FORCE_RESUME|IRQF_EARLY_RESUME,
  				      name, NULL);
  	(void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX);
 
#4 lore raw
Quoted 21 lines · Boris Ostrovsky
Quoted 20 lines · David Vrabel
Quoted 19 lines · Boris Ostrovsky
Quoted 11 lines · David Vrabel

If the timer irqs are resumed during device resume it is possible in certain circumstances for the resume to hang early on, before device interrupts are resumed.

It is not entirely clear what is occuring the point of the hang but I think a task necessary for the resume calls schedule_timeout(), waiting for a timer interrupt (which never arrives). This failure may require specific tasks to be running on the other VCPUs to trigger (processes are not frozen during a suspend/resume if PREEMPT is disabled).

Quoted 5 lines

Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in syscore_resume().

Also add IRQF_NO_SUSPEND as it is not necessary to suspend the timer interrupts and IRQF_FORCE_RESUME was already set.

IRQF_NO_SUSPEND is a component of IRQF_TIMER.

Quoted 8 lines
Quoted 1 line

So it is. How about this instead?

The change makes sense so

but I am curious whether you actually were able to prove that it in fact fixes the hang (the description doesn't make it clear).

Without the patch repeatedly migrating a VM would hang during resume after < 500 iterations. With the patch the VM was migrated > 8000 times without a problem.

David

#5 lore raw
Quoted 26 lines · David Vrabel
Quoted 25 lines · Boris Ostrovsky
Quoted 13 lines · David Vrabel
Quoted 12 lines · Boris Ostrovsky
Quoted 11 lines · David Vrabel

If the timer irqs are resumed during device resume it is possible in certain circumstances for the resume to hang early on, before device interrupts are resumed.

It is not entirely clear what is occuring the point of the hang but I think a task necessary for the resume calls schedule_timeout(), waiting for a timer interrupt (which never arrives). This failure may require specific tasks to be running on the other VCPUs to trigger (processes are not frozen during a suspend/resume if PREEMPT is disabled).

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in syscore_resume().

Also add IRQF_NO_SUSPEND as it is not necessary to suspend the timer interrupts and IRQF_FORCE_RESUME was already set.

IRQF_NO_SUSPEND is a component of IRQF_TIMER.

So it is. How about this instead?

The change makes sense so

Quoted 8 lines
Quoted 4 lines

but I am curious whether you actually were able to prove that it in fact fixes the hang (the description doesn't make it clear).

Without the patch repeatedly migrating a VM would hang during resume after < 500 iterations. With the patch the VM was migrated > 8000 times without a problem.

Ah, should said patch have a Reported-by too then?

It would also be neat to have that in the description of the patch I think.

Quoted 3 lines

David

#6 lore raw
Quoted 29 lines · Konrad Rzeszutek Wilk
Quoted 28 lines · David Vrabel
Quoted 27 lines · Boris Ostrovsky
Quoted 13 lines · David Vrabel
Quoted 12 lines · Boris Ostrovsky
Quoted 11 lines · David Vrabel

If the timer irqs are resumed during device resume it is possible in certain circumstances for the resume to hang early on, before device interrupts are resumed.

It is not entirely clear what is occuring the point of the hang but I think a task necessary for the resume calls schedule_timeout(), waiting for a timer interrupt (which never arrives). This failure may require specific tasks to be running on the other VCPUs to trigger (processes are not frozen during a suspend/resume if PREEMPT is disabled).

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in syscore_resume().

Also add IRQF_NO_SUSPEND as it is not necessary to suspend the timer interrupts and IRQF_FORCE_RESUME was already set.

IRQF_NO_SUSPEND is a component of IRQF_TIMER.

So it is. How about this instead?

The change makes sense so

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

but I am curious whether you actually were able to prove that it in fact fixes the hang (the description doesn't make it clear).

Without the patch repeatedly migrating a VM would hang during resume after < 500 iterations. With the patch the VM was migrated > 8000 times without a problem.

Ah, should said patch have a Reported-by too then?

I don't think the XenServer automated test system really minds.

Quoted 1 line

It would also be neat to have that in the description of the patch I think.

I'm not really keen on system-specific numbers like this, but it would probably be useful in this case since my analysis is so woolly.

David