The hyperv panic notifier reports additional data in form of 5 registers
that are reported in the crash event from qemu. Log them into the VM log
file and report them as a warning so that admins can see the cause of
crash of their windows VMs.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1426176
---
src/qemu/qemu_driver.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 52 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ab7c01b23..c558e0991 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3971,10 +3971,56 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver,
return ret;
}
+
+static char *
+qemuProcessGuestPanicEventInfoFormatData(qemuMonitorEventPanicInfoPtr info)
+{
+ char *ret = NULL;
+
+ switch (info->type) {
+ case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV:
+ ignore_value(virAsprintf(&ret, "hyper-v: arg1='0x%llx', arg2='0x%llx', "
+ "arg3='0x%llx', arg4='0x%llx', "
+ "arg5='0x%llx'",
+ info->data.hyperv.arg1,
+ info->data.hyperv.arg2,
+ info->data.hyperv.arg3,
+ info->data.hyperv.arg4,
+ info->data.hyperv.arg5));
+ break;
+
+ case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE:
+ case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST:
+ break;
+ }
+
+ return ret;
+}
+
+
+static void
+qemuProcessGuestPanicEventInfo(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ qemuMonitorEventPanicInfoPtr info)
+{
+ char *msg = qemuProcessGuestPanicEventInfoFormatData(info);
+ char *timestamp = virTimeStringNow();
+
+ if (msg && timestamp) {
+ qemuDomainLogAppendMessage(driver, vm, "%s: panic %s\n", timestamp, msg);
+ VIR_WARN("domain '%s' panic data: %s", vm->def->name, msg);
+ }
+
+ VIR_FREE(timestamp);
+ VIR_FREE(msg);
+}
+
+
static void
processGuestPanicEvent(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- int action)
+ int action,
+ qemuMonitorEventPanicInfoPtr info)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virObjectEventPtr event = NULL;
@@ -3990,6 +4036,9 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
goto endjob;
}
+ if (info)
+ qemuProcessGuestPanicEventInfo(driver, vm, info);
+
virDomainObjSetState(vm, VIR_DOMAIN_CRASHED, VIR_DOMAIN_CRASHED_PANICKED);
event = virDomainEventLifecycleNewFromObj(vm,
@@ -4567,7 +4616,8 @@ static void qemuProcessEventHandler(void *data, void *opaque)
processWatchdogEvent(driver, vm, processEvent->action);
break;
case QEMU_PROCESS_EVENT_GUESTPANIC:
- processGuestPanicEvent(driver, vm, processEvent->action);
+ processGuestPanicEvent(driver, vm, processEvent->action,
+ processEvent->data);
break;
case QEMU_PROCESS_EVENT_DEVICE_DELETED:
processDeviceDeletedEvent(driver, vm, processEvent->data);
--
2.12.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Tue, Mar 21, 2017 at 08:47:50 +0100, Peter Krempa wrote:
> The hyperv panic notifier reports additional data in form of 5 registers
> that are reported in the crash event from qemu. Log them into the VM log
> file and report them as a warning so that admins can see the cause of
> crash of their windows VMs.
>
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1426176
> ---
> src/qemu/qemu_driver.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 52 insertions(+), 2 deletions(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index ab7c01b23..c558e0991 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -3971,10 +3971,56 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver,
> return ret;
> }
>
> +
> +static char *
> +qemuProcessGuestPanicEventInfoFormatData(qemuMonitorEventPanicInfoPtr info)
I think this should be implemented in qemu_monitor.c as
qemuMonitorEventPanicInfoFormat so that it's closer the structure is
defined.
> +{
> + char *ret = NULL;
> +
> + switch (info->type) {
> + case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV:
> + ignore_value(virAsprintf(&ret, "hyper-v: arg1='0x%llx', arg2='0x%llx', "
> + "arg3='0x%llx', arg4='0x%llx', "
> + "arg5='0x%llx'",
> + info->data.hyperv.arg1,
> + info->data.hyperv.arg2,
> + info->data.hyperv.arg3,
> + info->data.hyperv.arg4,
> + info->data.hyperv.arg5));
Wrong indentation, the additional lines should be aligned with &ret :-)
> + break;
> +
> + case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE:
> + case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST:
> + break;
> + }
> +
> + return ret;
> +}
> +
> +
> +static void
> +qemuProcessGuestPanicEventInfo(virQEMUDriverPtr driver,
> + virDomainObjPtr vm,
> + qemuMonitorEventPanicInfoPtr info)
> +{
> + char *msg = qemuProcessGuestPanicEventInfoFormatData(info);
> + char *timestamp = virTimeStringNow();
> +
> + if (msg && timestamp) {
> + qemuDomainLogAppendMessage(driver, vm, "%s: panic %s\n", timestamp, msg);
> + VIR_WARN("domain '%s' panic data: %s", vm->def->name, msg);
Do we really need this warning? Especially when a guest panic triggers
the warning only if we have the additional data to report. We should
either emit the warning in all cases or never. I think we should just
drop the warning.
Jirka
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
The hyperv panic notifier reports additional data in form of 5 registers
that are reported in the crash event from qemu. Log them into the VM log
file and report them as a warning so that admins can see the cause of
crash of their windows VMs.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1426176
---
src/qemu/qemu_driver.c | 26 ++++++++++++++++++++++++--
src/qemu/qemu_monitor.c | 24 ++++++++++++++++++++++++
src/qemu/qemu_monitor.h | 1 +
3 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6db325494..d5fc00eba 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3971,10 +3971,28 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver,
return ret;
}
+
+static void
+qemuProcessGuestPanicEventInfo(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ qemuMonitorEventPanicInfoPtr info)
+{
+ char *msg = qemuMonitorGuestPanicEventInfoFormatMsg(info);
+ char *timestamp = virTimeStringNow();
+
+ if (msg && timestamp)
+ qemuDomainLogAppendMessage(driver, vm, "%s: panic %s\n", timestamp, msg);
+
+ VIR_FREE(timestamp);
+ VIR_FREE(msg);
+}
+
+
static void
processGuestPanicEvent(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- int action)
+ int action,
+ qemuMonitorEventPanicInfoPtr info)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virObjectEventPtr event = NULL;
@@ -3990,6 +4008,9 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
goto endjob;
}
+ if (info)
+ qemuProcessGuestPanicEventInfo(driver, vm, info);
+
virDomainObjSetState(vm, VIR_DOMAIN_CRASHED, VIR_DOMAIN_CRASHED_PANICKED);
event = virDomainEventLifecycleNewFromObj(vm,
@@ -4567,7 +4588,8 @@ static void qemuProcessEventHandler(void *data, void *opaque)
processWatchdogEvent(driver, vm, processEvent->action);
break;
case QEMU_PROCESS_EVENT_GUESTPANIC:
- processGuestPanicEvent(driver, vm, processEvent->action);
+ processGuestPanicEvent(driver, vm, processEvent->action,
+ processEvent->data);
break;
case QEMU_PROCESS_EVENT_DEVICE_DELETED:
processDeviceDeletedEvent(driver, vm, processEvent->data);
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 7905343a5..ca0b2c3b3 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4243,6 +4243,30 @@ qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon)
}
+char *
+qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr info)
+{
+ char *ret = NULL;
+
+ switch (info->type) {
+ case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV:
+ ignore_value(virAsprintf(&ret, "hyper-v: arg1='0x%llx', arg2='0x%llx', "
+ "arg3='0x%llx', arg4='0x%llx', "
+ "arg5='0x%llx'",
+ info->data.hyperv.arg1, info->data.hyperv.arg2,
+ info->data.hyperv.arg3, info->data.hyperv.arg4,
+ info->data.hyperv.arg5));
+ break;
+
+ case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE:
+ case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST:
+ break;
+ }
+
+ return ret;
+}
+
+
void
qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info)
{
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index ad1e96276..87a1496cf 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -97,6 +97,7 @@ struct _qemuMonitorEventPanicInfo {
} data;
};
+char *qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr info);
void qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info);
typedef void (*qemuMonitorDestroyCallback)(qemuMonitorPtr mon,
--
2.12.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, Mar 27, 2017 at 16:10:55 +0200, Peter Krempa wrote: > The hyperv panic notifier reports additional data in form of 5 registers > that are reported in the crash event from qemu. Log them into the VM log > file and report them as a warning so that admins can see the cause of > crash of their windows VMs. > > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1426176 > --- > src/qemu/qemu_driver.c | 26 ++++++++++++++++++++++++-- > src/qemu/qemu_monitor.c | 24 ++++++++++++++++++++++++ > src/qemu/qemu_monitor.h | 1 + > 3 files changed, 49 insertions(+), 2 deletions(-) > ACK Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2026 Red Hat, Inc.