Re: [libvirt] [PATCH v2 1/2] qemu: log the crash information for S390

2018-03-02 Thread Bjoern Walk
John Ferlan  [2018-03-01, 02:22PM -0500]:
> On 02/27/2018 04:32 AM, Bjoern Walk wrote:
> > +if (VIR_STRDUP(ret->data.s390.reason, reason) < 0) {
> > +virReportOOMError();
> > +goto error;
> > +}
> 
> No need for the OOMError as VIR_STRDUP will splat that for you (the
> _QUIET one won't).
> 
> I can fix that up before pushing though.

I always forget this. Appreciated and thanks a lot.

-- 
IBM Systems
Linux on Z & Virtualization Development

IBM Deutschland Research & Development GmbH
Schönaicher Str. 220, 71032 Böblingen
Phone: +49 7031 16 1819

Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294 


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2 1/2] qemu: log the crash information for S390

2018-03-01 Thread John Ferlan


On 02/27/2018 04:32 AM, Bjoern Walk wrote:
> Since QEMU 2.12 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+: panic s390: core='0' 
> psw-mask='0x000200018000' psw-addr='0x0010f146' 
> reason='disabled-wait'
> 
> Reviewed-by: Boris Fiuczynski 
> Signed-off-by: Bjoern Walk 
> ---
>  src/qemu/qemu_monitor.c  | 19 ++-
>  src/qemu/qemu_monitor.h  | 12 
>  src/qemu/qemu_monitor_json.c | 38 ++
>  3 files changed, 68 insertions(+), 1 deletion(-)
> 

I see as of commit id '4ada99ade' this is now merged in qemu master for
2.12.0...

Of course I need to wait for 4.2.0 to open up before pushing after
fixing one nit below..

[...]

> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index a09e93e4..9f68d4d1 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -576,6 +576,42 @@ 
> 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", ) < 0 ||
> +virJSONValueObjectGetNumberUlong(data, "psw-mask", _mask) < 0 ||
> +virJSONValueObjectGetNumberUlong(data, "psw-addr", _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) {
> +virReportOOMError();
> +goto error;
> +}

No need for the OOMError as VIR_STRDUP will splat that for you (the
_QUIET one won't).

I can fix that up before pushing though.

Reviewed-by: John Ferlan 

John

> +
> +return ret;
> +
> + error:
> +qemuMonitorEventPanicInfoFree(ret);
> +return NULL;
> +}
>  

[...]


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 1/2] qemu: log the crash information for S390

2018-02-27 Thread Bjoern Walk
Since QEMU 2.12 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+: panic s390: core='0' 
psw-mask='0x000200018000' psw-addr='0x0010f146' 
reason='disabled-wait'

Reviewed-by: Boris Fiuczynski 
Signed-off-by: Bjoern Walk 
---
 src/qemu/qemu_monitor.c  | 19 ++-
 src/qemu/qemu_monitor.h  | 12 
 src/qemu/qemu_monitor_json.c | 38 ++
 3 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index ad5c572a..1d67a977 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -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(, "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);
 }
 
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 954ae88e..adfa87ab 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -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;
 };
 
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index a09e93e4..9f68d4d1 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -576,6 +576,42 @@ 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", ) < 0 ||
+virJSONValueObjectGetNumberUlong(data, "psw-mask", _mask) < 0 ||
+virJSONValueObjectGetNumberUlong(data, "psw-addr", _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) {
+virReportOOMError();
+goto error;
+}
+
+return ret;
+
+ error:
+