From patchwork Fri Jul 6 09:41:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Congyang X-Patchwork-Id: 169399 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 085D82C01D3 for ; Fri, 6 Jul 2012 19:56:25 +1000 (EST) Received: from localhost ([::1]:51282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sn5Gx-00005c-KW for incoming@patchwork.ozlabs.org; Fri, 06 Jul 2012 05:56:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sn5Gp-000058-3u for qemu-devel@nongnu.org; Fri, 06 Jul 2012 05:56:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sn5Gi-0006bS-UF for qemu-devel@nongnu.org; Fri, 06 Jul 2012 05:56:14 -0400 Received: from [222.73.24.84] (port=15373 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sn5Gi-0006b9-Iu for qemu-devel@nongnu.org; Fri, 06 Jul 2012 05:56:08 -0400 X-IronPort-AV: E=Sophos;i="4.77,537,1336320000"; d="scan'208";a="5344263" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 06 Jul 2012 17:55:14 +0800 Received: from fnstmail02.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 q669bWIj012120; Fri, 6 Jul 2012 17:37:33 +0800 Received: from [10.167.225.226] ([10.167.225.226]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012070617373027-560488 ; Fri, 6 Jul 2012 17:37:30 +0800 Message-ID: <4FF6B2E7.2060405@cn.fujitsu.com> Date: Fri, 06 Jul 2012 17:41:59 +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 , qemu-devel , "linux-kernel@vger.kernel.org" , Avi Kivity , "Daniel P. Berrange" , KAMEZAWA Hiroyuki , Jan Kiszka , Gleb Natapov References: <4FF6B188.2060607@cn.fujitsu.com> In-Reply-To: <4FF6B188.2060607@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/07/06 17:37:30, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/07/06 17:37:37, Serialize complete at 2012/07/06 17:37:37 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Subject: [Qemu-devel] [PATCH 7/7 v6] deal with panicked event accoring to '-machine panic_action=action' 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 The action is the same as -onpanic parameter. Signed-off-by: Wen Congyang --- qemu-config.c | 4 ++++ qemu-options.hx | 4 +++- vl.c | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletions(-) diff --git a/qemu-config.c b/qemu-config.c index 5c3296b..805e7c4 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -595,6 +595,10 @@ static QemuOptsList qemu_machine_opts = { .name = "dt_compatible", .type = QEMU_OPT_STRING, .help = "Overrides the \"compatible\" property of the dt root node", + }, { + .name = "panic_action", + .type = QEMU_OPT_STRING, + .help = "The action what QEMU will do when the guest is panicked", }, { /* End of list */ } }, diff --git a/qemu-options.hx b/qemu-options.hx index 4a061bf..083a21d 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -33,7 +33,9 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " property accel=accel1[:accel2[:...]] selects accelerator\n" " supported accelerators are kvm, xen, tcg (default: tcg)\n" " kernel_irqchip=on|off controls accelerated irqchip support\n" - " kvm_shadow_mem=size of KVM shadow MMU\n", + " kvm_shadow_mem=size of KVM shadow MMU\n" + " panic_action=none|pause|poweroff|reset controls what QEmu\n" + " will do when the guest is panicked", QEMU_ARCH_ALL) STEXI @item -machine [type=]@var{name}[,prop=@var{value}[,...]] diff --git a/vl.c b/vl.c index 1a68257..091c43b 100644 --- a/vl.c +++ b/vl.c @@ -2301,6 +2301,7 @@ int main(int argc, char **argv, char **envp) }; const char *trace_events = NULL; const char *trace_file = NULL; + const char *panic_action = NULL; atexit(qemu_run_exit_notifiers); error_set_progname(argv[0]); @@ -3372,10 +3373,16 @@ int main(int argc, char **argv, char **envp) kernel_filename = qemu_opt_get(machine_opts, "kernel"); initrd_filename = qemu_opt_get(machine_opts, "initrd"); kernel_cmdline = qemu_opt_get(machine_opts, "append"); + panic_action = qemu_opt_get(machine_opts, "panic_action"); } else { kernel_filename = initrd_filename = kernel_cmdline = NULL; } + if (panic_action && select_panicked_action(panic_action) == -1) { + fprintf(stderr, "Unknown -panic_action parameter\n"); + exit(1); + } + if (!kernel_cmdline) { kernel_cmdline = ""; }