diff --git a/xen/common/domain.c b/xen/common/domain.c index 64ee29d..ac59452 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -937,18 +937,27 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) { struct vcpu_set_singleshot_timer set; - if ( v != current ) + if ( v != current ) { + TRACE_1D(TRC_PV_TIMER_FAIL, 1); return -EINVAL; + } - if ( copy_from_guest(&set, arg, 1) ) + if ( copy_from_guest(&set, arg, 1) ) { + TRACE_1D(TRC_PV_TIMER_FAIL, 2); return -EFAULT; + } if ( (set.flags & VCPU_SSHOTTMR_future) && - (set.timeout_abs_ns < NOW()) ) + (set.timeout_abs_ns < NOW()) ) { + TRACE_1D(TRC_PV_TIMER_FAIL, 3); return -ETIME; + } migrate_timer(&v->singleshot_timer, smp_processor_id()); + v->singleshot_timer.debug = 1; set_timer(&v->singleshot_timer, set.timeout_abs_ns); + TRACE_2D(TRC_PV_SET_TIMER, (uint32_t)set.timeout_abs_ns, + (uint32_t)(set.timeout_abs_ns >> 32)); break; } @@ -958,6 +967,8 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) return -EINVAL; stop_timer(&v->singleshot_timer); + TRACE_2D(TRC_PV_STOP_TIMER, (uint32_t)v->singleshot_timer.expires, + (uint32_t)(v->singleshot_timer.expires >> 32)); break; diff --git a/xen/common/timer.c b/xen/common/timer.c index 9ed74e9..61e4383 100644 --- a/xen/common/timer.c +++ b/xen/common/timer.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -421,6 +422,9 @@ static void execute_timer(struct timers *ts, struct timer *t) list_add(&t->inactive, &ts->inactive); ts->running = t; + if (t->debug) + TRACE_2D(TRC_PV_FIRE_TIMER, (uint32_t)t->expires, + (uint32_t)(t->expires >> 32)); spin_unlock_irq(&ts->lock); (*fn)(data); spin_lock_irq(&ts->lock); diff --git a/xen/include/public/trace.h b/xen/include/public/trace.h index e2f60a6..4571d74 100644 --- a/xen/include/public/trace.h +++ b/xen/include/public/trace.h @@ -122,6 +122,7 @@ #define TRC_PV_ENTRY 0x00201000 /* Hypervisor entry points for PV guests. */ #define TRC_PV_SUBCALL 0x00202000 /* Sub-call in a multicall hypercall */ +#define TRC_PV_TIMER 0x00208000 /* PV timer */ #define TRC_PV_HYPERCALL (TRC_PV_ENTRY + 1) #define TRC_PV_TRAP (TRC_PV_ENTRY + 3) @@ -136,6 +137,10 @@ #define TRC_PV_PTWR_EMULATION_PAE (TRC_PV_ENTRY + 12) #define TRC_PV_HYPERCALL_V2 (TRC_PV_ENTRY + 13) #define TRC_PV_HYPERCALL_SUBCALL (TRC_PV_SUBCALL + 14) +#define TRC_PV_SET_TIMER (TRC_PV_TIMER + 15) +#define TRC_PV_FIRE_TIMER (TRC_PV_TIMER + 16) +#define TRC_PV_TIMER_FAIL (TRC_PV_TIMER + 17) +#define TRC_PV_STOP_TIMER (TRC_PV_TIMER + 18) /* * TRC_PV_HYPERCALL_V2 format diff --git a/xen/include/xen/timer.h b/xen/include/xen/timer.h index 9531800..b69ae20 100644 --- a/xen/include/xen/timer.h +++ b/xen/include/xen/timer.h @@ -43,6 +43,7 @@ struct timer { #define TIMER_STATUS_in_heap 3 /* In use; on timer heap. */ #define TIMER_STATUS_in_list 4 /* In use; on overflow linked list. */ uint8_t status; + uint8_t debug; }; /*