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

[Xen-changelog] [xen-unstable] linux: Use new time hypercalls.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1173468984 0
# Node ID cedf9e4ac6ff6c3541d90b2ad5db6e224e3e574d
# Parent  83756471416f861ddd70a3de0ab187ac1d5c2b17
linux: Use new time hypercalls.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c |   26 +++++++++++++++++++++--
 linux-2.6-xen-sparse/drivers/xen/Kconfig         |    7 ++++++
 2 files changed, 31 insertions(+), 2 deletions(-)

diff -r 83756471416f -r cedf9e4ac6ff 
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Fri Mar 09 19:34:52 
2007 +0000
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Fri Mar 09 19:36:24 
2007 +0000
@@ -907,6 +907,10 @@ static void setup_cpu0_timer_irq(void)
        BUG_ON(per_cpu(timer_irq, 0) < 0);
 }
 
+static struct vcpu_set_periodic_timer xen_set_periodic_tick = {
+       .period_ns = NS_PER_TICK
+};
+
 void __init time_init(void)
 {
 #ifdef CONFIG_HPET_TIMER
@@ -919,6 +923,10 @@ void __init time_init(void)
                return;
        }
 #endif
+
+       HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, 0,
+                          &xen_set_periodic_tick);
+
        get_time_values_from_xen(0);
 
        processed_system_time = per_cpu(shadow_time, 0).system_timestamp;
@@ -976,8 +984,10 @@ EXPORT_SYMBOL(jiffies_to_st);
  */
 static void stop_hz_timer(void)
 {
+       struct vcpu_set_singleshot_timer singleshot;
        unsigned int cpu = smp_processor_id();
        unsigned long j;
+       int rc;
 
        cpu_set(cpu, nohz_cpu_mask);
 
@@ -997,8 +1007,15 @@ static void stop_hz_timer(void)
                j = jiffies + 1;
        }
 
-       if (HYPERVISOR_set_timer_op(jiffies_to_st(j)) != 0)
-               BUG();
+       singleshot.timeout_abs_ns = jiffies_to_st(j);
+       rc = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &singleshot);
+#ifdef XEN_COMPAT_030004
+       if (rc) {
+               BUG_ON(rc != -ENOSYS);
+               rc = HYPERVISOR_set_timer_op(singleshot.timeout_abs_ns);
+       }
+#endif
+       BUG_ON(rc);
 }
 
 static void start_hz_timer(void)
@@ -1030,6 +1047,8 @@ void time_resume(void)
        init_cpu_khz();
 
        for_each_online_cpu(cpu) {
+               HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu,
+                                  &xen_set_periodic_tick);
                get_time_values_from_xen(cpu);
                per_cpu(processed_system_time, cpu) =
                        per_cpu(shadow_time, 0).system_timestamp;
@@ -1049,6 +1068,9 @@ int local_setup_timer(unsigned int cpu)
        int seq, irq;
 
        BUG_ON(cpu == 0);
+
+       HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu,
+                          &xen_set_periodic_tick);
 
        do {
                seq = read_seqbegin(&xtime_lock);
diff -r 83756471416f -r cedf9e4ac6ff linux-2.6-xen-sparse/drivers/xen/Kconfig
--- a/linux-2.6-xen-sparse/drivers/xen/Kconfig  Fri Mar 09 19:34:52 2007 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig  Fri Mar 09 19:36:24 2007 +0000
@@ -227,6 +227,9 @@ choice
        config XEN_COMPAT_030002_AND_LATER
                bool "3.0.2 and later"
 
+       config XEN_COMPAT_030004_AND_LATER
+               bool "3.0.4 and later"
+
        config XEN_COMPAT_LATEST_ONLY
                bool "no compatibility code"
 
@@ -236,6 +239,10 @@ config XEN_COMPAT_030002
        bool
        default XEN_COMPAT_030002_AND_LATER
 
+config XEN_COMPAT_030004
+       bool
+       default XEN_COMPAT_030002_AND_LATER || XEN_COMPAT_030004_AND_LATER
+
 endmenu
 
 config HAVE_IRQ_IGNORE_UNHANDLED

_______________________________________________
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®.