All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keir Fraser <keir@xen.org>
To: Mauro <mrsanna1@gmail.com>, Jan Beulich <JBeulich@suse.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	xen-devel@lists.xensource.com,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	Olivier Hanesse <olivier.hanesse@gmail.com>,
	Xen Users <xen-users@lists.xensource.com>,
	Mark Adams <mark@campbell-lange.net>
Subject: Re: [Xen-users] Re: Xen 4 TSC problems
Date: Wed, 17 Oct 2012 17:15:40 +0100	[thread overview]
Message-ID: <CCA4983E.4FEA0%keir@xen.org> (raw)
In-Reply-To: <CAE17a0Xtp3BzwSL6V5TAKPdPeavEZ1JgqPR-SsjzBvFD=SBbNg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1559 bytes --]

On 15/10/2012 15:25, "Mauro" <mrsanna1@gmail.com> wrote:

> On 15 October 2012 14:49, Jan Beulich <JBeulich@suse.com> wrote:
>>>>> On 15.10.12 at 13:24, Mauro <mrsanna1@gmail.com> wrote:
>>> I have the problem on this hardware type:
>>> 
>>> Hp Proliant DL580 G5 with four Intel(R) Xeon(R) CPU E7330  @ 2.40GHz.
>>> It seem that
>>> GRUB_CMDLINE_XEN="clocksource=pit cpuidle=0"
>>> put in in /etc/default/grup (I use linux debian)
>>> solves the problem for me.
>> 
>> Did you check whether either or both options on their own also
>> make the problem go away?
> 
> Only clocksource=pit does not solve the problem, I've not tried with
> only cpuidle=0, I will try soon.

The problem here is that the platform timer has *not* wrapped. In fact it is
almost certainly correct, and it is the calculation of current-system-time
extrapolated from local CPU's TSC that has gone haywire. The
overflow-handling logic in plt_overflow() then propagates that incorrectness
into plt_stamp64 (up to a maximum of 10 times wrapping the platform timer's
counter). This means that platform time is incorrect (skips forward) and
soon after will infect the local time estimation for all CPUs.

I've attached a patch which will (a) stop plt_overflow() from misguidedly
trying to fix up apparent platform timer overflow; and (b) will print
possibly-useful diagnostics when apparent 'timer overflow' occurs. Such
lines will be prefixed "XXX plt_overflow:" in the hypervisor log. Patch is
against xen-unstable but I'm sure it must backport to older trees quite
trivially.

 -- Keir


[-- Attachment #2: 00-tsc-debug --]
[-- Type: application/octet-stream, Size: 1256 bytes --]

diff -r c1c549c4fe9e xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Mon Oct 15 16:51:44 2012 +0100
+++ b/xen/arch/x86/time.c	Wed Oct 17 17:13:22 2012 +0100
@@ -523,11 +523,12 @@ static s_time_t __read_platform_stime(u6
 static void plt_overflow(void *unused)
 {
     int i;
-    u64 count;
+    u64 count, old_stamp, tsc;
     s_time_t now, plt_now, plt_wrap;
 
     spin_lock_irq(&platform_timer_lock);
 
+    old_stamp = plt_stamp;
     count = plt_src.read_counter();
     plt_stamp64 += (count - plt_stamp) & plt_mask;
     plt_stamp = count;
@@ -540,6 +541,14 @@ static void plt_overflow(void *unused)
         plt_wrap = __read_platform_stime(plt_stamp64 + plt_mask + 1);
         if ( ABS(plt_wrap - now) > ABS(plt_now - now) )
             break;
+        rdtscll(tsc);
+        printk("XXX plt_overflow: plt_now=%"PRIx64" plt_wrap=%"PRIx64
+               " now=%"PRIx64" old_stamp=%"PRIx64" new_stamp=%"PRIx64
+               " plt_stamp64=%"PRIx64" plt_mask=%"PRIx64
+               " tsc=%"PRIx64" tsc_stamp=%"PRIx64"\n",
+               plt_now, plt_wrap, now, old_stamp, plt_stamp, plt_stamp64,
+               plt_mask, tsc, this_cpu(cpu_time).local_tsc_stamp);
+        break;
         plt_stamp64 += plt_mask + 1;
     }
     if ( i != 0 )

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2012-10-17 16:15 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-23 10:49 Xen 4 TSC problems Olivier Hanesse
2011-02-23 16:16 ` [Xen-devel] " Dan Magenheimer
2011-02-23 17:19   ` Keir Fraser
2011-02-23 19:04     ` Olivier Hanesse
2011-02-24  7:16       ` Keir Fraser
2011-02-24  9:59         ` Olivier Hanesse
2011-02-24 10:59           ` Jan Beulich
2011-02-24 11:30             ` [Xen-devel] " Keir Fraser
2011-02-24 11:57               ` Olivier Hanesse
2011-02-24 12:37                 ` Jan Beulich
2011-02-24 14:20                   ` Olivier Hanesse
2011-02-24 14:52                     ` [Xen-devel] " Keir Fraser
2011-02-24 17:43                       ` Dan Magenheimer
2011-02-24 17:58                         ` Olivier Hanesse
2011-02-24 19:01                         ` [Xen-devel] " Jeremy Fitzhardinge
2011-02-28 14:37                           ` Olivier Hanesse
2011-02-28 15:00                             ` Keir Fraser
2011-02-28 15:14                             ` [Xen-devel] " Dan Magenheimer
2011-02-28 15:23                               ` Olivier Hanesse
2011-02-28 15:30                                 ` Dan Magenheimer
2011-02-28 15:54                                   ` Olivier Hanesse
2011-04-15  7:51                                     ` andre.arnold
2011-04-15 16:31                                       ` Olivier Hanesse
2012-09-27 15:54                                     ` [Xen-devel] " Mauro
2012-09-27 19:27                                       ` [Xen-users] " Dan Magenheimer
2012-09-27 21:28                                         ` Olivier Hanesse
2012-09-27 21:42                                           ` [Xen-devel] " Mauro
2012-09-29  8:08                                             ` [Xen-users] " Olivier Hanesse
2012-09-29  9:41                                               ` [Xen-devel] " Mauro
2012-09-29 12:19                                                 ` Mauro
2012-09-30 15:13                                                   ` [Xen-users] " Pasi Kärkkäinen
2012-09-30 19:23                                                     ` [Xen-devel] " Mauro
2012-09-30 20:19                                                       ` Mauro
2012-10-15  7:39                                                         ` [Xen-users] " Olivier Hanesse
2012-10-15  8:05                                                           ` Philippe.Simonet
2012-10-15  9:39                                                             ` Mauro
2012-10-15 10:32                                                           ` Jan Beulich
2012-10-15 11:24                                                             ` [Xen-devel] " Mauro
2012-10-15 12:49                                                               ` [Xen-users] " Jan Beulich
2012-10-15 14:25                                                                 ` Mauro
2012-10-17 16:15                                                                   ` Keir Fraser [this message]
2012-10-18  7:40                                                                     ` Ian Campbell
2012-10-18  7:55                                                                       ` Keir Fraser
2012-10-18  8:33                                                                         ` Ian Campbell
2012-10-18  8:56                                                                           ` [Xen-devel] " Mauro
2012-10-18  9:36                                                                             ` [Xen-users] " Ian Campbell
2012-10-18 13:45                                                                       ` Philippe.Simonet
2012-10-18 16:43                                                                         ` Keir Fraser
2012-10-21 20:52                                                                 ` [Xen-devel] " Mauro
2012-10-22  6:54                                                                   ` [Xen-users] " Jan Beulich
2012-10-22  9:17                                                                     ` [Xen-devel] " Mauro
2012-10-22  9:27                                                                       ` [Xen-users] " Jan Beulich
2012-10-22 10:40                                                                         ` [Xen-devel] " Mauro
2012-10-22 12:06                                                                           ` [Xen-users] " Jan Beulich
2012-10-23  7:19                                                                             ` Mauro
     [not found]                                                                             ` <CAE17a0VU3H8UmUWZv1+t98ME8LFgCZAWWBC1nhzM=ecbu6_GaQ@mail.gmail.com>
2012-10-23  7:58                                                                               ` Jan Beulich
2012-10-23  8:40                                                                                 ` Mauro
2012-10-23  8:50                                                                                   ` Jan Beulich
2012-10-23 11:50                                                                                     ` Konrad Rzeszutek Wilk
2012-10-23 14:07                                                                                       ` Mauro
2012-10-23 14:43                                                                                         ` Jan Beulich
2012-10-23 14:46                                                                                           ` Mauro
2012-10-23 15:34                                                                                             ` Mauro
2012-10-23 15:49                                                                                               ` Jan Beulich
2012-10-01 11:39                                                       ` Zary Matej
2011-02-28 15:39                                 ` [Xen-devel] " Keir Fraser
2012-09-29 15:13         ` Mauro
2011-09-13  7:16 ` Philippe Simonet
2011-09-15  8:23   ` Konrad Rzeszutek Wilk
2011-09-15  8:24   ` Konrad Rzeszutek Wilk
2011-09-15 16:24     ` Jeremy Fitzhardinge
2011-09-16  6:03       ` Philippe.Simonet
2011-09-16 22:40         ` Jeremy Fitzhardinge
2011-09-19  5:45           ` Philippe Simonet
2011-09-15 10:36   ` George Dunlap
2011-09-15 18:38     ` Dan Magenheimer
2011-09-19 10:39       ` George Dunlap
2011-09-22 12:07         ` Jan Beulich
2011-09-30  6:33         ` Philippe.Simonet
2011-09-30  9:36           ` tommics
2011-09-30 17:16           ` Dan Magenheimer

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=CCA4983E.4FEA0%keir@xen.org \
    --to=keir@xen.org \
    --cc=JBeulich@suse.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=jeremy@goop.org \
    --cc=mark@campbell-lange.net \
    --cc=mrsanna1@gmail.com \
    --cc=olivier.hanesse@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=xen-users@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.