From: Andrew Morton <akpm@digeo.com>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: john stultz <johnstul@us.ibm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] make lost-tick detection more informative
Date: Thu, 30 Jan 2003 13:14:17 -0800 [thread overview]
Message-ID: <3E3995A9.E44AD77A@digeo.com> (raw)
In-Reply-To: 3E39756F.6080400@us.ibm.com
Dave Hansen wrote:
>
> The new lost-tick detection code is pretty cool,
I've actually disabled it in -mmnext, because I get too
much mail already.
If you want to slap this on top of that and some new
kernel-hacking debug config option, that would be neat.
arch/i386/kernel/time.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+)
diff -puN arch/i386/kernel/time.c~lost-tick arch/i386/kernel/time.c
--- 25/arch/i386/kernel/time.c~lost-tick Wed Jan 29 14:12:23 2003
+++ 25-akpm/arch/i386/kernel/time.c Wed Jan 29 14:39:52 2003
@@ -266,6 +266,41 @@ static inline void do_timer_interrupt(in
}
/*
+ * Lost tick detection and compensation
+ */
+static inline void detect_lost_tick(void)
+{
+ /* read time since last interrupt */
+ unsigned long delta = timer->get_offset();
+ static unsigned long dbg_print;
+
+ /* check if delta is greater then two ticks */
+ if(delta >= 2*(1000000/HZ)){
+
+ /*
+ * only print debug info first 5 times
+ */
+ /*
+ * AKPM: disable this for now; it's nice, but irritating.
+ */
+ if (0 && dbg_print < 5) {
+ printk(KERN_WARNING "\nWarning! Detected %lu "
+ "micro-second gap between interrupts.\n",
+ delta);
+ printk(KERN_WARNING " Compensating for %lu lost "
+ "ticks.\n",
+ delta/(1000000/HZ)-1);
+ dump_stack();
+ dbg_print++;
+ }
+ /* calculate number of missed ticks */
+ delta = delta/(1000000/HZ)-1;
+ jiffies += delta;
+ }
+
+}
+
+/*
* This is the same as the above, except we _also_ save the current
* Time Stamp Counter value at the time of the timer interrupt, so that
* we later on can estimate the time of day more exactly.
@@ -281,6 +316,7 @@ void timer_interrupt(int irq, void *dev_
*/
write_lock(&xtime_lock);
+ detect_lost_tick();
timer->mark_offset();
do_timer_interrupt(irq, NULL, regs);
_
next prev parent reply other threads:[~2003-01-30 21:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-30 18:56 [PATCH] make lost-tick detection more informative Dave Hansen
2003-01-30 21:14 ` Andrew Morton [this message]
[not found] <3E39756F.6080400@us.ibm.com.suse.lists.linux.kernel>
[not found] ` <3E3995A9.E44AD77A@digeo.com.suse.lists.linux.kernel>
2003-01-30 21:22 ` Andi Kleen
-- strict thread matches above, loose matches on Subject: below --
2003-02-04 21:36 Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E3995A9.E44AD77A@digeo.com \
--to=akpm@digeo.com \
--cc=haveblue@us.ibm.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox