[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 12/12] xenctx: Add optional fCPU.
From: Don Slutz <Don@xxxxxxxxxxxxxxx> This can be used to dump the normal ctx for an HVM DomU by passing -1 to fCPU. If only some of the vCPUs in a HVM DomU, you need to ask for ask for the on line CPU number, not the expected vCPU number; fCPU can be used for this. Signed-off-by: Don Slutz <Don@xxxxxxxxxxxxxxx> --- tools/xentrace/xenctx.c | 39 ++++++++++++++++++++++++++++----------- 1 files changed, 28 insertions(+), 11 deletions(-) diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c index d3cbb22..a7a791a 100644 --- a/tools/xentrace/xenctx.c +++ b/tools/xentrace/xenctx.c @@ -1125,7 +1125,7 @@ static int print_stack(vcpu_guest_context_any_t *ctx, int vcpu, int width, guest } #endif -static void dump_ctx(int vcpu, guest_word_t mem_addr, guest_word_t stk_addr) +static void dump_ctx(int vcpu, int fcpu, guest_word_t mem_addr, guest_word_t stk_addr) { vcpu_guest_context_any_t ctx; #if defined(__i386__) || defined(__x86_64__) @@ -1139,11 +1139,11 @@ static void dump_ctx(int vcpu, guest_word_t mem_addr, guest_word_t stk_addr) #if defined(__i386__) || defined(__x86_64__) { - if (xenctx.dominfo.hvm) { + if (fcpu >= 0 && xenctx.dominfo.hvm) { xen_capabilities_info_t xen_caps = ""; if (xc_domain_hvm_getcontext_partial( xenctx.xc_handle, xenctx.domid, HVM_SAVE_CODE(CPU), - vcpu, &cpuctx, sizeof cpuctx) != 0) { + fcpu, &cpuctx, sizeof cpuctx) != 0) { perror("xc_domain_hvm_getcontext_partial"); return; } @@ -1175,7 +1175,7 @@ static void dump_ctx(int vcpu, guest_word_t mem_addr, guest_word_t stk_addr) } else { if (!stk_addr) { #if defined(__i386__) || defined(__x86_64__) - if (xenctx.dominfo.hvm && ctxt_word_size == 8) { + if (fcpu >= 0 && xenctx.dominfo.hvm && ctxt_word_size == 8) { if (guest_word_size == 4) { if ((((uint32_t)ctx.x64.user_regs.eip) != cpuctx.rip) || (((uint32_t)ctx.x64.user_regs.esp) != cpuctx.rsp) || @@ -1229,12 +1229,22 @@ static void dump_all_vcpus(guest_word_t mem_addr, guest_word_t stk_addr) { xc_vcpuinfo_t vinfo; int vcpu; + int fcpu = 0; + for (vcpu = 0; vcpu <= xenctx.dominfo.max_vcpu_id; vcpu++) { if ( xc_vcpu_getinfo(xenctx.xc_handle, xenctx.domid, vcpu, &vinfo) ) continue; - if ( vinfo.online ) - dump_ctx(vcpu, mem_addr, stk_addr); + if ( vinfo.online ) { + printf("vcpu=%d(%d)\n", vcpu, fcpu); + dump_ctx(vcpu, fcpu, mem_addr, stk_addr); + fcpu++; + printf("\n"); + } else { + printf("vcpu=%d offline\n", vcpu); + dump_ctx(vcpu, -1, mem_addr, stk_addr); + printf("\n"); + } } } @@ -1242,7 +1252,7 @@ static void usage(void) { printf("usage:\n\n"); - printf(" xenctx [options] <DOMAIN> [VCPU]\n\n"); + printf(" xenctx [options] <DOMAIN> [VCPU] [fCPU]\n\n"); printf("options:\n"); printf(" -f, --frame-pointers\n"); @@ -1285,6 +1295,7 @@ int main(int argc, char **argv) guest_word_t stk_addr = 0; int vcpu = 0; + int fcpu = 0; while ((ch = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) { switch(ch) { @@ -1326,8 +1337,8 @@ int main(int argc, char **argv) argv += optind; argc -= optind; - if (argc < 1 || argc > 2) { - printf("usage: xenctx [options] <domid> <optional vcpu>\n"); + if (argc < 1 || argc > 3) { + printf("usage: xenctx [options] <domid> <optional vcpu> <optional fcpu>\n"); exit(-1); } @@ -1337,8 +1348,14 @@ int main(int argc, char **argv) exit(-1); } - if (argc == 2) + if (argc == 2) { vcpu = atoi(argv[1]); + fcpu = vcpu; + } + + if (argc == 3) { + fcpu = atoi(argv[2]); + } if (symbol_table) read_symbol_table(symbol_table); @@ -1367,7 +1384,7 @@ int main(int argc, char **argv) if (xenctx.all_vcpus) dump_all_vcpus(mem_addr, stk_addr); else - dump_ctx(vcpu, mem_addr, stk_addr); + dump_ctx(vcpu, fcpu, mem_addr, stk_addr); if (xenctx.self_paused) { ret = xc_domain_unpause(xenctx.xc_handle, xenctx.domid); -- 1.7.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |