The existing algorithm to track the Linux tick IRQ breaks when other
clockevent drivers than PIT or LAPIC are involved (HPET...?). This patch
fixes the logic by pushing updates to the spot where they occur - into
the clockevent layer.

Jan
---
 arch/i386/kernel/ipipe.c  |   11 +----------
 include/asm-i386/ipipe.h  |   17 ++++++++++++++++-
 kernel/time/tick-common.c |    4 ++++
 3 files changed, 21 insertions(+), 11 deletions(-)

Index: linux-2.6.23.12-xeno/arch/i386/kernel/ipipe.c
===================================================================
--- linux-2.6.23.12-xeno.orig/arch/i386/kernel/ipipe.c
+++ linux-2.6.23.12-xeno/arch/i386/kernel/ipipe.c
@@ -50,9 +50,7 @@
 
 extern struct clock_event_device *global_clock_event;
 
-extern struct clock_event_device pit_clockevent;
-
-int __ipipe_tick_irq;
+int __ipipe_tick_irq = TIMER_IRQ;
 
 DEFINE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
 
@@ -220,13 +218,6 @@ void __init __ipipe_enable_pipeline(void
 			     IPIPE_STDROOT_MASK);
 #endif /* CONFIG_X86_MCE_P4THERMAL */
 
-	__ipipe_tick_irq = global_clock_event == &pit_clockevent ? 0
-		: ipipe_apic_vector_irq(LOCAL_TIMER_VECTOR);
-
-#else	/* !CONFIG_X86_LOCAL_APIC */
-
-	__ipipe_tick_irq = 0;
-
 #endif	/* CONFIG_X86_LOCAL_APIC */
 
 #ifdef CONFIG_SMP
Index: linux-2.6.23.12-xeno/include/asm-i386/ipipe.h
===================================================================
--- linux-2.6.23.12-xeno.orig/include/asm-i386/ipipe.h
+++ linux-2.6.23.12-xeno/include/asm-i386/ipipe.h
@@ -107,6 +107,20 @@ void __ipipe_do_critical_sync(unsigned i
 
 extern int __ipipe_tick_irq;
 
+#ifdef CONFIG_X86_LOCAL_APIC
+#define ipipe_update_tick_evtdev(evtdev)				\
+	do {								\
+		if (strcmp((evtdev)->name, "lapic") == 0)		\
+			__ipipe_tick_irq =				\
+				ipipe_apic_vector_irq(LOCAL_TIMER_VECTOR); \
+		else							\
+			__ipipe_tick_irq = TIMER_IRQ;			\
+	} while (0)
+#else
+#define ipipe_update_tick_evtdev(evtdev)				\
+	__ipipe_tick_irq = TIMER_IRQ
+#endif
+
 DECLARE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
 
 #define __ipipe_call_root_xirq_handler(ipd,irq) \
@@ -205,7 +219,8 @@ int __ipipe_check_tickdev(const char *de
 
 #else /* !CONFIG_IPIPE */
 
-#define task_hijacked(p)	0
+#define ipipe_update_tick_evtdev(evtdev)	do { } while (0)
+#define task_hijacked(p)			0
 
 #endif /* CONFIG_IPIPE */
 
Index: linux-2.6.23.12-xeno/kernel/time/tick-common.c
===================================================================
--- linux-2.6.23.12-xeno.orig/kernel/time/tick-common.c
+++ linux-2.6.23.12-xeno/kernel/time/tick-common.c
@@ -163,6 +163,10 @@ static void tick_setup_device(struct tic
 
 	td->evtdev = newdev;
 
+	/* I-pipe: derive global tick IRQ from CPU 0 */
+	if (cpu == 0)
+		ipipe_update_tick_evtdev(newdev);
+
 	/*
 	 * When the device is not per cpu, pin the interrupt to the
 	 * current cpu:

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main

Reply via email to