From: Bill Burns <bburns@redhat.com>
To: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: Ian Pratt <Ian.Pratt@eu.citrix.com>,
xen-devel@lists.xensource.com, "Carb,
Brian A" <Brian.Carb@unisys.com>
Subject: Re: Large system boot problems
Date: Tue, 12 Feb 2008 11:34:37 -0500 [thread overview]
Message-ID: <47B1CA9D.4000006@redhat.com> (raw)
In-Reply-To: <C3D229A9.1C271%Keir.Fraser@cl.cam.ac.uk>
[-- Attachment #1: Type: text/plain, Size: 2752 bytes --]
Keir Fraser wrote:
> On 8/2/08 15:22, "Bill Burns" <bburns@redhat.com> wrote:
>
>>> But ultimately the calibration code should be robust to long delays before
>>> it is executed. It shouldn't go haywire. So something is bad there. Do you
>>> have a dump of the decision made by the calibration code on cpu0 the very
>>> first time it actually gets invoked? We probably need to trace the hell out
>>> of that first invocation to work out why it gets things so badly wrong.
>> I don't have more than in the earlier email where is shows the
>> large delta in tsc time, which seems to cause the bogus result.
>
> Okay, well looking at the inputs on that first invocation -- master_stime
> and local_stime -- they are totally out of sync. One says that 9.3s has
> elapsed since init_xen_time() was invoked, the other says that 4.6s has
> elapsed (curiously exactly half the time). The former is correct if the CPU
> really is a 3.4GHz part and is running at full speed for the duration. But
> you ought to be able to work out which is the correct ballpark by timing
> with a stopwatch the time between init_xen_time() and that first invocation
> on cpu0 of local_time_calibration() (you'll have to printk() when
> init_xen_time() is executed).
>
> -- Keir
>
>
Well, I have a proposed fix that fixes the major symptom
of dom0 reporting time going backwards and failing it initialize
properly. I must note that dom0 still reports the wrong speed for
CPU0 when only one iteration of local_time_calibration occurs
before dom0 gets going. I believe that second issue is probably
due to the large delta between the master and local stime.
The first call to local_time_calibration automatically fixes
local stime being behind.
But when a significant amount of time has elapsed before the
initial call to local_time_calibration the code that deals with
the local stime and tsc deltas is broken. When the 64 bit deltas
for local stime is manipulated down to a 32 bit value the
tsc delta is also adjusted, but the tsc_shift value is
not maintained.
There are two loops. The first shifts both the stime and
tsc vaules in sync but fails to record the tsc shift:
while ( ((u32)stime_elapsed64 != stime_elapsed64) ||
((s32)stime_elapsed64 < 0) )
{
stime_elapsed64 >>= 1;
tsc_elapsed64 >>= 1;
++ tsc_shift--;
}
The second does the tsc shift alone, which is fine, but note
that it does record the tsc shift.
/* tsc_elapsed <= 2*stime_elapsed */
while ( tsc_elapsed64 > (stime_elapsed32 * 2) )
{
tsc_elapsed64 >>= 1;
tsc_shift--;
}
Making this one line change, as in the attached patch
yields a properly working dom0. Tested on both a small
memory and large memory system.
Bill
[-- Attachment #2: fix-tsc-shift.patch --]
[-- Type: text/x-patch, Size: 336 bytes --]
--- arch/x86/time.c.orig 2008-02-12 07:16:48.000000000 -0500
+++ arch/x86/time.c 2008-02-12 11:19:47.000000000 -0500
@@ -857,6 +857,7 @@ static void local_time_calibration(void
{
stime_elapsed64 >>= 1;
tsc_elapsed64 >>= 1;
+ tsc_shift--;
}
/* stime_master_diff now fits in a 32-bit word. */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2008-02-12 16:34 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-10 2:15 Test results on Unisys ES7000 64x 256gb using unstable c/s 16693 on 3.2.0 Release Candidate Carb, Brian A
2008-01-15 13:50 ` Bill Burns
2008-01-15 14:44 ` Keir Fraser
2008-01-15 16:15 ` Bill Burns
2008-01-15 16:29 ` Keir Fraser
2008-01-16 15:45 ` Bill Burns
2008-01-17 14:10 ` Test results on Unisys ES7000 64x 256gb using unstablec/s " Ian Pratt
2008-01-18 13:03 ` Bill Burns
2008-01-24 17:23 ` Bill Burns
2008-01-25 13:06 ` Bill Burns
2008-01-28 14:02 ` Bill Burns
2008-01-28 14:08 ` Keir Fraser
2008-01-28 20:38 ` Test results on Unisys ES7000 64x 256gb usingunstablec/s " Carb, Brian A
2008-01-28 21:12 ` Bill Burns
2008-01-29 8:44 ` Test results on Unisys ES7000 64x 256gbusingunstablec/s " Jan Beulich
2008-01-30 16:20 ` Test results on Unisys ES7000 64x 256gb using unstablec/s " Bill Burns
2008-01-30 16:45 ` Keir Fraser
2008-01-31 18:12 ` Bill Burns
2008-02-01 8:36 ` Keir Fraser
2008-02-01 12:40 ` Bill Burns
2008-02-01 20:10 ` Bill Burns
2008-02-08 13:49 ` Large system boot problems Bill Burns
2008-02-08 14:04 ` Keir Fraser
2008-02-08 15:10 ` Bill Burns
2008-02-08 15:14 ` Keir Fraser
2008-02-08 15:22 ` Bill Burns
2008-02-08 15:45 ` Keir Fraser
2008-02-12 16:34 ` Bill Burns [this message]
2008-02-12 16:54 ` Keir Fraser
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=47B1CA9D.4000006@redhat.com \
--to=bburns@redhat.com \
--cc=Brian.Carb@unisys.com \
--cc=Ian.Pratt@eu.citrix.com \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.