>From d7b5aee76865943b92cf4b40fa6a1adec9f7eed3 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Tue, 16 Apr 2013 16:17:48 -0400 Subject: [PATCH] xen/vcpu: Add VCPUOP_marker Signed-off-by: Konrad Rzeszutek Wilk debug stop_singlehost_timer --- xen/arch/x86/hvm/hvm.c | 1 + xen/common/compat/domain.c | 1 + xen/common/domain.c | 69 +++++++++++++++++++++++++++++++++++++++++-- xen/include/public/vcpu.h | 8 +++++ 4 files changed, 75 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 7c3cb15..65a8dff 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3174,6 +3174,7 @@ static long hvm_vcpu_op( case VCPUOP_set_singleshot_timer: case VCPUOP_stop_singleshot_timer: case VCPUOP_register_vcpu_info: + case VCPUOP_marker: rc = do_vcpu_op(cmd, vcpuid, arg); break; default: diff --git a/xen/common/compat/domain.c b/xen/common/compat/domain.c index 44ba78d..b0336c8 100644 --- a/xen/common/compat/domain.c +++ b/xen/common/compat/domain.c @@ -65,6 +65,7 @@ int compat_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) case VCPUOP_stop_periodic_timer: case VCPUOP_stop_singleshot_timer: case VCPUOP_send_nmi: + case VCPUOP_marker: rc = do_vcpu_op(cmd, vcpuid, arg); break; diff --git a/xen/common/domain.c b/xen/common/domain.c index fac3470..6e00095 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -41,7 +41,8 @@ #include #include #include - +#include +#include /* Linux config option: propageted to domain0 */ /* xen_processor_pmbits: xen control Cx, Px, ... */ unsigned int xen_processor_pmbits = XEN_PROCESSOR_PM_PX; @@ -1082,9 +1083,10 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) } case VCPUOP_stop_singleshot_timer: - if ( v != current ) - return -EINVAL; - + if ( v != current ) { + rc = -EINVAL; + goto print_out; + } stop_timer(&v->singleshot_timer); break; @@ -1143,7 +1145,66 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) break; #endif + case VCPUOP_marker: + { + struct timer_info { + struct timer *t; + char *name; + } t[2]; + int i,set; + struct vcpu_marker marker = { .s = "\0", .line = 0 }; + if ( copy_from_guest(&marker, arg, 1) ) + return -EFAULT; + rc = 0; +print_out: + t[0].name = "singleshot"; + t[1].name = "periodic"; + printk("d%d [%s:%8"PRId64"] on VCPU%d\n", d->domain_id, marker.s, marker.line, current->vcpu_id); + for_each_vcpu ( d, v ) + { + struct tasklet *task; + + t[0].t = &v->singleshot_timer; + t[1].t = &v->periodic_timer; + for (i = 0; i < 2; i++) { + struct timer *_t = t[i].t; + if (!_t) + continue; + if (_t->status < TIMER_STATUS_in_heap) + continue; + + printk(" d%dv%d: timer [%s] in %8"PRId64"us", + d->domain_id, v->vcpu_id, t[i].name, _t->expires - NOW()); + print_symbol(" %s\n", (unsigned long)_t->function); + } + task = &v->arch.hvm_vcpu.assert_evtchn_irq_tasklet; + if (task) + printk(" d%dv%d on CPU%d %s %s %d\n", + d->domain_id, v->vcpu_id, task->scheduled_on, + task->is_dead ? "dead" : "-", + task->is_running ? "running" : "-", + task->is_running); + printk(" d%dv%d: %s %s poll:%d %s pending %s\n", + d->domain_id, v->vcpu_id, + test_bit(VCPU_KICK_SOFTIRQ, &softirq_pending(v->processor)) ? "IPIed": "", + /* Which means SOFTIRQ handler does whatever it needs to ? */ + /* If runing, should send IPI of 0xFC (XEn) */ + v->paused_for_shutdown ? "paused" : "", + v->poll_evtchn, + vcpu_info(v, evtchn_upcall_pending) ? "" : "not", + vcpu_info(v, evtchn_pending_sel) ? "pending sel": "-"); + for ( i = 0; i < BITS_PER_EVTCHN_WORD(d); i++ ) { + set = test_bit(i, &vcpu_info(v, evtchn_pending_sel)); + if (set) + printk(" d%d event: %d %s\n", d->domain_id, i, + test_bit(i, &shared_info(d, evtchn_mask)) ? "masked" : "-"); + } + } + /* TODO: Will show up as TRC_HYPERCALL_V2 */ + + break; + } default: rc = arch_do_vcpu_op(cmd, v, arg); break; diff --git a/xen/include/public/vcpu.h b/xen/include/public/vcpu.h index e888daf..b0578a3 100644 --- a/xen/include/public/vcpu.h +++ b/xen/include/public/vcpu.h @@ -227,6 +227,14 @@ struct vcpu_register_time_memory_area { typedef struct vcpu_register_time_memory_area vcpu_register_time_memory_area_t; DEFINE_XEN_GUEST_HANDLE(vcpu_register_time_memory_area_t); +#define VCPUOP_marker 14 +struct vcpu_marker { + char s[4]; + uint64_t line; +}; +typedef struct vcpu_marker vcpu_marker_t; +DEFINE_XEN_GUEST_HANDLE(vcpu_marker_t); + #endif /* __XEN_PUBLIC_VCPU_H__ */ /* -- 1.7.7.6