linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hu Tao <hutao@cn.fujitsu.com>
To: Paolo Bonzini <pbonzini@redhat.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>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Blue Swirl <blauwirbel@gmail.com>, Eric Blake <eblake@redhat.com>,
	Andrew Jones <drjones@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Sasha Levin <levinsasha928@gmail.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	Orit Wasserman <owasserm@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>,
	Wen Congyang <wency@cn.fujitsu.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Alexander Graf <agraf@suse.de>,
	Alex Williamson <alex.williamson@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH v13 0/8] pv event interface between host and guest
Date: Wed, 6 Mar 2013 16:56:28 +0800	[thread overview]
Message-ID: <20130306085628.GB4719@localhost.localdomain> (raw)
In-Reply-To: <513471F1.5020702@redhat.com>

Hi,

On Mon, Mar 04, 2013 at 11:05:37AM +0100, Paolo Bonzini wrote:
> Il 03/03/2013 10:17, Gleb Natapov ha scritto:
> > On Thu, Feb 28, 2013 at 08:13:10PM +0800, Hu Tao wrote:
> >> This series implements a new interface, kvm pv event, to notify host when
> >> some events happen in guest. Right now there is one supported event: guest
> >> panic.
> >>
> > What other event do you have in mind? Is interface generic enough to
> > accommodate future, yet unknown, events. It allows to pass only one
> > integer specifying even type, what if additional info is needed? My be
> > stop pretending that device is generic and make it do once thing but do
> > it well? For generic even passing interface (whatever it may be needed
> > for) much more powerful virtio should be used.
> > 
> > On implementation itself I do not understand why is this kvm specific.
> > The only thing that makes it so is that you hook device initialization
> > into guest kvm initialization code, but this is obviously incorrect.
> > What stops QEMU tcg or Xen from reusing the same device for the same
> > purpose except the artificial limitation in a guest.
> 
> Agreed.
> 
> > Reading data from a random ioports is not how you discover platform
> > devices in 21 century (and the data you read from unassigned port is not
> > guarantied to be zero, it may depend on QEMU version), you use ACPI for
> > that and Marcelo already pointed that to you. Having little knowledge of
> > ACPI (we all do) is not a good reason to not doing it. We probably need
> > to reserve QEMU specific ACPI Plug and Play hardware ID to define our own
> > devices. After that you will be able to create device with _HID(QEMU0001)
> > in DSDT that supplies address information (ioport to use) and capability
> > supported.
> 
> Please also document this HID in a new file in the QEMU docs/ directory.
> 
> > Guest uses acpi_get_devices() to discover a platform device by
> > its name (QEMU0001).  Then you put the driver for the platform device
> > into drivers/platform/x86/ and QEMU/kvm/Xen all will be able to use it.
> 
> Just to clarify it for Hu Tao, the read from a random ioport is how the
> ACPI code will detect presence of the device.
> 
> Something like this should work (in SeaBIOS's src/acpi-dsdt-isa.dsl):
> 
>     Device(PEVT) {
>         Name(_HID, EisaId("QEMU0001"))
>         OperationRegion(PEOR, SystemIO, 0x505, 0x01)
>         Field(PEOR, ByteAcc, NoLock, Preserve) {
>             PEPT,   8,
>         }
> 
>         Method(_STA, 0, NotSerialized) {
>             Store(PEPT, Local0)
>             If (LEqual(Local0, Zero)) {
>                 Return (0x00)
>             } Else {
>                 Return (0x0F)
>             }
>         }

IIUC, here _STA reads from ioport 0x505, if the result is 0, then the
device is not present. Otherwise, the device is present. But as Gleb
said, ''the data you read from unassigned port is not guarantied to be
zero, it may depend on QEMU version''. What should I do to tell if the
device is present or not correctly?

> 
>         Name(_CRS, ResourceTemplate() {
>             IO(Decode16, 0x505, 0x505, 0x01, 0x01)
>         })
>     }
> 
> Please test this with a QEMU option like "-M pc-1.4".  The device should
> _not_ be detected if you're doing it right.

because there is no corresponding device driver?

> 
> > On QEMU side of things I cannot comment much on how QOMified the device
> > is (it should be),
> 
> Please make the device target-independent.  It can be used on non-x86
> architectures that have I/O ports.  You should make the port
> configurable using a property (DEFINE_PROPERTY_INT16 or something like
> that), with a default of 0x505.

OK.

> 
> All the panicked_action is not necessary in my opinion.  We have it for
> watchdogs, but that's really a legacy thing.  Let libvirt do it, and
> always make the guest panic perform the PANICKED_PAUSE action.

OK.

> 
> If you do it properly, a lot (really a lot) of code will go away.

Thanks!

> 
> > I hope other reviews will verify it, but I noticed
> > that device is only initialized for PIIX, what about Q35?
> 
> Yup.
> 
> Paolo

  parent reply	other threads:[~2013-03-06  8:56 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-28 12:13 [PATCH v13 0/8] pv event interface between host and guest Hu Tao
2013-02-28 12:13 ` [PATCH v13] kvm: notify host when the guest is panicked Hu Tao
2013-02-28 12:13 ` [PATCH v13 1/8] save/load cpu runstate Hu Tao
2013-02-28 21:12   ` Eric Blake
2013-03-01  7:36     ` Hu Tao
2013-03-01 16:29       ` Eric Blake
2013-03-04  9:30   ` Paolo Bonzini
2013-03-05  2:33     ` Hu Tao
2013-03-05  8:24       ` Paolo Bonzini
2013-02-28 12:13 ` [PATCH v13 2/8] start vm after resetting it Hu Tao
2013-02-28 13:23   ` Jan Kiszka
2013-03-05  3:05     ` Hu Tao
2013-03-04  9:32   ` Paolo Bonzini
2013-03-05  3:06     ` Hu Tao
2013-02-28 12:13 ` [PATCH v13 3/8] update kernel headers Hu Tao
2013-02-28 12:13 ` [PATCH v13 4/8] add a new runstate: RUN_STATE_GUEST_PANICKED Hu Tao
2013-03-04  9:40   ` Paolo Bonzini
2013-03-05  3:17     ` Hu Tao
2013-03-05  8:26       ` Paolo Bonzini
2013-03-06  9:03         ` Hu Tao
2013-02-28 12:13 ` [PATCH v13 5/8] add a new qevent: QEVENT_GUEST_PANICKED Hu Tao
2013-03-01 16:31   ` Eric Blake
2013-03-05  3:17     ` Hu Tao
2013-03-04  9:40   ` Paolo Bonzini
2013-02-28 12:13 ` [PATCH v13 6/8] introduce a new qom device to deal with panicked event Hu Tao
2013-03-04  9:42   ` Paolo Bonzini
2013-02-28 12:13 ` [PATCH v13 7/8] allower the user to disable pv event support Hu Tao
2013-03-04  9:47   ` Paolo Bonzini
2013-02-28 12:13 ` [PATCH v13 8/8] pv event: add document to describe the usage Hu Tao
2013-03-03  9:17 ` [PATCH v13 0/8] pv event interface between host and guest Gleb Natapov
2013-03-04 10:05   ` Paolo Bonzini
2013-03-04 10:21     ` Gleb Natapov
     [not found]       ` <51347735.9090204@redhat.com>
2013-03-04 10:43         ` Gleb Natapov
2013-03-04 10:49           ` Paolo Bonzini
2013-03-04 10:59             ` Gleb Natapov
2013-03-04 11:10               ` Paolo Bonzini
2013-03-04 11:20                 ` Gleb Natapov
2013-03-04 11:35                   ` Paolo Bonzini
2013-03-04 11:52                     ` Gleb Natapov
2013-03-04 12:21                       ` Paolo Bonzini
2013-03-06  8:56     ` Hu Tao [this message]
2013-03-06  9:07       ` Paolo Bonzini
2013-03-06  9:28         ` [Qemu-devel] " li guang
2013-03-06  9:38         ` Gleb Natapov
2013-03-06  9:48           ` Paolo Bonzini
2013-03-06  9:59             ` Gleb Natapov
2013-03-06  8:46   ` Hu Tao
2013-03-06  9:37     ` Gleb Natapov

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=20130306085628.GB4719@localhost.localdomain \
    --to=hutao@cn.fujitsu.com \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=drjones@redhat.com \
    --cc=eblake@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=owasserm@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).