[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Signal softirq-context calibration with an actual first-class



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1219828369 -3600
# Node ID 2eefc8294358164a7a3f7323716a1c7ccb3c2508
# Parent  2986c11b7edf4b1242cace49e1b317a10560eada
x86: Signal softirq-context calibration with an actual first-class
softirq handle rather than kludging it with set_timer().

Should be faster and is definitely clearer. Also avoids us using
set_timer() in IRQ context (which is currently broken but soon won't
be).

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/time.c           |   13 +++++--------
 xen/include/asm-x86/softirq.h |    3 ++-
 2 files changed, 7 insertions(+), 9 deletions(-)

diff -r 2986c11b7edf -r 2eefc8294358 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Wed Aug 27 10:11:33 2008 +0100
+++ b/xen/arch/x86/time.c       Wed Aug 27 10:12:49 2008 +0100
@@ -840,12 +840,11 @@ struct cpu_calibration {
     u64 local_tsc_stamp;
     s_time_t stime_local_stamp;
     s_time_t stime_master_stamp;
-    struct timer softirq_callback;
 };
 static DEFINE_PER_CPU(struct cpu_calibration, cpu_calibration);
 
 /* Softirq handler for per-CPU time calibration. */
-static void local_time_calibration(void *unused)
+static void local_time_calibration(void)
 {
     struct cpu_time *t = &this_cpu(cpu_time);
     struct cpu_calibration *c = &this_cpu(cpu_calibration);
@@ -1022,8 +1021,7 @@ static void time_calibration_rendezvous(
     c->stime_local_stamp = get_s_time();
     c->stime_master_stamp = r->master_stime;
 
-    /* Callback in softirq context as soon as possible. */
-    set_timer(&c->softirq_callback, c->stime_local_stamp);
+    raise_softirq(TIME_CALIBRATE_SOFTIRQ);
 }
 
 static void time_calibration(void *unused)
@@ -1049,9 +1047,6 @@ void init_percpu_time(void)
     t->stime_master_stamp = now;
     t->stime_local_stamp  = now;
 
-    init_timer(&this_cpu(cpu_calibration).softirq_callback,
-               local_time_calibration, NULL, smp_processor_id());
-
     if ( smp_processor_id() == 0 )
     {
         init_timer(&calibration_timer, time_calibration, NULL, 0);
@@ -1068,6 +1063,8 @@ int __init init_xen_time(void)
        this is a new feature introduced by Nehalem*/
     if ( cpuid_edx(0x80000007) & (1u<<8) )
         tsc_invariant = 1;
+
+    open_softirq(TIME_CALIBRATE_SOFTIRQ, local_time_calibration);
 
     init_percpu_time();
 
@@ -1176,7 +1173,7 @@ int time_suspend(void)
     }
 
     /* Better to cancel calibration timer for accuracy. */
-    kill_timer(&this_cpu(cpu_calibration).softirq_callback);
+    clear_bit(TIME_CALIBRATE_SOFTIRQ, &softirq_pending(smp_processor_id()));
 
     return 0;
 }
diff -r 2986c11b7edf -r 2eefc8294358 xen/include/asm-x86/softirq.h
--- a/xen/include/asm-x86/softirq.h     Wed Aug 27 10:11:33 2008 +0100
+++ b/xen/include/asm-x86/softirq.h     Wed Aug 27 10:12:49 2008 +0100
@@ -1,7 +1,8 @@
 #ifndef __ASM_SOFTIRQ_H__
 #define __ASM_SOFTIRQ_H__
 
-#define NMI_MCE_SOFTIRQ     (NR_COMMON_SOFTIRQS + 0)
+#define NMI_MCE_SOFTIRQ        (NR_COMMON_SOFTIRQS + 0)
+#define TIME_CALIBRATE_SOFTIRQ (NR_COMMON_SOFTIRQS + 1)
 
 #define NR_ARCH_SOFTIRQS    1
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.