public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Wen Congyang <wency@cn.fujitsu.com>
Cc: Gleb Natapov <gleb@redhat.com>, kvm list <kvm@vger.kernel.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Avi Kivity <avi@redhat.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [PATCH 6/7 v6] deal with guest panicked event accoring to -onpanic parameter
Date: Fri, 06 Jul 2012 13:12:03 +0200	[thread overview]
Message-ID: <4FF6C803.5030502@siemens.com> (raw)
In-Reply-To: <4FF6B2C9.10302@cn.fujitsu.com>

On 2012-07-06 11:41, Wen Congyang wrote:
> The onpanic parameter can have the following value:
> 1. none
> 2. pause
> 3. poweroff
> 4. reset
> 
> The action for each value when the guest is panicked:
> 1. none: emit QEVENT_GUEST_PANICKED only
> 2. pause: emit QEVENT_GUEST_PANICKED and pause the guest
> 3. poweroff: emit QEVENT_GUEST_PANICKED and poweroff the guest
> 4. reset: emit QEVENT_GUEST_PANICKED and reset the guest

This is redundant to patch 7 and the preferred device property approach.

Jan

> 
> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> ---
>  hw/kvm/pv_event.c |   17 +++++++++++++++++
>  qemu-options.hx   |   15 +++++++++++++++
>  vl.c              |    6 ++++++
>  3 files changed, 38 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/kvm/pv_event.c b/hw/kvm/pv_event.c
> index d7ded37..890abcd 100644
> --- a/hw/kvm/pv_event.c
> +++ b/hw/kvm/pv_event.c
> @@ -59,6 +59,23 @@ static void panicked_perform_action(uint32_t panicked_action)
>      }
>  }
>  
> +int select_panicked_action(const char *p)
> +{
> +    if (strcasecmp(p, "none") == 0) {
> +        panicked_action = PANICKED_REPORT;
> +    } else if (strcasecmp(p, "pause") == 0) {
> +        panicked_action = PANICKED_PAUSE;
> +    } else if (strcasecmp(p, "poweroff") == 0) {
> +        panicked_action = PANICKED_POWEROFF;
> +    } else if (strcasecmp(p, "reset") == 0) {
> +        panicked_action = PANICKED_RESET;
> +    } else {
> +        return -1;
> +    }
> +
> +    return 0;
> +}
> +
>  #if defined(KVM_PV_PORT)
>  #include "pv_ioport.c"
>  
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 8b66264..4a061bf 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2743,6 +2743,21 @@ DEF("qtest-log", HAS_ARG, QEMU_OPTION_qtest_log,
>      "-qtest-log LOG  specify tracing options\n",
>      QEMU_ARCH_ALL)
>  
> +DEF("onpanic", HAS_ARG, QEMU_OPTION_onpanic, \
> +    "-onpanic none|pause|poweroff|reset\n" \
> +    "                action when the guest is panicked [default=none]",
> +    QEMU_ARCH_ALL)
> +STEXI
> +@item -onpanic @var{action}
> +
> +The @var{action} controls what QEmu will do when the guest is panicked.
> +The default is @code{none} (emit QEVENT_GUEST_PANICKED only).
> +Other possible actions are:
> +@code{pause} (emit QEVENT_GUEST_PANICKED and pause the guest),
> +@code{poweroff} (emit QEVENT_GUEST_PANICKED and forcefully poweroff the guest),
> +@code{reset} (emit QEVENT_GUEST_PANICKED and forcefully reset the guest).
> +ETEXI
> +
>  HXCOMM This is the last statement. Insert new options before this line!
>  STEXI
>  @end table
> diff --git a/vl.c b/vl.c
> index f5cd28d..1a68257 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3205,6 +3205,12 @@ int main(int argc, char **argv, char **envp)
>              case QEMU_OPTION_qtest_log:
>                  qtest_log = optarg;
>                  break;
> +            case QEMU_OPTION_onpanic:
> +                if (select_panicked_action(optarg) == -1) {
> +                    fprintf(stderr, "Unknown -onpanic parameter\n");
> +                    exit(1);
> +                }
> +                break;
>              default:
>                  os_parse_cmd_args(popt->index, optarg);
>              }
> 

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2012-07-06 11:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-06  9:36 [PATCH v6] kvm: notify host when the guest is panicked Wen Congyang
2012-07-06  9:38 ` [PATCH 1/7 v6] start vm after reseting it Wen Congyang
2012-07-06  9:38 ` [PATCH 2/7 v6] update linux headers Wen Congyang
2012-07-06 10:25   ` Jan Kiszka
2012-07-06 10:50     ` Wen Congyang
2012-07-06 10:55       ` [Qemu-devel] " 陳韋任 (Wei-Ren Chen)
2012-07-06 11:16       ` Jan Kiszka
2012-07-07 14:35   ` Paul Gortmaker
2012-07-06  9:39 ` [PATCH 3/7 v6] add a new runstate: RUN_STATE_GUEST_PANICKED Wen Congyang
2012-07-06  9:40 ` [PATCH 4/7 v6] add a new qevent: QEVENT_GUEST_PANICKED Wen Congyang
2012-07-06  9:41 ` [PATCH 5/7 v6] introduce a new qom device to deal with panicked event Wen Congyang
2012-07-06 11:05   ` Jan Kiszka
2012-07-18  1:54     ` Wen Congyang
2012-07-18  9:19       ` Jan Kiszka
2012-07-18  9:25         ` Jan Kiszka
2012-07-06  9:41 ` [PATCH 6/7 v6] deal with guest panicked event accoring to -onpanic parameter Wen Congyang
2012-07-06 11:12   ` Jan Kiszka [this message]
2012-07-06  9:41 ` [PATCH 7/7 v6] deal with panicked event accoring to '-machine panic_action=action' Wen Congyang
2012-07-06 11:09   ` Jan Kiszka
2012-07-09 10:44     ` Wen Congyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FF6C803.5030502@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wency@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox