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] Ensure global variables required by get_s_time() are ini

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Ensure global variables required by get_s_time() are initialised before
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 29 Jun 2005 17:12:12 +0000
Cc: james@xxxxxxxxxxxxx
Delivery-date: Wed, 29 Jun 2005 18:02:36 +0000
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1770, 2005/06/29 18:12:12+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Ensure global variables required by get_s_time() are initialised before
        first use. Rejuggle bootstrap code slightly.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 nmi.c   |   16 +++++++++++++++-
 setup.c |   15 ++++++++++-----
 time.c  |   10 ++++++++--
 3 files changed, 33 insertions(+), 8 deletions(-)


diff -Nru a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
--- a/xen/arch/x86/nmi.c        2005-06-29 14:03:50 -04:00
+++ b/xen/arch/x86/nmi.c        2005-06-29 14:03:50 -04:00
@@ -240,7 +240,6 @@
     }
 
     init_ac_timer(&nmi_timer[cpu], nmi_timer_fn, NULL, cpu);
-    nmi_timer_fn(NULL);
 
     nmi_pm_init();
 }
@@ -257,18 +256,33 @@
 void watchdog_disable(void)
 {
     unsigned long flags;
+
     spin_lock_irqsave(&watchdog_lock, flags);
+
     if ( watchdog_disable_count++ == 0 )
         watchdog_on = 0;
+
     spin_unlock_irqrestore(&watchdog_lock, flags);
 }
 
 void watchdog_enable(void)
 {
+    unsigned int  cpu;
     unsigned long flags;
+
     spin_lock_irqsave(&watchdog_lock, flags);
+
     if ( --watchdog_disable_count == 0 )
+    {
         watchdog_on = 1;
+        /*
+         * Ensure periodic heartbeats are active. We cannot do this earlier
+         * during setup because the timer infrastructure is not available. 
+         */
+        for_each_online_cpu ( cpu )
+            set_ac_timer(&nmi_timer[cpu], NOW());
+    }
+
     spin_unlock_irqrestore(&watchdog_lock, flags);
 }
 
diff -Nru a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      2005-06-29 14:03:50 -04:00
+++ b/xen/arch/x86/setup.c      2005-06-29 14:03:50 -04:00
@@ -75,7 +75,7 @@
 extern void arch_init_memory(void);
 extern void init_IRQ(void);
 extern void trap_init(void);
-extern void time_init(void);
+extern void early_time_init(void);
 extern void ac_timer_init(void);
 extern void initialize_keytable(void);
 extern void early_cpu_init(void);
@@ -184,7 +184,7 @@
 
     ac_timer_init();
 
-    time_init();
+    early_time_init();
 
     arch_init_memory();
 
@@ -205,14 +205,19 @@
     for_each_cpu ( i )
         cpu_set(i, cpu_present_map);
 
-    /* Sanity: We ought to be taking interrupts by now. */
-    local_irq_enable();
+    /*
+     * Initialise higher-level timer functions. We do this fairly late
+     * (post-SMP) because the time bases and scale factors need to be updated 
+     * regularly, and SMP initialisation can cause a long delay with 
+     * interrupts not yet enabled.
+     */
+    init_xen_time();
 
     initialize_keytable();
 
     serial_init_postirq();
 
-    init_xen_time();
+    BUG_ON(!local_irq_is_enabled());
 
     for_each_present_cpu ( i )
     {
diff -Nru a/xen/arch/x86/time.c b/xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       2005-06-29 14:03:50 -04:00
+++ b/xen/arch/x86/time.c       2005-06-29 14:03:50 -04:00
@@ -239,6 +239,8 @@
     u32      low;
     u64      delta, tsc;
 
+    ASSERT(st_scale_f || st_scale_i);
+
     rdtscll(tsc);
     low = (u32)(tsc >> rdtsc_bitshift);
     delta_tsc = (s32)(low - shifted_tsc_irq);
@@ -349,13 +351,17 @@
     st_scale_f = scale & 0xffffffff;
     st_scale_i = scale >> 32;
 
+    local_irq_disable();
+
     /* System time ticks from zero. */
     rdtscll(full_tsc_irq);
     stime_irq = (s_time_t)0;
     shifted_tsc_irq = (u32)(full_tsc_irq >> rdtsc_bitshift);
 
     /* Wallclock time starts as the initial RTC time. */
-    wc_sec  = get_cmos_time();
+    wc_sec = get_cmos_time();
+
+    local_irq_enable();
 
     printk("Time init:\n");
     printk(".... cpu_freq:    %08X:%08X\n", (u32)(cpu_freq>>32),(u32)cpu_freq);
@@ -367,7 +373,7 @@
 
 
 /* Early init function. */
-void __init time_init(void)
+void __init early_time_init(void)
 {
     unsigned long ticks_per_frac = calibrate_tsc();
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Ensure global variables required by get_s_time() are initialised before, BitKeeper Bot <=