[PATCH] Timer interrupt cleanups [3/3] - normalise calls

From: Martin J. Bligh (mbligh@aracnet.com)
Date: Sun Jan 05 2003 - 21:35:22 EST


This patch moves x86_do_profile and update_process_times into
do_local_timer for all systems.

It also makes do_global_timer_interrupt call do_local_timer on systems
without the local apic timer (local apic timer simulation)

--------------------

Assuming we're SMP with a local apic timer all firing away:

global_timer_interrupt
        do_global_timer_interrupt
                {ack the interrupt}
                do_global_timer_interrupt_hook
                        do_global_timer
                                jiffies_64++;
                                update_times
                {update CMOS clock} (In the interrupt still ??!!)

local_apic_timer_interrupt
        do_local_apic_timer_interrupt
                {ack the interrupt}
                do_local_timer
                        x86_do_profile
                        update_process_times

--------------------

On UP with local apic timer:

global_timer_interrupt
        do_global_timer_interrupt
                {ack the interrupt}
                do_global_timer_interrupt_hook
                        do_global_timer
                                jiffies_64++;
                                update_times
                {update CMOS clock} (In the interrupt still ??!!)

local_apic_timer_interrupt
        do_local_apic_timer_interrupt
                {ack the interrupt}
                do_local_timer
                        x86_do_profile
                        update_process_times

--------------------

On a UP 386 with stale crusty breadcrumbs, and no local timer:
        
global_timer_interrupt
        do_global_timer_interrupt
                {ack the interrupt}
                do_global_timer_interrupt_hook
                        do_global_timer
                                jiffies_64++;
                                update_times
                        do_local_timer
                                x86_do_profile
                                update_process_times
                {update CMOS clock} (In the interrupt still ??!!)

--------------------
diff -urpN -X /home/fletch/.diff.exclude
02-rename_local_timer/arch/i386/kernel/apic.c
03-normalise_placement/arch/i386/kernel/apic.c
--- 02-rename_local_timer/arch/i386/kernel/apic.c Sun Jan 5 10:53:14 2003
+++ 03-normalise_placement/arch/i386/kernel/apic.c Sun Jan 5 10:56:31 2003
@@ -1012,11 +1012,18 @@ inline void do_local_timer(struct pt_reg
                         prof_old_multiplier[cpu] = prof_counter[cpu];
                 }

+ /*
+ * This is a bit of a mess ... not sure if we use multipliers
+ * on SMP ... the old code didn't. Someone who understands
+ * this better should clean up the #ifdef's below - mbligh
+ */
 #ifdef CONFIG_SMP
                 update_process_times(user_mode(regs));
 #endif
         }
-
+#ifndef CONFIG_SMP
+ update_process_times(user_mode(regs));
+#endif
         /*
          * We take the 'long' return path, and there every subsystem
          * grabs the apropriate locks (kernel lock/ irq lock).
diff -urpN -X /home/fletch/.diff.exclude
02-rename_local_timer/include/asm-i386/mach-default/do_timer.h
03-normalise_placement/include/asm-i386/mach-default/do_timer.h
--- 02-rename_local_timer/include/asm-i386/mach-default/do_timer.h Sun Jan
5 10:51:02 2003
+++ 03-normalise_placement/include/asm-i386/mach-default/do_timer.h Sun Jan
5 10:56:31 2003
@@ -16,17 +16,9 @@
 static inline void do_global_timer_interrupt_hook(struct pt_regs *regs)
 {
         do_global_timer(regs);
-/*
- * In the SMP case we use the local APIC timer interrupt to do the
- * profiling, except when we simulate SMP mode on a uniprocessor
- * system, in that case we have to call the local interrupt handler.
- */
-#ifndef CONFIG_X86_LOCAL_APIC
- x86_do_profile(regs);
-#else
+
         if (!using_apic_timer)
                 do_local_timer(regs);
-#endif
 }

diff -urpN -X /home/fletch/.diff.exclude
02-rename_local_timer/include/asm-i386/mach-visws/do_timer.h
03-normalise_placement/include/asm-i386/mach-visws/do_timer.h
--- 02-rename_local_timer/include/asm-i386/mach-visws/do_timer.h Sun Jan 5
10:51:02 2003
+++ 03-normalise_placement/include/asm-i386/mach-visws/do_timer.h Sun Jan
5 10:56:31 2003
@@ -9,17 +9,9 @@ static inline void do_global_timer_inter
         co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR);

         do_global_timer(regs);
-/*
- * In the SMP case we use the local APIC timer interrupt to do the
- * profiling, except when we simulate SMP mode on a uniprocessor
- * system, in that case we have to call the local interrupt handler.
- */
-#ifndef CONFIG_X86_LOCAL_APIC
- x86_do_profile(regs);
-#else
+
         if (!using_apic_timer)
                 do_local_timer(regs);
-#endif
 }

 static inline int do_timer_overflow(int count)
diff -urpN -X /home/fletch/.diff.exclude
02-rename_local_timer/kernel/timer.c 03-normalise_placement/kernel/timer.c
--- 02-rename_local_timer/kernel/timer.c Sat Jan 4 20:08:46 2003
+++ 03-normalise_placement/kernel/timer.c Sun Jan 5 10:56:31 2003
@@ -806,11 +806,6 @@ static inline void update_times(void)
 void do_global_timer(struct pt_regs *regs)
 {
         jiffies_64++;
-#ifndef CONFIG_SMP
- /* SMP process accounting uses the local APIC timer */
-
- update_process_times(user_mode(regs));
-#endif
         update_times();
 }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jan 07 2003 - 22:00:30 EST