All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Wen Congyang <wency@cn.fujitsu.com>
Cc: 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>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Gleb Natapov <gleb@redhat.com>
Subject: Re: [PATCH 5/7 v6] introduce a new qom device to deal with panicked event
Date: Wed, 18 Jul 2012 11:19:31 +0200	[thread overview]
Message-ID: <50067FA3.3060107@siemens.com> (raw)
In-Reply-To: <5006175A.8040005@cn.fujitsu.com>

On 2012-07-18 03:54, Wen Congyang wrote:
> At 07/06/2012 07:05 PM, Jan Kiszka Wrote:
>> On 2012-07-06 11:41, Wen Congyang wrote:
>>> If the target is x86/x86_64, the guest's kernel will write 0x01 to the
>>> port KVM_PV_PORT when it is panciked. This patch introduces a new qom
>>> device kvm_pv_ioport to listen this I/O port, and deal with panicked
>>> event according to panicked_action's value. The possible actions are:
>>> 1. emit QEVENT_GUEST_PANICKED only
>>> 2. emit QEVENT_GUEST_PANICKED and pause the guest
>>> 3. emit QEVENT_GUEST_PANICKED and poweroff the guest
>>> 4. emit QEVENT_GUEST_PANICKED and reset the guest
>>>
>>> I/O ports does not work for some targets(for example: s390). And you
>>> can implement another qom device, and include it's code into pv_event.c
>>> for such target.
>>>
>>> Note: if we emit QEVENT_GUEST_PANICKED only, and the management
>>> application does not receive this event(the management may not
>>> run when the event is emitted), the management won't know the
>>> guest is panicked.
>>>
>>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>>> ---
>>>  hw/kvm/Makefile.objs |    2 +-
>>>  hw/kvm/pv_event.c    |   73 +++++++++++++++++++++++++++
>>>  hw/kvm/pv_ioport.c   |  133 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>>  kvm-stub.c           |    9 +++
>>>  kvm.h                |    3 +
>>>  vl.c                 |    4 ++
>>>  6 files changed, 223 insertions(+), 1 deletions(-)
>>>  create mode 100644 hw/kvm/pv_event.c
>>>  create mode 100644 hw/kvm/pv_ioport.c
>>>
>>> diff --git a/hw/kvm/Makefile.objs b/hw/kvm/Makefile.objs
>>> index 226497a..23e3b30 100644
>>> --- a/hw/kvm/Makefile.objs
>>> +++ b/hw/kvm/Makefile.objs
>>> @@ -1 +1 @@
>>> -obj-$(CONFIG_KVM) += clock.o apic.o i8259.o ioapic.o i8254.o
>>> +obj-$(CONFIG_KVM) += clock.o apic.o i8259.o ioapic.o i8254.o pv_event.o
>>> diff --git a/hw/kvm/pv_event.c b/hw/kvm/pv_event.c
>>> new file mode 100644
>>> index 0000000..d7ded37
>>> --- /dev/null
>>> +++ b/hw/kvm/pv_event.c
>>> @@ -0,0 +1,73 @@
>>> +/*
>>> + * QEMU KVM support, paravirtual event device
>>> + *
>>> + * Copyright Fujitsu, Corp. 2012
>>> + *
>>> + * Authors:
>>> + *     Wen Congyang <wency@cn.fujitsu.com>
>>> + *
>>> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
>>> + * See the COPYING file in the top-level directory.
>>> + *
>>> + */
>>> +
>>> +#include <linux/kvm_para.h>
>>> +#include <asm/kvm_para.h>
>>> +#include <qobject.h>
>>> +#include <qjson.h>
>>> +#include <monitor.h>
>>> +#include <sysemu.h>
>>> +#include <kvm.h>
>>> +
>>> +/* Possible values for action parameter. */
>>> +#define PANICKED_REPORT     1   /* emit QEVENT_GUEST_PANICKED only */
>>> +#define PANICKED_PAUSE      2   /* emit QEVENT_GUEST_PANICKED and pause VM */
>>> +#define PANICKED_POWEROFF   3   /* emit QEVENT_GUEST_PANICKED and quit VM */
>>> +#define PANICKED_RESET      4   /* emit QEVENT_GUEST_PANICKED and reset VM */
>>> +
>>> +static int panicked_action = PANICKED_REPORT;
>>
>> Avoid global variables please when there are device states. This one is
>> unneeded anyway (and will generate warnings when build without KVM_PV_PORT).
> 
> Hmm, do you mean introduce another qom device to store event action?

I think you should be fine with one device per bus binding, but those
will consist of a common event layer and just different I/O layers (for
bus registration and access).

Jan

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



WARNING: multiple messages have this Message-ID (diff)
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: [Qemu-devel] [PATCH 5/7 v6] introduce a new qom device to deal with panicked event
Date: Wed, 18 Jul 2012 11:19:31 +0200	[thread overview]
Message-ID: <50067FA3.3060107@siemens.com> (raw)
In-Reply-To: <5006175A.8040005@cn.fujitsu.com>

On 2012-07-18 03:54, Wen Congyang wrote:
> At 07/06/2012 07:05 PM, Jan Kiszka Wrote:
>> On 2012-07-06 11:41, Wen Congyang wrote:
>>> If the target is x86/x86_64, the guest's kernel will write 0x01 to the
>>> port KVM_PV_PORT when it is panciked. This patch introduces a new qom
>>> device kvm_pv_ioport to listen this I/O port, and deal with panicked
>>> event according to panicked_action's value. The possible actions are:
>>> 1. emit QEVENT_GUEST_PANICKED only
>>> 2. emit QEVENT_GUEST_PANICKED and pause the guest
>>> 3. emit QEVENT_GUEST_PANICKED and poweroff the guest
>>> 4. emit QEVENT_GUEST_PANICKED and reset the guest
>>>
>>> I/O ports does not work for some targets(for example: s390). And you
>>> can implement another qom device, and include it's code into pv_event.c
>>> for such target.
>>>
>>> Note: if we emit QEVENT_GUEST_PANICKED only, and the management
>>> application does not receive this event(the management may not
>>> run when the event is emitted), the management won't know the
>>> guest is panicked.
>>>
>>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>>> ---
>>>  hw/kvm/Makefile.objs |    2 +-
>>>  hw/kvm/pv_event.c    |   73 +++++++++++++++++++++++++++
>>>  hw/kvm/pv_ioport.c   |  133 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>>  kvm-stub.c           |    9 +++
>>>  kvm.h                |    3 +
>>>  vl.c                 |    4 ++
>>>  6 files changed, 223 insertions(+), 1 deletions(-)
>>>  create mode 100644 hw/kvm/pv_event.c
>>>  create mode 100644 hw/kvm/pv_ioport.c
>>>
>>> diff --git a/hw/kvm/Makefile.objs b/hw/kvm/Makefile.objs
>>> index 226497a..23e3b30 100644
>>> --- a/hw/kvm/Makefile.objs
>>> +++ b/hw/kvm/Makefile.objs
>>> @@ -1 +1 @@
>>> -obj-$(CONFIG_KVM) += clock.o apic.o i8259.o ioapic.o i8254.o
>>> +obj-$(CONFIG_KVM) += clock.o apic.o i8259.o ioapic.o i8254.o pv_event.o
>>> diff --git a/hw/kvm/pv_event.c b/hw/kvm/pv_event.c
>>> new file mode 100644
>>> index 0000000..d7ded37
>>> --- /dev/null
>>> +++ b/hw/kvm/pv_event.c
>>> @@ -0,0 +1,73 @@
>>> +/*
>>> + * QEMU KVM support, paravirtual event device
>>> + *
>>> + * Copyright Fujitsu, Corp. 2012
>>> + *
>>> + * Authors:
>>> + *     Wen Congyang <wency@cn.fujitsu.com>
>>> + *
>>> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
>>> + * See the COPYING file in the top-level directory.
>>> + *
>>> + */
>>> +
>>> +#include <linux/kvm_para.h>
>>> +#include <asm/kvm_para.h>
>>> +#include <qobject.h>
>>> +#include <qjson.h>
>>> +#include <monitor.h>
>>> +#include <sysemu.h>
>>> +#include <kvm.h>
>>> +
>>> +/* Possible values for action parameter. */
>>> +#define PANICKED_REPORT     1   /* emit QEVENT_GUEST_PANICKED only */
>>> +#define PANICKED_PAUSE      2   /* emit QEVENT_GUEST_PANICKED and pause VM */
>>> +#define PANICKED_POWEROFF   3   /* emit QEVENT_GUEST_PANICKED and quit VM */
>>> +#define PANICKED_RESET      4   /* emit QEVENT_GUEST_PANICKED and reset VM */
>>> +
>>> +static int panicked_action = PANICKED_REPORT;
>>
>> Avoid global variables please when there are device states. This one is
>> unneeded anyway (and will generate warnings when build without KVM_PV_PORT).
> 
> Hmm, do you mean introduce another qom device to store event action?

I think you should be fine with one device per bus binding, but those
will consist of a common event layer and just different I/O layers (for
bus registration and access).

Jan

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

  reply	other threads:[~2012-07-18  9:20 UTC|newest]

Thread overview: 44+ 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:36 ` [Qemu-devel] " Wen Congyang
2012-07-06  9:38 ` [PATCH 1/7 v6] start vm after reseting it Wen Congyang
2012-07-06  9:38   ` [Qemu-devel] " Wen Congyang
2012-07-06  9:38 ` [PATCH 2/7 v6] update linux headers Wen Congyang
2012-07-06  9:38   ` [Qemu-devel] " Wen Congyang
2012-07-06 10:25   ` Jan Kiszka
2012-07-06 10:25     ` [Qemu-devel] " Jan Kiszka
2012-07-06 10:50     ` Wen Congyang
2012-07-06 10:50       ` [Qemu-devel] " Wen Congyang
2012-07-06 10:50       ` Wen Congyang
2012-07-06 10:55       ` [Qemu-devel] " 陳韋任 (Wei-Ren Chen)
2012-07-06 10:55         ` 陳韋任 (Wei-Ren Chen)
2012-07-06 11:16       ` Jan Kiszka
2012-07-06 11:16         ` [Qemu-devel] " Jan Kiszka
2012-07-07 14:35   ` Paul Gortmaker
2012-07-07 14:35     ` [Qemu-devel] " 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:39   ` [Qemu-devel] " Wen Congyang
2012-07-06  9:40 ` [PATCH 4/7 v6] add a new qevent: QEVENT_GUEST_PANICKED Wen Congyang
2012-07-06  9:40   ` [Qemu-devel] " 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  9:41   ` [Qemu-devel] " Wen Congyang
2012-07-06 11:05   ` Jan Kiszka
2012-07-06 11:05     ` [Qemu-devel] " Jan Kiszka
2012-07-06 11:05     ` Jan Kiszka
2012-07-18  1:54     ` Wen Congyang
2012-07-18  1:54       ` [Qemu-devel] " Wen Congyang
2012-07-18  9:19       ` Jan Kiszka [this message]
2012-07-18  9:19         ` Jan Kiszka
2012-07-18  9:25         ` Jan Kiszka
2012-07-18  9:25           ` [Qemu-devel] " 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  9:41   ` [Qemu-devel] " Wen Congyang
2012-07-06 11:12   ` Jan Kiszka
2012-07-06 11:12     ` [Qemu-devel] " Jan Kiszka
2012-07-06 11:12     ` Jan Kiszka
2012-07-06  9:41 ` [PATCH 7/7 v6] deal with panicked event accoring to '-machine panic_action=action' Wen Congyang
2012-07-06  9:41   ` [Qemu-devel] " Wen Congyang
2012-07-06 11:09   ` Jan Kiszka
2012-07-06 11:09     ` [Qemu-devel] " Jan Kiszka
2012-07-06 11:09     ` Jan Kiszka
2012-07-09 10:44     ` Wen Congyang
2012-07-09 10:44       ` [Qemu-devel] " 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=50067FA3.3060107@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@redhat.com \
    --cc=berrange@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.