Re: [patch] recover losed timer interrupt using the TSC [Re: [patch]

Andrea Arcangeli (andrea@e-mind.com)
Sun, 14 Mar 1999 19:20:01 +0100 (CET)


On Sun, 14 Mar 1999, Andrea Arcangeli wrote:

>>+ if (delta_high || (delta_low > cpu_hz/HZ*3/2))
>>+ printk("bug: %08x%08x cycles timer IRQ delay from %p\n",
>>+ delta_high, delta_low, (void *)regs->eip);
>
>Agreed, printing regs->eip is a good idea. I'll do that here too.

While the idea was looking cool I tried it and it's not working so well:

recover_lost_timer: lost 497 ticks c0107298 from
recover_lost_timer: lost 497 ticks c0107298 from
recover_lost_timer: lost 497 ticks c0107298 from
recover_lost_timer: lost 497 ticks c0107298 from
recover_lost_timer: lost 496 ticks c0107298 from
recover_lost_timer: lost 496 ticks c0107298 from
recover_lost_timer: lost 497 ticks c0107298 from
recover_lost_timer: lost 9 ticks c0107298 from
recover_lost_timer: lost 9 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c8018077 from
^^^^^^^^
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c8018077 from
^^^^^^^^
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from
recover_lost_timer: lost 1 ticks c0107298 from

It catched the malicious module only two times...

But OK, better than nothing. So here a patch against my last
timer-2.2.3-B:

Index: time.c
===================================================================
RCS file: /var/cvs/linux/arch/i386/kernel/time.c,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 time.c
--- time.c 1999/03/14 17:58:06 1.1.2.9
+++ linux/arch/i386/kernel/time.c 1999/03/14 18:18:08
@@ -421,7 +421,7 @@
* from lost timer interrupts. -arca
*/
static inline void recover_lost_timer(unsigned long delta_cycles,
- int delay_usec)
+ int delay_usec, struct pt_regs *regs)
{
/*
* The algorithm I invented to know if we losed an irq in the meantime
@@ -446,7 +446,8 @@
return;

delta_usec -= 1;
- printk(KERN_NOTICE "recover_lost_timer: lost %lu ticks\n", delta_usec);
+ printk(KERN_NOTICE "recover_lost_timer: lost %lu ticks from %08lx\n",
+ delta_usec, regs->eip);
lost_ticks += delta_usec;
jiffies += delta_usec;
}
@@ -497,7 +498,8 @@
delay_at_last_interrupt = (count + LATCH/2) / LATCH;

recover_lost_timer(last_tsc_low - old_cycles,
- delay_at_last_interrupt - old_delay);
+ delay_at_last_interrupt - old_delay,
+ regs);
}

do_timer_interrupt(irq, NULL, regs);

Andrea Arcangeli

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