From nobody Thu May 2 23:19:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487615053018165.69567403508506; Mon, 20 Feb 2017 10:24:13 -0800 (PST) Received: from localhost ([::1]:40326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfsd7-00033w-MG for importer@patchew.org; Mon, 20 Feb 2017 13:24:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfsb7-0001Yf-Mh for qemu-devel@nongnu.org; Mon, 20 Feb 2017 13:22:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cfsb2-00044n-VU for qemu-devel@nongnu.org; Mon, 20 Feb 2017 13:22:05 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:9778 helo=relay.sw.ru) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cfsb2-00043J-Ju for qemu-devel@nongnu.org; Mon, 20 Feb 2017 13:22:00 -0500 Received: from hades.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id v1KILt0d017342; Mon, 20 Feb 2017 21:21:56 +0300 (MSK) From: "Denis V. Lunev" To: qemu-devel@nongnu.org Date: Mon, 20 Feb 2017 21:21:53 +0300 Message-Id: <1487614915-18710-2-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1487614915-18710-1-git-send-email-den@openvz.org> References: <1487614915-18710-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x [fuzzy] X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH 1/3] i386/cpu: release GuestPanicInformation memory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: den@openvz.org, Anton Nefedov , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Anton Nefedov Do not make some foreign function do it. Signed-off-by: Anton Nefedov Signed-off-by: Denis V. Lunev CC: Paolo Bonzini CC: Eric Blake --- kvm-all.c | 5 ++++- vl.c | 22 +++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 0c94637..ac07902 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1909,6 +1909,7 @@ int kvm_cpu_exec(CPUState *cpu) =20 do { MemTxAttrs attrs; + GuestPanicInformation *crash_info; =20 if (cpu->kvm_vcpu_dirty) { kvm_arch_put_registers(cpu, KVM_PUT_RUNTIME_STATE); @@ -2001,9 +2002,11 @@ int kvm_cpu_exec(CPUState *cpu) break; case KVM_SYSTEM_EVENT_CRASH: kvm_cpu_synchronize_state(cpu); + crash_info =3D cpu_get_crash_info(cpu); qemu_mutex_lock_iothread(); - qemu_system_guest_panicked(cpu_get_crash_info(cpu)); + qemu_system_guest_panicked(crash_info); qemu_mutex_unlock_iothread(); + qapi_free_GuestPanicInformation(crash_info); ret =3D 0; break; default: diff --git a/vl.c b/vl.c index 27d9829..81382b6 100644 --- a/vl.c +++ b/vl.c @@ -1682,6 +1682,15 @@ void qemu_system_reset(bool report) void qemu_system_guest_panicked(GuestPanicInformation *info) { qemu_log_mask(LOG_GUEST_ERROR, "Guest crashed\n"); + if (info && info->type =3D=3D GUEST_PANIC_INFORMATION_KIND_HYPER_V) { + qemu_log_mask(LOG_GUEST_ERROR, "HV crash parameters: (%#"PRIx64 + " %#"PRIx64" %#"PRIx64" %#"PRIx64" %#"PRIx64")\n", + info->u.hyper_v.data->arg1, + info->u.hyper_v.data->arg2, + info->u.hyper_v.data->arg3, + info->u.hyper_v.data->arg4, + info->u.hyper_v.data->arg5); + } =20 if (current_cpu) { current_cpu->crash_occurred =3D true; @@ -1694,19 +1703,6 @@ void qemu_system_guest_panicked(GuestPanicInformatio= n *info) !!info, info, &error_abort); qemu_system_shutdown_request(); } - - if (info) { - if (info->type =3D=3D GUEST_PANIC_INFORMATION_KIND_HYPER_V) { - qemu_log_mask(LOG_GUEST_ERROR, "HV crash parameters: (%#"PRIx64 - " %#"PRIx64" %#"PRIx64" %#"PRIx64" %#"PRIx64")\n= ", - info->u.hyper_v.data->arg1, - info->u.hyper_v.data->arg2, - info->u.hyper_v.data->arg3, - info->u.hyper_v.data->arg4, - info->u.hyper_v.data->arg5); - } - qapi_free_GuestPanicInformation(info); - } } =20 void qemu_system_reset_request(void) --=20 2.7.4 From nobody Thu May 2 23:19:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487615048515449.0621222570178; Mon, 20 Feb 2017 10:24:08 -0800 (PST) Received: from localhost ([::1]:40325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfsd5-00030a-6Z for importer@patchew.org; Mon, 20 Feb 2017 13:24:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfsb7-0001Yb-MT for qemu-devel@nongnu.org; Mon, 20 Feb 2017 13:22:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cfsb2-00044h-Qj for qemu-devel@nongnu.org; Mon, 20 Feb 2017 13:22:05 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:16869 helo=relay.sw.ru) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cfsb2-00043I-FO for qemu-devel@nongnu.org; Mon, 20 Feb 2017 13:22:00 -0500 Received: from hades.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id v1KILt0e017342; Mon, 20 Feb 2017 21:21:56 +0300 (MSK) From: "Denis V. Lunev" To: qemu-devel@nongnu.org Date: Mon, 20 Feb 2017 21:21:54 +0300 Message-Id: <1487614915-18710-3-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1487614915-18710-1-git-send-email-den@openvz.org> References: <1487614915-18710-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x [fuzzy] X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH 2/3] qapi: flatten GuestPanicInformation union X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: den@openvz.org, Anton Nefedov , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Anton Nefedov Signed-off-by: Anton Nefedov Signed-off-by: Denis V. Lunev CC: Paolo Bonzini CC: Eric Blake Reviewed-by: Eric Blake --- qapi-schema.json | 12 ++++++++++++ target/i386/cpu.c | 15 ++++++--------- vl.c | 12 ++++++------ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index e9a6364..b142e15 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -5872,6 +5872,16 @@ 'data': [ 'pause', 'poweroff' ] } =20 ## +# @GuestPanicInformationType: +# +# An enumeration of the guest panic information types +# +# Since: 2.9 +## +{ 'enum': 'GuestPanicInformationType', + 'data': [ 'hyper-v'] } + +## # @GuestPanicInformation: # # Information about a guest panic @@ -5879,6 +5889,8 @@ # Since: 2.9 ## {'union': 'GuestPanicInformation', + 'base': {'type': 'GuestPanicInformationType'}, + 'discriminator': 'type', 'data': { 'hyper-v': 'GuestPanicInformationHyperV' } } =20 ## diff --git a/target/i386/cpu.c b/target/i386/cpu.c index fd7add2..63be816 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3502,19 +3502,16 @@ static GuestPanicInformation *x86_cpu_get_crash_inf= o(CPUState *cs) GuestPanicInformation *panic_info =3D NULL; =20 if (env->features[FEAT_HYPERV_EDX] & HV_X64_GUEST_CRASH_MSR_AVAILABLE)= { - GuestPanicInformationHyperV *panic_info_hv =3D - g_malloc0(sizeof(GuestPanicInformationHyperV)); panic_info =3D g_malloc0(sizeof(GuestPanicInformation)); =20 - panic_info->type =3D GUEST_PANIC_INFORMATION_KIND_HYPER_V; - panic_info->u.hyper_v.data =3D panic_info_hv; + panic_info->type =3D GUEST_PANIC_INFORMATION_TYPE_HYPER_V; =20 assert(HV_X64_MSR_CRASH_PARAMS >=3D 5); - panic_info_hv->arg1 =3D env->msr_hv_crash_params[0]; - panic_info_hv->arg2 =3D env->msr_hv_crash_params[1]; - panic_info_hv->arg3 =3D env->msr_hv_crash_params[2]; - panic_info_hv->arg4 =3D env->msr_hv_crash_params[3]; - panic_info_hv->arg5 =3D env->msr_hv_crash_params[4]; + panic_info->u.hyper_v.arg1 =3D env->msr_hv_crash_params[0]; + panic_info->u.hyper_v.arg2 =3D env->msr_hv_crash_params[1]; + panic_info->u.hyper_v.arg3 =3D env->msr_hv_crash_params[2]; + panic_info->u.hyper_v.arg4 =3D env->msr_hv_crash_params[3]; + panic_info->u.hyper_v.arg5 =3D env->msr_hv_crash_params[4]; } =20 return panic_info; diff --git a/vl.c b/vl.c index 81382b6..2781716 100644 --- a/vl.c +++ b/vl.c @@ -1682,14 +1682,14 @@ void qemu_system_reset(bool report) void qemu_system_guest_panicked(GuestPanicInformation *info) { qemu_log_mask(LOG_GUEST_ERROR, "Guest crashed\n"); - if (info && info->type =3D=3D GUEST_PANIC_INFORMATION_KIND_HYPER_V) { + if (info && info->type =3D=3D GUEST_PANIC_INFORMATION_TYPE_HYPER_V) { qemu_log_mask(LOG_GUEST_ERROR, "HV crash parameters: (%#"PRIx64 " %#"PRIx64" %#"PRIx64" %#"PRIx64" %#"PRIx64")\n", - info->u.hyper_v.data->arg1, - info->u.hyper_v.data->arg2, - info->u.hyper_v.data->arg3, - info->u.hyper_v.data->arg4, - info->u.hyper_v.data->arg5); + info->u.hyper_v.arg1, + info->u.hyper_v.arg2, + info->u.hyper_v.arg3, + info->u.hyper_v.arg4, + info->u.hyper_v.arg5); } =20 if (current_cpu) { --=20 2.7.4 From nobody Thu May 2 23:19:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14876150485491000.8269214935101; Mon, 20 Feb 2017 10:24:08 -0800 (PST) Received: from localhost ([::1]:40323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfsd5-00030F-5C for importer@patchew.org; Mon, 20 Feb 2017 13:24:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfsb7-0001Ye-Mf for qemu-devel@nongnu.org; Mon, 20 Feb 2017 13:22:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cfsb3-00044t-Gc for qemu-devel@nongnu.org; Mon, 20 Feb 2017 13:22:05 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:45851 helo=relay.sw.ru) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cfsb3-00043K-5V for qemu-devel@nongnu.org; Mon, 20 Feb 2017 13:22:01 -0500 Received: from hades.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id v1KILt0f017342; Mon, 20 Feb 2017 21:21:56 +0300 (MSK) From: "Denis V. Lunev" To: qemu-devel@nongnu.org Date: Mon, 20 Feb 2017 21:21:55 +0300 Message-Id: <1487614915-18710-4-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1487614915-18710-1-git-send-email-den@openvz.org> References: <1487614915-18710-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x [fuzzy] X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH 3/3] qmp-events: fix GUEST_PANICKED description formatting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: den@openvz.org, Anton Nefedov , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Anton Nefedov Signed-off-by: Anton Nefedov Signed-off-by: Denis V. Lunev CC: Paolo Bonzini CC: Eric Blake Reviewed-by: Eric Blake --- qapi/event.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qapi/event.json b/qapi/event.json index 970ff02..e02852c 100644 --- a/qapi/event.json +++ b/qapi/event.json @@ -488,9 +488,9 @@ # # @action: action that has been taken, currently always "pause" # -# @info: optional information about a panic +# @info: #optional information about a panic (since 2.9) # -# Since: 1.5 (@info since 2.9) +# Since: 1.5 # # Example: # --=20 2.7.4