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

[Xen-changelog] [xen-unstable] Add flags field to VCPUOP_set_singlsehot_timer.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1173545891 0
# Node ID 7f624c770dbdeb37848e0d37e888585e85803427
# Parent  8fa8de63abf48473e06755bd1f4f4ea29386e592
Add flags field to VCPUOP_set_singlsehot_timer.
Flag 'future' causes Xen to check if the timeout is in the past and
return -ETIME if so.
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c |    1 +
 xen/common/domain.c                              |    4 ++++
 xen/include/public/vcpu.h                        |    8 +++++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff -r 8fa8de63abf4 -r 7f624c770dbd 
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Sat Mar 10 16:22:52 
2007 +0000
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Sat Mar 10 16:58:11 
2007 +0000
@@ -1008,6 +1008,7 @@ static void stop_hz_timer(void)
        }
 
        singleshot.timeout_abs_ns = jiffies_to_st(j);
+       singleshot.flags = 0;
        rc = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &singleshot);
 #ifdef XEN_COMPAT_030004
        if (rc) {
diff -r 8fa8de63abf4 -r 7f624c770dbd xen/common/domain.c
--- a/xen/common/domain.c       Sat Mar 10 16:22:52 2007 +0000
+++ b/xen/common/domain.c       Sat Mar 10 16:58:11 2007 +0000
@@ -623,6 +623,10 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
         if ( copy_from_guest(&set, arg, 1) )
             return -EFAULT;
 
+        if ( (set.flags & VCPU_SSHOTTMR_future) &&
+             (set.timeout_abs_ns < NOW()) )
+            return -ETIME;
+
         if ( v->singleshot_timer.cpu != smp_processor_id() )
         {
             stop_timer(&v->singleshot_timer);
diff -r 8fa8de63abf4 -r 7f624c770dbd xen/include/public/vcpu.h
--- a/xen/include/public/vcpu.h Sat Mar 10 16:22:52 2007 +0000
+++ b/xen/include/public/vcpu.h Sat Mar 10 16:58:11 2007 +0000
@@ -150,10 +150,16 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_set_periodi
 #define VCPUOP_set_singleshot_timer  8 /* arg == vcpu_set_singleshot_timer_t */
 #define VCPUOP_stop_singleshot_timer 9 /* arg == NULL */
 struct vcpu_set_singleshot_timer {
-    uint64_t timeout_abs_ns;
+    uint64_t timeout_abs_ns;   /* Absolute system time value in nanoseconds. */
+    uint32_t flags;            /* VCPU_SSHOTTMR_??? */
 };
 typedef struct vcpu_set_singleshot_timer vcpu_set_singleshot_timer_t;
 DEFINE_XEN_GUEST_HANDLE(vcpu_set_singleshot_timer_t);
+
+/* Flags to VCPUOP_set_singleshot_timer. */
+ /* Require the timeout to be in the future (return -ETIME if it's passed). */
+#define _VCPU_SSHOTTMR_future (0)
+#define VCPU_SSHOTTMR_future  (1U << _VCPU_SSHOTTMR_future)
 
 #endif /* __XEN_PUBLIC_VCPU_H__ */
 

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