From: Jim Houston <jim.houston@comcast.net>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: x86_64 timekeeping buglets
Date: Wed, 21 Dec 2005 17:02:41 -0500 [thread overview]
Message-ID: <1135202561.24884.12.camel@x2.site> (raw)
Hi Andi,
I recently bought a AMD64 X2 box and I have been playing with
the timekeeping code. I ran into the problem of unsynchronized
TSCs and decided to put some tracing into the timer_interrupt.
I got a couple interesting results.
Consider the following block of code. I assume that Jan Beulich's
new inline assembler version is still implements this algorithm.
vxtime.last_tsc = tsc - vxtime.quot * delay / vxtime.tsc_quot;
if ((((tsc - vxtime.last_tsc) * vxtime.tsc_quot) >> 32) < offset)
vxtime.last_tsc = tsc - (((long) offset << 32) / vxtime.tsc_quot) - 1;
The first line is correct. It sets the last_tsc value to a reasonable
estimate of when the PIT timer fired.
If we ignore the scaling the next couple lines are roughly:
if (delay < offset)
last_tsc = tsc - offset - 1;
Now assume that the offset value is just slightly larger than the
delay (again assume these values were converted to a common unit).
The last_tsc value will be set to a value which will result in
a slightly larger offset on the next tick. This repeats until
the offset accumulates a value large enough to trigger the
lost tick check. In my case even after the offset overflows the
the remainder was still greater than the delay and the process
continued. I'm curious if you know what this code was trying
to achieve?
I also notice on a 2.6.13 vintage kernel that the PM timer was
detected and the vxtime.quot value was set appropriately for the
PM timer but the kernel decided to use the PIT/TSC timekeeping.
I have not checked to see if this still happens with more
recent kernels.
Jim Houston - Concurrent Computer Corp.
reply other threads:[~2005-12-21 22:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1135202561.24884.12.camel@x2.site \
--to=jim.houston@comcast.net \
--cc=ak@suse.de \
--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
all inboxes | Powered by JetHome®