From patchwork Mon Feb 27 03:05:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Congyang X-Patchwork-Id: 143145 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 26D99B6FC4 for ; Mon, 27 Feb 2012 14:05:14 +1100 (EST) Received: from localhost ([::1]:59248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1qtk-0007HB-3s for incoming@patchwork.ozlabs.org; Sun, 26 Feb 2012 22:05:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1qta-0007E5-TY for qemu-devel@nongnu.org; Sun, 26 Feb 2012 22:05:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S1qtX-0005Yv-V6 for qemu-devel@nongnu.org; Sun, 26 Feb 2012 22:05:02 -0500 Received: from [222.73.24.84] (port=60041 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1qtX-0005Yf-Da for qemu-devel@nongnu.org; Sun, 26 Feb 2012 22:04:59 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 9E731170154; Mon, 27 Feb 2012 11:04:58 +0800 (CST) Received: from mailserver.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id q1R34v33012462; Mon, 27 Feb 2012 11:04:57 +0800 Received: from [10.167.225.226] ([10.167.225.226]) by mailserver.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2012022711031203-782658 ; Mon, 27 Feb 2012 11:03:12 +0800 Message-ID: <4F4AF316.50400@cn.fujitsu.com> Date: Mon, 27 Feb 2012 11:05:58 +0800 From: Wen Congyang User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100413 Fedora/3.0.4-2.fc13 Thunderbird/3.0.4 MIME-Version: 1.0 To: kvm list , Avi Kivity , KAMEZAWA Hiroyuki , "Daniel P. Berrange" , linux-kernel@vger.kernel.org, qemu-devel References: <4F4AF1FB.6000903@cn.fujitsu.com> In-Reply-To: <4F4AF1FB.6000903@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2012-02-27 11:03:12, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2012-02-27 11:03:12, Serialize complete at 2012-02-27 11:03:12 X-detected-operating-system: by eggs.gnu.org: FreeBSD 6.x (1) X-Received-From: 222.73.24.84 Subject: [Qemu-devel] [PATCH]qemu: deal with guest paniced event X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When the host knows the guest is paniced, it will set exit_reason to KVM_EXIT_GUEST_PANIC. So if qemu receive this exit_reason, we can send a event to tell management application that the guest is paniced. Signed-off-by: Wen Congyang --- kvm-all.c | 3 +++ linux-headers/linux/kvm.h | 1 + monitor.c | 3 +++ monitor.h | 1 + 4 files changed, 8 insertions(+), 0 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index c4babda..ae428ab 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1190,6 +1190,9 @@ int kvm_cpu_exec(CPUState *env) (uint64_t)run->hw.hardware_exit_reason); ret = -1; break; + case KVM_EXIT_GUEST_PANIC: + monitor_protocol_event(QEVENT_GUEST_PANICED, NULL); + break; case KVM_EXIT_INTERNAL_ERROR: ret = kvm_handle_internal_error(env, run); break; diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index f6b5343..45dd031 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -163,6 +163,7 @@ struct kvm_pit_config { #define KVM_EXIT_OSI 18 #define KVM_EXIT_PAPR_HCALL 19 #define KVM_EXIT_S390_UCONTROL 20 +#define KVM_EXIT_GUEST_PANIC 21 /* For KVM_EXIT_INTERNAL_ERROR */ #define KVM_INTERNAL_ERROR_EMULATION 1 diff --git a/monitor.c b/monitor.c index 953e748..9802792 100644 --- a/monitor.c +++ b/monitor.c @@ -494,6 +494,9 @@ void monitor_protocol_event(MonitorEvent event, QObject *data) case QEVENT_WAKEUP: event_name = "WAKEUP"; break; + case QEVENT_GUEST_PANICED: + event_name = "GUEST_PANICED"; + break; default: abort(); break; diff --git a/monitor.h b/monitor.h index 0d49800..a62da93 100644 --- a/monitor.h +++ b/monitor.h @@ -41,6 +41,7 @@ typedef enum MonitorEvent { QEVENT_DEVICE_TRAY_MOVED, QEVENT_SUSPEND, QEVENT_WAKEUP, + QEVENT_GUEST_PANICED, QEVENT_MAX, } MonitorEvent;