WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-4.0-testing] Add a safety valve to the HVM RTC mode

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] Add a safety valve to the HVM RTC model for big time jumps
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 04 Jun 2010 03:46:04 -0700
Delivery-date: Fri, 04 Jun 2010 03:51:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1275645028 -3600
# Node ID d988e6643b459098823b6312ae58d81cff43fc98
# Parent  96e0b0506051015770e946ad911a6d3ed12888ab
Add a safety valve to the HVM RTC model for big time jumps

If xen's time leaps forward by a large amount, the RTC will try to
model a tick for every second that it thinks has passed.  This can
livelock a CPU with a series of timer requests each of which fires
immediately and requests the next one.

This patch treats a delay of more than a day between ticks as a
special case, abandoning the attempt to catch up.  That should be good
enough to avoid livelock but doesn't fix the underlying time problem.

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
xen-unstable changeset:   21515:1b6c9732436b
xen-unstable date:        Fri Jun 04 10:05:42 2010 +0100
---
 xen/arch/x86/hvm/rtc.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff -r 96e0b0506051 -r d988e6643b45 xen/arch/x86/hvm/rtc.c
--- a/xen/arch/x86/hvm/rtc.c    Fri Jun 04 10:50:01 2010 +0100
+++ b/xen/arch/x86/hvm/rtc.c    Fri Jun 04 10:50:28 2010 +0100
@@ -281,8 +281,21 @@ static void rtc_update_second(void *opaq
 static void rtc_update_second(void *opaque)
 {
     RTCState *s = opaque;
-
-    spin_lock(&s->lock);
+    s_time_t now = NOW();
+
+    spin_lock(&s->lock);
+
+    /* If we somehow get way out of sync (say, Xen time leaps forward), 
+     * don't livelock the system trying to emulate every second.  Time 
+     * is already in bad trouble, so just skip forward rather than 
+     * trying to sync the RTC registers */
+    if ( unlikely(now - s->next_second_time > SECONDS(86400)) )
+    {
+        dprintk(XENLOG_WARNING, "HVM RTC: dom %u skipping %llu seconds\n",
+                vrtc_domain(s)->domain_id, 
+                (now - s->next_second_time) / SYSTEM_TIME_HZ);
+        s->next_second_time = now;
+    }
 
     /* if the oscillator is not in normal operation, we do not update */
     if ( (s->hw.cmos_data[RTC_REG_A] & RTC_DIV_CTL) != RTC_REF_CLCK_32KHZ )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.0-testing] Add a safety valve to the HVM RTC model for big time jumps, Xen patchbot-4.0-testing <=