[PATCH] 2.4.0-testX and system utilization 99%

From: Petr Vandrovec (vandrove@vc.cvut.cz)
Date: Sun Aug 27 2000 - 18:15:14 EST


Hi Ingo,
  few weeks ago I reported here that SMP kernel running on UP ia32 machine
says that there is zero idle and all idle time is accounted as system.

  Because of 2.4.0-test7 still exihibits this behavior, I cooked up this
patch. Problem is, that with dummy APIC emulation, there is irq_enter()
called twice before update_process_times() is reached - once when
IRQ came from timer, and second time inside smp_local_timer_interrupt()...

  I fixed problem by adding 'from_apic' argument to smp_local_timer_interrupt.
When this function is invoked from APIC irq, it pass 1 and so irq_enter
is called. If it is invoked from timer IRQ, no irq_enter is called, and
so local_irq_count() still returns <= 1 and time is then correctly accounted
to idle instead of system...

  Also, what's idea behind having 'extern void ...' in header file
and 'inline void' in apic.c? Fortunately, they do not glue together
to 'extern inline void ...', making reference from time.c impossible ;-)

  If you think that it is correct solution, either forward it to Linus
or tell me and I'll forward it.
                                Thanks,
                                        Petr Vandrovec
                                        vandrove@vc.cvut.cz

diff -urdN linux/arch/i386/kernel/apic.c linux/arch/i386/kernel/apic.c
--- linux/arch/i386/kernel/apic.c Fri Aug 25 01:47:03 2000
+++ linux/arch/i386/kernel/apic.c Mon Aug 28 00:49:30 2000
@@ -641,7 +641,7 @@
  * value into /proc/profile.
  */
 
-inline void smp_local_timer_interrupt(struct pt_regs * regs)
+inline void smp_local_timer_interrupt(struct pt_regs * regs, int from_apic)
 {
         int user = user_mode(regs);
         int cpu = smp_processor_id();
@@ -676,9 +676,11 @@
                  * Besides, if we don't timer interrupts ignore the global
                  * interrupt lock, which is the WrongThing (tm) to do.
                  */
- irq_enter(cpu, 0);
+ if (from_apic)
+ irq_enter(cpu, 0);
                 update_process_times(user);
- irq_exit(cpu, 0);
+ if (from_apic)
+ irq_exit(cpu, 0);
 #endif
         }
 
@@ -716,7 +718,7 @@
          * because timer handling can be slow.
          */
         ack_APIC_irq();
- smp_local_timer_interrupt(regs);
+ smp_local_timer_interrupt(regs, 1);
 }
 
 /*
diff -urdN linux/arch/i386/kernel/time.c linux/arch/i386/kernel/time.c
--- linux/arch/i386/kernel/time.c Mon Jul 10 23:33:03 2000
+++ linux/arch/i386/kernel/time.c Mon Aug 28 00:49:42 2000
@@ -414,7 +414,7 @@
                 x86_do_profile(regs->eip);
 #else
         if (!smp_found_config)
- smp_local_timer_interrupt(regs);
+ smp_local_timer_interrupt(regs, 0);
 #endif
 
         /*
diff -urdN linux/include/asm-i386/apic.h linux/include/asm-i386/apic.h
--- linux/include/asm-i386/apic.h Fri Aug 25 01:47:52 2000
+++ linux/include/asm-i386/apic.h Mon Aug 28 00:48:26 2000
@@ -73,7 +73,7 @@
 extern void sync_Arb_IDs(void);
 extern void setup_local_APIC (void);
 extern void init_apic_mappings(void);
-extern void smp_local_timer_interrupt(struct pt_regs * regs);
+extern void smp_local_timer_interrupt(struct pt_regs * regs, int from_apic);
 extern void setup_APIC_clocks(void);
 #endif
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:19 EST