Skip to content

genirq: Prevent migration live lock in handle_edge_irq()

Thomas Gleixner lkml 1 version Applied

Status from this message: The following commit has been merged into the irq/core branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 5 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/4genirq: Remove pointless local variablekernel/irq/chip.c+1 -30 replies
2/4genirq: Move irq_wait_for_poll() to call sitekernel/irq/chip.c kernel/irq/internals.h kernel/irq/spurious.c+23 -453 replies
3/4genirq: Split up irq_pm_check_wakeup()kernel/irq/chip.c kernel/irq/internals.h kernel/irq/pm.c+11 -130 replies
4/4genirq: Prevent migration live lock in handle_edge_irq()kernel/irq/chip.c+39 -21 reply

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchLiangyanJiri Slaby
SeriesT-b
1/4
2/4R-b
3/4
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch 0/4] genirq: Prevent migration live lock in handle_edge_irq()

Yicon reported and Liangyan debugged a live lock in handle_edge_irq() related to interrupt migration.

If the interrupt affinity is moved to a new target CPU and the interrupt is currently handled on the previous target CPU for edge type interrupts the handler might get stuck on the previous target:

CPU 0 (previous target) CPU 1 (new target)

handle_edge_irq()
repeat:

	handle_event()		handle_edge_irq()
			        if (INPROGESS) {
				  set(PENDING);
				  mask();
				  return;
				}
	if (PENDING) {
	  clear(PENDING);
	  unmask();
	  goto repeat;
	}

The migration in software never completes and CPU0 continues to handle the pending events forever. This happens when the device raises interrupts with a high rate and always before handle_event() completes and before the CPU0 handler can clear INPROGRESS so that CPU1 sets the PENDING flag over and over. This has been observed in virtual machines.

The following series is addressing this by making the new target CPU wait for the handler to complete on CPU1 and thereby completing the software migration.

A draft combo patch of this has been tested by Liangyan:

https://lore.kernel.org/all/87o6u0rpaa.ffs@tglx

The series splits up the draft patch and has proper changelogs.

Thanks,

tglx

---
 chip.c      |   68 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------
 internals.h |    6 ++---
 pm.c        |   16 +++++---------
 spurious.c  |   37 --------------------------------
 4 files changed, 69 insertions(+), 58 deletions(-)