Skip to contentSkip to conversation

powerpc/64: Fix latency tracing for lazy irq replay

PATCH Applied Nicholas Piggin 2 participants 2 messages Oct 21, 2017 – Nov 7, 2017 PowerPC

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

PATCH 1/1 powerpc/64: Fix latency tracing for lazy irq replay

When returning from an exception to a soft-enabled context, pending IRQs are replayed but IRQ tracing is not reset, so a number of them can get chained together into the same IRQ-disabled trace.

Fix this by having __check_irq_replay re-set IRQ trace. This is conceptually where we respond to the next interrupt, so it fits the semantics of the IRQ tracer.

---
 arch/powerpc/kernel/irq.c | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/powerpc/kernel/irq.c +9 -0
index efbadcbbf694..df18085de8c4 100644
@@ -138,6 +138,13 @@ notrace unsigned int __check_irq_replay(void)
 	 */
 	unsigned char happened = local_paca->irq_happened;
 
+	/*
+	 * We are responding to the next interrupt, so interrupt-off
+	 * latencies should be reset here.
+	 */
+	trace_hardirqs_on();
+	trace_hardirqs_off();
+
 	if (happened & PACA_IRQ_HARD_DIS) {
 		/* Clear bit 0 which we wouldn't clear otherwise */
 		local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS;
@@ -292,6 +299,7 @@ notrace void arch_local_irq_restore(unsigned long en)
 #endif /* CONFIG_TRACE_IRQFLAGS */
 
 	soft_disable_set(IRQS_DISABLED);
+	trace_hardirqs_off();
 
 	/*
 	 * Check if anything needs to be re-emitted. We haven't
@@ -301,6 +309,7 @@ notrace void arch_local_irq_restore(unsigned long en)
 	replay = __check_irq_replay();
 
 	/* We can soft-enable now */
+	trace_hardirqs_on();
 	soft_disable_set(IRQS_ENABLED);
 
 	/*
Signature · 1 line
2.13.3
#1 lore raw
Quoted 9 lines · Nicholas Piggin

When returning from an exception to a soft-enabled context, pending IRQs are replayed but IRQ tracing is not reset, so a number of them can get chained together into the same IRQ-disabled trace.

Fix this by having __check_irq_replay re-set IRQ trace. This is conceptually where we respond to the next interrupt, so it fits the semantics of the IRQ tracer.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/ff967900c9d4740f6337c6456f1111

cheers