From nobody Fri May 3 08:45:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1490082422540450.1420748620458; Tue, 21 Mar 2017 00:47:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 24B9563716; Tue, 21 Mar 2017 07:47:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB1217EB93; Tue, 21 Mar 2017 07:47:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 941EE4EBDC; Tue, 21 Mar 2017 07:47:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2L7kvPM016392 for ; Tue, 21 Mar 2017 03:46:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2BC907FE38; Tue, 21 Mar 2017 07:46:57 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F8041713A; Tue, 21 Mar 2017 07:46:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 24B9563716 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 24B9563716 From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 21 Mar 2017 08:47:47 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/4] qemu: driver: Remove useless forward declarations X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 21 Mar 2017 07:47:02 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- src/qemu/qemu_driver.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dcd823f53..41992158f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -136,14 +136,6 @@ VIR_LOG_INIT("qemu.qemu_driver"); #define QEMU_NB_BANDWIDTH_PARAM 7 -static void processWatchdogEvent(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int action); - -static void processGuestPanicEvent(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int action); - static void qemuProcessEventHandler(void *data, void *opaque); static int qemuStateCleanup(void); @@ -154,16 +146,9 @@ static int qemuDomainObjStart(virConnectPtr conn, unsigned int flags, qemuDomainAsyncJob asyncJob); -static int qemuDomainGetMaxVcpus(virDomainPtr dom); - static int qemuDomainManagedSaveLoad(virDomainObjPtr vm, void *opaque); -static int qemuOpenFile(virQEMUDriverPtr driver, - virDomainObjPtr vm, - const char *path, int oflags, - bool *needUnlink, bool *bypassSecurityDriver); - static int qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid, bool dynamicOwnership, const char *path, int oflags, --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 08:45:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1490082432591408.03527650775686; Tue, 21 Mar 2017 00:47:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA776C062C8B; Tue, 21 Mar 2017 07:47:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8DBF77848B; Tue, 21 Mar 2017 07:47:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 35D3B18521C9; Tue, 21 Mar 2017 07:47:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2L7kwsu016400 for ; Tue, 21 Mar 2017 03:46:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 25FDA4DA15; Tue, 21 Mar 2017 07:46:58 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 795881713A; Tue, 21 Mar 2017 07:46:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CA776C062C8B Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CA776C062C8B From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 21 Mar 2017 08:47:48 +0100 Message-Id: <79e80c6406b708f70006384849d38257a2a6ee93.1490082333.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/4] qemu: driver: Fix formatting in processGuestPanicEvent X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 21 Mar 2017 07:47:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- src/qemu/qemu_driver.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 41992158f..ab7c01b23 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3990,13 +3990,11 @@ processGuestPanicEvent(virQEMUDriverPtr driver, goto endjob; } - virDomainObjSetState(vm, - VIR_DOMAIN_CRASHED, - VIR_DOMAIN_CRASHED_PANICKED); + virDomainObjSetState(vm, VIR_DOMAIN_CRASHED, VIR_DOMAIN_CRASHED_PANICK= ED); event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_CRASHED, - VIR_DOMAIN_EVENT_CRASHED_PANICKED); + VIR_DOMAIN_EVENT_CRASHED, + VIR_DOMAIN_EVENT_CRASHED_PAN= ICKED); qemuDomainEventQueue(driver, event); @@ -4019,8 +4017,8 @@ processGuestPanicEvent(virQEMUDriverPtr driver, qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_CRASHED, QEMU_ASYNC_JOB_DUMP, 0); event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STOPPED, - VIR_DOMAIN_EVENT_STOPPED_CRASHED); + VIR_DOMAIN_EVENT_STOPPED, + VIR_DOMAIN_EVENT_STOPPED= _CRASHED); qemuDomainEventQueue(driver, event); virDomainAuditStop(vm, "destroyed"); --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 08:45:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1490082432324536.7120462026763; Tue, 21 Mar 2017 00:47:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9AC67AE83; Tue, 21 Mar 2017 07:47:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AC6F4DA15; Tue, 21 Mar 2017 07:47:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2EEBF18521C8; Tue, 21 Mar 2017 07:47:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2L7kxBK016407 for ; Tue, 21 Mar 2017 03:46:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 204C417AE0; Tue, 21 Mar 2017 07:46:59 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73F691713A; Tue, 21 Mar 2017 07:46:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A9AC67AE83 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A9AC67AE83 From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 21 Mar 2017 08:47:49 +0100 Message-Id: <1fbceed59b66a5794a3a2a0032a91fc209e5d508.1490082333.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/4] qemu: monitor: Extract additional info from GUEST_PANICKED event X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 21 Mar 2017 07:47:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" For certain kinds of panic notifiers (notably hyper-v) qemu is able to report some data regarding the crash passed from the guest. Make the data accessible to the callback in qemu so that it can be processed further. --- src/qemu/qemu_monitor.c | 15 ++++++++++-- src/qemu/qemu_monitor.h | 32 ++++++++++++++++++++++++- src/qemu/qemu_monitor_json.c | 56 ++++++++++++++++++++++++++++++++++++++++= ++-- src/qemu/qemu_process.c | 2 ++ 4 files changed, 100 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 79da47237..4a7e71e8f 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1359,11 +1359,12 @@ qemuMonitorEmitResume(qemuMonitorPtr mon) int -qemuMonitorEmitGuestPanic(qemuMonitorPtr mon) +qemuMonitorEmitGuestPanic(qemuMonitorPtr mon, + qemuMonitorEventPanicInfoPtr info) { int ret =3D -1; VIR_DEBUG("mon=3D%p", mon); - QEMU_MONITOR_CALLBACK(mon, ret, domainGuestPanic, mon->vm); + QEMU_MONITOR_CALLBACK(mon, ret, domainGuestPanic, mon->vm, info); return ret; } @@ -4184,3 +4185,13 @@ qemuMonitorQueryQMPSchema(qemuMonitorPtr mon) return qemuMonitorJSONQueryQMPSchema(mon); } + + +void +qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info) +{ + if (!info) + return; + + VIR_FREE(info); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index c3d3f2fb3..c4d247e79 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -70,6 +70,34 @@ struct _qemuMonitorMessage { void *passwordOpaque; }; +typedef enum { + QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE =3D 0, + QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV, + + QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST +} qemuMonitorEventPanicInfoType; + +typedef struct _qemuMonitorEventPanicInfoHyperv qemuMonitorEventPanicInfoH= yperv; +typedef qemuMonitorEventPanicInfoHyperv *qemuMonitorEventPanicInfoHypervPt= r; +struct _qemuMonitorEventPanicInfoHyperv { + /* Hyper-V specific guest panic information (HV crash MSRs) */ + unsigned long long arg1; + unsigned long long arg2; + unsigned long long arg3; + unsigned long long arg4; + unsigned long long arg5; +}; + +typedef struct _qemuMonitorEventPanicInfo qemuMonitorEventPanicInfo; +typedef qemuMonitorEventPanicInfo *qemuMonitorEventPanicInfoPtr; +struct _qemuMonitorEventPanicInfo { + qemuMonitorEventPanicInfoType type; + union { + qemuMonitorEventPanicInfoHyperv hyperv; + } data; +}; + +void qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info); typedef void (*qemuMonitorDestroyCallback)(qemuMonitorPtr mon, virDomainObjPtr vm, @@ -167,6 +195,7 @@ typedef int (*qemuMonitorDomainPMSuspendDiskCallback)(q= emuMonitorPtr mon, void *opaque); typedef int (*qemuMonitorDomainGuestPanicCallback)(qemuMonitorPtr mon, virDomainObjPtr vm, + qemuMonitorEventPanicIn= foPtr info, void *opaque); typedef int (*qemuMonitorDomainDeviceDeletedCallback)(qemuMonitorPtr mon, virDomainObjPtr vm, @@ -337,7 +366,8 @@ int qemuMonitorEmitBlockJob(qemuMonitorPtr mon, int qemuMonitorEmitBalloonChange(qemuMonitorPtr mon, unsigned long long actual); int qemuMonitorEmitPMSuspendDisk(qemuMonitorPtr mon); -int qemuMonitorEmitGuestPanic(qemuMonitorPtr mon); +int qemuMonitorEmitGuestPanic(qemuMonitorPtr mon, + qemuMonitorEventPanicInfoPtr info); int qemuMonitorEmitDeviceDeleted(qemuMonitorPtr mon, const char *devAlias); int qemuMonitorEmitNicRxFilterChanged(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 553544aea..d75748bd8 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -546,11 +546,63 @@ static void qemuMonitorJSONHandleResume(qemuMonitorPt= r mon, virJSONValuePtr data qemuMonitorEmitResume(mon); } -static void qemuMonitorJSONHandleGuestPanic(qemuMonitorPtr mon, virJSONVal= uePtr data ATTRIBUTE_UNUSED) + +static qemuMonitorEventPanicInfoPtr +qemuMonitorJSONGuestPanicExtractInfoHyperv(virJSONValuePtr data) +{ + qemuMonitorEventPanicInfoPtr ret; + + if (VIR_ALLOC(ret) < 0) + return NULL; + + ret->type =3D QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV; + + if (virJSONValueObjectGetNumberUlong(data, "arg1", &ret->data.hyperv.a= rg1) < 0 || + virJSONValueObjectGetNumberUlong(data, "arg2", &ret->data.hyperv.a= rg2) < 0 || + virJSONValueObjectGetNumberUlong(data, "arg3", &ret->data.hyperv.a= rg3) < 0 || + virJSONValueObjectGetNumberUlong(data, "arg4", &ret->data.hyperv.a= rg4) < 0 || + virJSONValueObjectGetNumberUlong(data, "arg5", &ret->data.hyperv.a= rg5) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed hyperv panic data")); + goto error; + } + + return ret; + + error: + qemuMonitorEventPanicInfoFree(ret); + return NULL; +} + + +static qemuMonitorEventPanicInfoPtr +qemuMonitorJSONGuestPanicExtractInfo(virJSONValuePtr data) { - qemuMonitorEmitGuestPanic(mon); + const char *type =3D virJSONValueObjectGetString(data, "type"); + + if (STREQ_NULLABLE(type, "hyper-v")) + return qemuMonitorJSONGuestPanicExtractInfoHyperv(data); + + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown panic info type '%s'"), NULLSTR(type)); + return NULL; } + +static void +qemuMonitorJSONHandleGuestPanic(qemuMonitorPtr mon, + virJSONValuePtr data) +{ + virJSONValuePtr infojson =3D virJSONValueObjectGetObject(data, "info"); + qemuMonitorEventPanicInfoPtr info =3D NULL; + + if (infojson) + info =3D qemuMonitorJSONGuestPanicExtractInfo(infojson); + + qemuMonitorEmitGuestPanic(mon, info); +} + + static void qemuMonitorJSONHandleRTCChange(qemuMonitorPtr mon, virJSONValu= ePtr data) { long long offset =3D 0; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ec0e36d2e..6a73dd464 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1297,6 +1297,7 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon ATT= RIBUTE_UNUSED, static int qemuProcessHandleGuestPanic(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virDomainObjPtr vm, + qemuMonitorEventPanicInfoPtr info, void *opaque) { virQEMUDriverPtr driver =3D opaque; @@ -1309,6 +1310,7 @@ qemuProcessHandleGuestPanic(qemuMonitorPtr mon ATTRIB= UTE_UNUSED, processEvent->eventType =3D QEMU_PROCESS_EVENT_GUESTPANIC; processEvent->action =3D vm->def->onCrash; processEvent->vm =3D vm; + processEvent->data =3D info; /* Hold an extra reference because we can't allow 'vm' to be * deleted before handling guest panic event is finished. */ --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 08:45:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1490082436388482.9799134478026; Tue, 21 Mar 2017 00:47:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8131F6AACA; Tue, 21 Mar 2017 07:47:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 54835C0A2C; Tue, 21 Mar 2017 07:47:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 058524E9BE; Tue, 21 Mar 2017 07:47:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2L7l0qr016415 for ; Tue, 21 Mar 2017 03:47:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 482431713A; Tue, 21 Mar 2017 07:47:00 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 700D47FE38; Tue, 21 Mar 2017 07:46:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8131F6AACA Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8131F6AACA From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 21 Mar 2017 08:47:50 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 4/4] qemu: Log additional data from hyperv crash notifier X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 21 Mar 2017 07:47:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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=3D1426176 --- 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 =3D NULL; + + switch (info->type) { + case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV: + ignore_value(virAsprintf(&ret, "hyper-v: arg1=3D'0x%llx', arg2=3D'= 0x%llx', " + "arg3=3D'0x%llx', arg4=3D'0x%llx', " + "arg5=3D'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 =3D qemuProcessGuestPanicEventInfoFormatData(info); + char *timestamp =3D 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 =3D vm->privateData; virObjectEventPtr event =3D NULL; @@ -3990,6 +4036,9 @@ processGuestPanicEvent(virQEMUDriverPtr driver, goto endjob; } + if (info) + qemuProcessGuestPanicEventInfo(driver, vm, info); + virDomainObjSetState(vm, VIR_DOMAIN_CRASHED, VIR_DOMAIN_CRASHED_PANICK= ED); event =3D 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); --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list