direct-io.hg

changeset 14328:7f624c770dbd

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@goop.org>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Sat Mar 10 16:58:11 2007 +0000 (2007-03-10)
parents 8fa8de63abf4
children 9044a50c50ab
files linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c xen/common/domain.c xen/include/public/vcpu.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Sat Mar 10 16:22:52 2007 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Sat Mar 10 16:58:11 2007 +0000
     1.3 @@ -1008,6 +1008,7 @@ static void stop_hz_timer(void)
     1.4  	}
     1.5  
     1.6  	singleshot.timeout_abs_ns = jiffies_to_st(j);
     1.7 +	singleshot.flags = 0;
     1.8  	rc = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &singleshot);
     1.9  #ifdef XEN_COMPAT_030004
    1.10  	if (rc) {
     2.1 --- a/xen/common/domain.c	Sat Mar 10 16:22:52 2007 +0000
     2.2 +++ b/xen/common/domain.c	Sat Mar 10 16:58:11 2007 +0000
     2.3 @@ -623,6 +623,10 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
     2.4          if ( copy_from_guest(&set, arg, 1) )
     2.5              return -EFAULT;
     2.6  
     2.7 +        if ( (set.flags & VCPU_SSHOTTMR_future) &&
     2.8 +             (set.timeout_abs_ns < NOW()) )
     2.9 +            return -ETIME;
    2.10 +
    2.11          if ( v->singleshot_timer.cpu != smp_processor_id() )
    2.12          {
    2.13              stop_timer(&v->singleshot_timer);
     3.1 --- a/xen/include/public/vcpu.h	Sat Mar 10 16:22:52 2007 +0000
     3.2 +++ b/xen/include/public/vcpu.h	Sat Mar 10 16:58:11 2007 +0000
     3.3 @@ -150,11 +150,17 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_set_periodi
     3.4  #define VCPUOP_set_singleshot_timer  8 /* arg == vcpu_set_singleshot_timer_t */
     3.5  #define VCPUOP_stop_singleshot_timer 9 /* arg == NULL */
     3.6  struct vcpu_set_singleshot_timer {
     3.7 -    uint64_t timeout_abs_ns;
     3.8 +    uint64_t timeout_abs_ns;   /* Absolute system time value in nanoseconds. */
     3.9 +    uint32_t flags;            /* VCPU_SSHOTTMR_??? */
    3.10  };
    3.11  typedef struct vcpu_set_singleshot_timer vcpu_set_singleshot_timer_t;
    3.12  DEFINE_XEN_GUEST_HANDLE(vcpu_set_singleshot_timer_t);
    3.13  
    3.14 +/* Flags to VCPUOP_set_singleshot_timer. */
    3.15 + /* Require the timeout to be in the future (return -ETIME if it's passed). */
    3.16 +#define _VCPU_SSHOTTMR_future (0)
    3.17 +#define VCPU_SSHOTTMR_future  (1U << _VCPU_SSHOTTMR_future)
    3.18 +
    3.19  #endif /* __XEN_PUBLIC_VCPU_H__ */
    3.20  
    3.21  /*