[PATCH 7/8] ipipe: Call present ack and end handlers for timer irq unconditionally

Jan Kiszka jan.kiszka at siemens.com
Wed Mar 27 14:18:06 CET 2019


From: Jan Kiszka <jan.kiszka at siemens.com>

These steps must be done unconditionally, because if
__ipipe_ack_hrtimer_irq() is called, the tick event will be delivered to
the head domain next, which will neither call ipipe_end() for a tick
event, nor propagate such event to the root stage (at least not using
the same IRQ line).

This plugs a race for timers that are per-CPU but share the same
interrupt number. When setting them up, there is a window where the
first CPU already called ipipe_request_irq, but some other CPU did not
yet ran through grab_timer, thus have ipipe_stolen = 0.

It also solves boot issues with the TSC deadline timer in use.

Based on reasoning provided by Philippe Gerum.

Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
---
 kernel/ipipe/timer.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/kernel/ipipe/timer.c b/kernel/ipipe/timer.c
index 5532be93e951..1471a4ed85ea 100644
--- a/kernel/ipipe/timer.c
+++ b/kernel/ipipe/timer.c
@@ -367,15 +367,18 @@ static void __ipipe_ack_hrtimer_irq(struct irq_desc *desc)
 {
 	struct ipipe_timer *timer = __ipipe_raw_cpu_read(percpu_timer);
 
+	/*
+	 * Pseudo-IRQs like pipelined IPIs have no descriptor, we have
+	 * to check for this.
+	 */
 	if (desc)
 		desc->ipipe_ack(desc);
 
-	if (timer->host_timer->ipipe_stolen) {
-		if (timer->ack)
-			timer->ack();
-		if (desc)
-			desc->ipipe_end(desc);
-	}
+	if (timer->ack)
+		timer->ack();
+
+	if (desc)
+		desc->ipipe_end(desc);
 }
 
 static int do_set_oneshot(struct clock_event_device *cdev)
-- 
2.16.4




More information about the Xenomai mailing list