From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: stefano.stabellini@eu.citrix.com, xen-devel@lists.xenproject.org,
qemu-devel@nongnu.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [Qemu-devel] [PATCH RFC 6/6] xen: Add backtrace for serious issues.
Date: Mon, 29 Jun 2015 15:25:13 -0400 [thread overview]
Message-ID: <1435605913-23826-7-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1435605913-23826-1-git-send-email-konrad.wilk@oracle.com>
When debugging issues that caused the emulator to kill itself
or skipping certain operations (unable to write to host
registers) an stack trace will most definitly aid in debugging
the problem.
As such this patch uses the most basic backtrace to print out
details.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
hw/xen/xen_pt.c | 3 +++
include/hw/xen/xen_common.h | 1 +
xen-hvm.c | 16 ++++++++++++++++
3 files changed, 20 insertions(+)
diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index ea1ceda..1d256b9 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -407,6 +407,7 @@ out:
if (rc < 0) {
XEN_PT_ERR(d, "xen_host_pci_set_block failed. return value: %d.\n", rc);
+ xen_dump_stack();
}
}
}
@@ -421,6 +422,7 @@ static uint64_t xen_pt_bar_read(void *o, hwaddr addr,
* misconfiguration of the IOMMU. */
XEN_PT_ERR(d, "Should not read BAR through QEMU. @0x"TARGET_FMT_plx"\n",
addr);
+ xen_dump_stack();
return 0;
}
static void xen_pt_bar_write(void *o, hwaddr addr, uint64_t val,
@@ -430,6 +432,7 @@ static void xen_pt_bar_write(void *o, hwaddr addr, uint64_t val,
/* Same comment as xen_pt_bar_read function */
XEN_PT_ERR(d, "Should not write BAR through QEMU. @0x"TARGET_FMT_plx"\n",
addr);
+ xen_dump_stack();
}
static const MemoryRegionOps ops = {
diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h
index 38f29fb..3983cfb 100644
--- a/include/hw/xen/xen_common.h
+++ b/include/hw/xen/xen_common.h
@@ -165,6 +165,7 @@ void destroy_hvm_domain(bool reboot);
/* shutdown/destroy current domain because of an error */
void xen_shutdown_fatal_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
+void xen_dump_stack(void);
#ifdef HVM_PARAM_VMPORT_REGS_PFN
static inline int xen_get_vmport_regs_pfn(XenXC xc, domid_t dom,
diff --git a/xen-hvm.c b/xen-hvm.c
index a92bc14..8bf4a57 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -10,6 +10,7 @@
#include <sys/mman.h>
+#include <execinfo.h>
#include "hw/pci/pci.h"
#include "hw/i386/pc.h"
#include "hw/xen/xen_common.h"
@@ -1328,6 +1329,20 @@ void xen_register_framebuffer(MemoryRegion *mr)
framebuffer = mr;
}
+void xen_dump_stack(void)
+{
+ int nptrs;
+#define SIZE 1024
+ void *buffer[SIZE];
+
+ nptrs = backtrace(buffer, SIZE);
+ if (!nptrs)
+ return;
+
+ backtrace_symbols_fd(buffer, nptrs, STDERR_FILENO);
+#undef SIZE
+}
+
void xen_shutdown_fatal_error(const char *fmt, ...)
{
va_list ap;
@@ -1335,6 +1350,7 @@ void xen_shutdown_fatal_error(const char *fmt, ...)
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
+ xen_dump_stack();
fprintf(stderr, "Will destroy the domain.\n");
/* destroy the domain */
qemu_system_shutdown_request();
--
2.1.0
next prev parent reply other threads:[~2015-06-29 19:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-29 19:25 [Qemu-devel] [PATCH RFC v1] Cleanups + various fixes due to libxl ABI + more logging on errors Konrad Rzeszutek Wilk
2015-06-29 19:25 ` [Qemu-devel] [PATCH RFC 1/6] xen/pt: Update comments with proper function name Konrad Rzeszutek Wilk
2015-07-01 12:54 ` Stefano Stabellini
2015-06-29 19:25 ` [Qemu-devel] [PATCH RFC 2/6] xen/pt: Make xen_pt_msi_set_enable static Konrad Rzeszutek Wilk
2015-07-01 12:55 ` Stefano Stabellini
2015-06-29 19:25 ` [Qemu-devel] [PATCH RFC 3/6] xen/pt: xen_host_pci_config_read returns -errno, not -1 on failure Konrad Rzeszutek Wilk
2015-07-01 12:57 ` Stefano Stabellini
2015-06-29 19:25 ` [Qemu-devel] [PATCH RFC 4/6] xen: Print and use errno where applicable Konrad Rzeszutek Wilk
2015-07-01 13:01 ` Stefano Stabellini
2015-07-01 18:22 ` Konrad Rzeszutek Wilk
2015-07-02 11:00 ` Stefano Stabellini
2015-07-02 14:13 ` Konrad Rzeszutek Wilk
2015-06-29 19:25 ` [Qemu-devel] [PATCH RFC 5/6] xen/pt/msi: Add the register value when printing logging and error messages Konrad Rzeszutek Wilk
2015-06-29 19:25 ` Konrad Rzeszutek Wilk [this message]
2015-07-01 13:06 ` [Qemu-devel] [PATCH RFC 6/6] xen: Add backtrace for serious issues Stefano Stabellini
2015-07-02 13:50 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1435605913-23826-7-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).