From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Slutz Subject: Re: [PATCH v2 11/12] xenctx: Dump registers via hvm info if available. Date: Thu, 7 Nov 2013 16:19:34 -0500 Message-ID: <527C03E6.4060003@terremark.com> References: <1383768500-4245-1-git-send-email-dslutz@terremark.com> <1383768500-4245-12-git-send-email-dslutz@terremark.com> <527B5FB202000078001007C3@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VeX3A-0003nX-9Z for xen-devel@lists.xenproject.org; Thu, 07 Nov 2013 21:23:36 +0000 In-Reply-To: <527B5FB202000078001007C3@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , Don Slutz Cc: Ian Campbell , Stefano Stabellini , George Dunlap , Don Slutz , Ian Jackson , xen-devel List-Id: xen-devel@lists.xenproject.org On 11/07/13 03:38, Jan Beulich wrote: >>>> On 06.11.13 at 21:08, Don Slutz wrote: >> @@ -931,7 +1174,44 @@ static void dump_ctx(int vcpu, guest_word_t mem_addr, guest_word_t stk_addr) >> #endif >> } else { >> if (!stk_addr) { >> - print_ctx(&ctx); >> +#if defined(__i386__) || defined(__x86_64__) >> + if (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) || >> + (((uint32_t)ctx.x64.ctrlreg[3]) != cpuctx.cr3)) { >> + fprintf(stderr, "Regs mismatch ip=%llx vs %llx sp=%llx vs %llx cr3=%llx vs %llx\n", >> + (long long)((uint32_t)ctx.x64.user_regs.eip), >> + (long long)cpuctx.rip, >> + (long long)((uint32_t)ctx.x64.user_regs.esp), >> + (long long)cpuctx.rsp, >> + (long long)((uint32_t)ctx.x64.ctrlreg[3]), >> + (long long)cpuctx.cr3); >> + fprintf(stdout, "=============Regs mismatch start=============\n"); >> + print_ctx(&ctx); >> + fprintf(stdout, "=============Regs mismatch end=============\n"); >> + } >> + } else { >> + if ((ctx.x64.user_regs.eip != cpuctx.rip) || >> + (ctx.x64.user_regs.esp != cpuctx.rsp) || >> + (ctx.x64.ctrlreg[3] != cpuctx.cr3)) { >> + fprintf(stderr, "Regs mismatch ip=%llx vs %llx sp=%llx vs %llx cr3=%llx vs %llx\n", >> + (long long)ctx.x64.user_regs.eip, >> + (long long)cpuctx.rip, >> + (long long)ctx.x64.user_regs.esp, >> + (long long)cpuctx.rsp, >> + (long long)ctx.x64.ctrlreg[3], >> + (long long)cpuctx.cr3); >> + fprintf(stdout, "=============Regs mismatch start=============\n"); >> + print_ctx(&ctx); >> + fprintf(stdout, "=============Regs mismatch end=============\n"); >> + } >> + } >> + print_cpuctx(&cpuctx); >> + } >> + else >> +#endif >> + print_ctx(&ctx); > Apart from Andrew's comments, which I agree with - most of the > additions above clearly don't belong here: This is not a diagnostic > utility. Fine with me, I will drop this part. I added during the time (~2010-2011) when I was looking at a DomU that was crashed. What I remember about this DomU was that vCPU 1 was offline and vCPU 0 was the crash cause and vCPU 2 & 3 where in the code to go offline. The routine xc_domain_hvm_getcontext_partial() was returning vCPU 2's data when asked for vCPU 1 (via instance == 1). This is the key reason I did the code in patch #12 (basically a way to call xc_domain_hvm_getcontext_partial() and xc_vcpu_getcontext() with different args). At the time I was not working on full xen code, just changing xenctx the help me out as needed. Looking at the code now, I do not understand how this could happen. -Don Slutz > Jan >