From: Keir Fraser <keir.fraser@eu.citrix.com>
To: Jan Beulich <JBeulich@novell.com>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: recurring boot time scalability issues affecting time management
Date: Tue, 11 May 2010 08:57:55 +0100 [thread overview]
Message-ID: <C80ECC95.13E6E%keir.fraser@eu.citrix.com> (raw)
In-Reply-To: <4BE91C62020000780000238B@vpn.id2.novell.com>
[-- Attachment #1: Type: text/plain, Size: 609 bytes --]
On 11/05/2010 07:59, "Jan Beulich" <JBeulich@novell.com> wrote:
> I wonder whether the time handling code in Xen itself shouldn't/can't
> therefore be made more robust, or at least reliably detect this sort of
> issue (from past analysis of similar problems, the platform timer is
> rolling over due to there not being frequent enough invocations of
> plt_overflow()) to make analysis of the problem easier.
Something like the attached?
-- Keir
> Jan
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
[-- Attachment #2: 00-plt-ovf --]
[-- Type: application/octet-stream, Size: 1905 bytes --]
diff -r 4ede18e45935 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c Tue May 11 08:39:01 2010 +0100
+++ b/xen/arch/x86/time.c Tue May 11 08:56:56 2010 +0100
@@ -571,19 +571,6 @@
static u64 plt_stamp; /* hardware-width platform counter stamp */
static struct timer plt_overflow_timer;
-static void plt_overflow(void *unused)
-{
- u64 count;
-
- spin_lock_irq(&platform_timer_lock);
- count = plt_src.read_counter();
- plt_stamp64 += (count - plt_stamp) & plt_mask;
- plt_stamp = count;
- spin_unlock_irq(&platform_timer_lock);
-
- set_timer(&plt_overflow_timer, NOW() + plt_overflow_period);
-}
-
static s_time_t __read_platform_stime(u64 platform_time)
{
u64 diff = platform_time - platform_timer_stamp;
@@ -591,6 +578,41 @@
return (stime_platform_stamp + scale_delta(diff, &plt_scale));
}
+static void plt_overflow(void *unused)
+{
+ int i;
+ u64 count;
+ s_time_t now, plt_now, plt_wrap;
+
+ spin_lock_irq(&platform_timer_lock);
+
+ count = plt_src.read_counter();
+ plt_stamp64 += (count - plt_stamp) & plt_mask;
+ plt_stamp = count;
+
+ now = NOW();
+ plt_wrap = __read_platform_stime(plt_stamp64);
+ for ( i = 0; i < 10; i++ )
+ {
+ plt_now = plt_wrap;
+ plt_wrap = __read_platform_stime(plt_stamp64 + plt_mask + 1);
+ if ( __builtin_abs(plt_wrap - now) > __builtin_abs(plt_now - now) )
+ break;
+ plt_stamp64 += plt_mask + 1;
+ }
+ if ( i != 0 )
+ {
+ static bool_t warned_once;
+ if ( !test_and_set_bool(warned_once) )
+ printk("Platform timer appears to have unexpectedly wrapped "
+ "%u%s times.\n", i, (i == 10) ? " or more" : "");
+ }
+
+ spin_unlock_irq(&platform_timer_lock);
+
+ set_timer(&plt_overflow_timer, NOW() + plt_overflow_period);
+}
+
static s_time_t read_platform_stime(void)
{
u64 count;
[-- 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:[~2010-05-11 7:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-11 6:59 recurring boot time scalability issues affecting time management Jan Beulich
2010-05-11 7:57 ` Keir Fraser [this message]
2010-05-11 8:51 ` Jan Beulich
2010-05-11 10:22 ` 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=C80ECC95.13E6E%keir.fraser@eu.citrix.com \
--to=keir.fraser@eu.citrix.com \
--cc=JBeulich@novell.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).