]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: log the crash information for S390
authorBjoern Walk <bwalk@linux.vnet.ibm.com>
Tue, 27 Feb 2018 09:32:56 +0000 (10:32 +0100)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 6 Mar 2018 13:55:12 +0000 (08:55 -0500)
Since QEMU 2.12 commit id '4ada99ade' guest crash information for
S390 is available in the QEMU monitor, e.g.:

  {
    "timestamp": {
        "seconds": 1518004739,
        "microseconds": 552563
    },
    "event": "GUEST_PANICKED",
    "data": {
        "action": "pause",
        "info": {
            "core": 0,
            "psw-addr": 1102832,
            "reason": "disabled-wait",
            "psw-mask": 562956395872256,
            "type": "s390"
        }
    }
  }

Let's log this information into the domain log file, e.g.:

    2018-02-08 13:11:26.075+0000: panic s390: core='0' psw-mask='0x0002000180000000' psw-addr='0x000000000010f146' reason='disabled-wait'

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c

index ad5c572aeefb51b5e5e40ee316d4f62470e79b3e..1d67a97789e76d7f53d492bd36f0dd67e3ecde98 100644 (file)
@@ -4361,7 +4361,14 @@ qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr info)
                                  info->data.hyperv.arg3, info->data.hyperv.arg4,
                                  info->data.hyperv.arg5));
         break;
-
+    case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_S390:
+        ignore_value(virAsprintf(&ret, "s390: core='%d' psw-mask='0x%016llx' "
+                                 "psw-addr='0x%016llx' reason='%s'",
+                                 info->data.s390.core,
+                                 info->data.s390.psw_mask,
+                                 info->data.s390.psw_addr,
+                                 info->data.s390.reason));
+        break;
     case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE:
     case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST:
         break;
@@ -4377,6 +4384,16 @@ qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info)
     if (!info)
         return;
 
+    switch (info->type) {
+    case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_S390:
+        VIR_FREE(info->data.s390.reason);
+        break;
+    case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE:
+    case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV:
+    case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST:
+        break;
+    }
+
     VIR_FREE(info);
 }
 
index 954ae88e4f6485dc39bfc84eb3bf32f3affb414b..adfa87aba91ba252ef37026139fabdbf593c536e 100644 (file)
@@ -73,6 +73,7 @@ struct _qemuMonitorMessage {
 typedef enum {
     QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE = 0,
     QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV,
+    QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_S390,
 
     QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST
 } qemuMonitorEventPanicInfoType;
@@ -88,12 +89,23 @@ struct _qemuMonitorEventPanicInfoHyperv {
     unsigned long long arg5;
 };
 
+typedef struct _qemuMonitorEventPanicInfoS390 qemuMonitorEventPanicInfoS390;
+typedef qemuMonitorEventPanicInfoS390 *qemuMonitorEventPanicInfoS390Ptr;
+struct _qemuMonitorEventPanicInfoS390 {
+    /* S390 specific guest panic information */
+    int core;
+    unsigned long long psw_mask;
+    unsigned long long psw_addr;
+    char *reason;
+};
+
 typedef struct _qemuMonitorEventPanicInfo qemuMonitorEventPanicInfo;
 typedef qemuMonitorEventPanicInfo *qemuMonitorEventPanicInfoPtr;
 struct _qemuMonitorEventPanicInfo {
     qemuMonitorEventPanicInfoType type;
     union {
         qemuMonitorEventPanicInfoHyperv hyperv;
+        qemuMonitorEventPanicInfoS390 s390;
     } data;
 };
 
index a09e93e464b3a76e5782680bd049e3e920af0da0..08dfffdf6435222a48dc1f8155d3b9b5de42d7bd 100644 (file)
@@ -576,6 +576,40 @@ qemuMonitorJSONGuestPanicExtractInfoHyperv(virJSONValuePtr data)
     return NULL;
 }
 
+static qemuMonitorEventPanicInfoPtr
+qemuMonitorJSONGuestPanicExtractInfoS390(virJSONValuePtr data)
+{
+    qemuMonitorEventPanicInfoPtr ret;
+    int core;
+    unsigned long long psw_mask, psw_addr;
+    const char *reason = NULL;
+
+    if (VIR_ALLOC(ret) < 0)
+        return NULL;
+
+    ret->type = QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_S390;
+
+    if (virJSONValueObjectGetNumberInt(data, "core", &core) < 0 ||
+        virJSONValueObjectGetNumberUlong(data, "psw-mask", &psw_mask) < 0 ||
+        virJSONValueObjectGetNumberUlong(data, "psw-addr", &psw_addr) < 0 ||
+        !(reason = virJSONValueObjectGetString(data, "reason"))) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed s390 panic data"));
+        goto error;
+    }
+
+    ret->data.s390.core = core;
+    ret->data.s390.psw_mask = psw_mask;
+    ret->data.s390.psw_addr = psw_addr;
+
+    if (VIR_STRDUP(ret->data.s390.reason, reason) < 0)
+        goto error;
+
+    return ret;
+
+ error:
+    qemuMonitorEventPanicInfoFree(ret);
+    return NULL;
+}
 
 static qemuMonitorEventPanicInfoPtr
 qemuMonitorJSONGuestPanicExtractInfo(virJSONValuePtr data)
@@ -584,6 +618,8 @@ qemuMonitorJSONGuestPanicExtractInfo(virJSONValuePtr data)
 
     if (STREQ_NULLABLE(type, "hyper-v"))
         return qemuMonitorJSONGuestPanicExtractInfoHyperv(data);
+    else if (STREQ_NULLABLE(type, "s390"))
+        return qemuMonitorJSONGuestPanicExtractInfoS390(data);
 
     virReportError(VIR_ERR_INTERNAL_ERROR,
                    _("unknown panic info type '%s'"), NULLSTR(type));