kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Scott Wood <scottwood@freescale.com>
Cc: Gleb Natapov <gleb@redhat.com>, Alexander Graf <agraf@suse.de>,
	kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
	Christoffer Dall <cdall@cs.columbia.edu>
Subject: Re: [RFC PATCH 1/6] kvm: add device control API
Date: Sat, 23 Feb 2013 12:04:33 -0300	[thread overview]
Message-ID: <20130223150433.GA5836@amt.cnet> (raw)
In-Reply-To: <1361498425.1574.8@snotra>

On Thu, Feb 21, 2013 at 08:00:25PM -0600, Scott Wood wrote:
> On 02/21/2013 05:03:32 PM, Marcelo Tosatti wrote:
> >On Wed, Feb 20, 2013 at 07:28:52PM -0600, Scott Wood wrote:
> >> On 02/20/2013 06:14:37 PM, Marcelo Tosatti wrote:
> >> >On Wed, Feb 20, 2013 at 05:53:20PM -0600, Scott Wood wrote:
> >> >> >It is then not necessary to set device attributes on a live
> >> >guest and
> >> >> >deal with the complications associated with that.
> >> >>
> >> >> Which complications?
> >> >>
> >> >> -Scott
> >> >
> >> >Semantics of individual attribute writes, for one.
> >>
> >> When the attribute is a device register, the hardware documentation
> >> takes care of that.
> >
> >You are not writing to the registers from the CPU point of view.
> 
> That's exactly how KVM_DEV_MPIC_GRP_REGISTER is defined and
> implemented on MPIC (with the exception of registers whose behavior
> changes based on which specific vcpu you use to access them).
> If/when we have a need to set/get state in a different manner,
> that's a separate attribute group.

Can you describe usage of this register again?

> >> Otherwise, the semantics are documented in the
> >> device-specific documentation -- which can include restricting when
> >> the access is allowed.  Same as with any other interface
> >> documentation.
> >
> >Again, you are talking about the semantics of device access from the
> >software operating on the machine view. We are discussing hypervisor
> >userspace <-> hypervisor kernel interface.
> 
> And I was talking about the userspace-to-hypervisor kernel interface
> documentation.  It just happens that one specific MPIC device group
> ("when the attribute is a device register") is defined with respect
> to what guest software would see if it did a similar access.
> 
> >In general you never have to set attributes on a device after it has
> >been initialized, because there is state associated with that device
> >that requires proper handling (example: if you modify a timer counter
> >register of a timer device, any software timers used to emulate the
> >timer counter must be cancelled).
> 
> Yes, it requires proper handling and the MMIO code does that.
>
> If and when we add raw state accessors, it's totally reasonable for
> there to be command/attribute-specific documented restrictions on
> when the access can be done.

> >Also, it is necessary to provide proper locking of device attribute
> >write versus vcpu device access. So far we have been focusing on
> >having
> >a lockless vcpu path.
> 
> How is device access related to vcpus?  Existing irqchip code is not
> lockless.

VCPUS access in-kernel devices. Yes, it is lockless (see RCU usage in
virt/kvm/).

> >So when device attributes can be modified has implications beyond what
> >may seem visible at first.
> >
> >Are this reasonable arguments?
> >
> >Basically abstract 'device attributes' are too abstract.
> 
> It's up to the device-specific documentation to make them not
> abstract (I admit there are a few details missing in mpic.txt that
> I've pointed out in this thread -- it is RFC v1 after all).  This
> wouldn't be any different if we used separate ioctls for everything.
> It's like saying abstract 'ioctl' is too abstract.

Perhaps a better way to put it is that its too permissive.

> >However, your proposed interface deals with sucky capability,
> >versioning
> >and namespace conflicts we have now. Note these items can probably be
> >improved separately.
> 
> Any particular proposals?

Namespace conflicts: Reserve ranges for each arch. 

The other two items, haven't though. I am not the one bothered :-) (yes, they
suck).

> >> I suppose mpic.txt could use an additional statement that
> >> KVM_DEV_MPIC_GRP_REGISTER performs an access as if it were performed
> >> by the guest.
> >>
> >> >Locking versus currently executing VCPUs, for another (see how
> >> >KVM_SET_IRQ's RCU usage, for instance, that is something should be
> >> >shared).
> >>
> >> If you mean kvm_set_irq() in irq_comm.c, that's only relevant when
> >> you have a GSI routing table, which this patchset doesn't.
> >>
> >> Assuming we end up having a routing table to support irqfd, we still
> >> can't share the code as is, since it's APIC-specific.
> >
> >Suppose it is worthwhile to attempt to share code as much as possible.
> 
> Sure... my point is it isn't a case of "the common code is right
> over there, why aren't you using it?"  I'll try to share what I
> reasonably can, subject to my limited knowledge of how the APIC
> stuff works.  The irqfd code is substantial enough that refactoring
> for sharing should be worthwhile.  I'm not so sure about irq_comm.c.
> 
> -scott

Note just pointing out drawbacks of device attributes (if something of
that sort is integrated, x86 should also use it).

  reply	other threads:[~2013-02-23 15:04 UTC|newest]

Thread overview: 130+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14  5:49 [RFC PATCH 0/6] kvm/ppc/mpic: in-kernel irqchip Scott Wood
2013-02-14  5:49 ` [RFC PATCH 1/6] kvm: add device control API Scott Wood
2013-02-18 12:21   ` Gleb Natapov
2013-02-18 23:01     ` Scott Wood
2013-02-19  0:43       ` Christoffer Dall
2013-02-19 12:24       ` Gleb Natapov
2013-02-19 15:51         ` Christoffer Dall
2013-02-19 21:16         ` Scott Wood
2013-02-20 13:09           ` Gleb Natapov
2013-02-20 21:28             ` Marcelo Tosatti
2013-02-20 22:44               ` Marcelo Tosatti
2013-02-20 23:53               ` Scott Wood
2013-02-21  0:14                 ` Marcelo Tosatti
2013-02-21  1:28                   ` Scott Wood
2013-02-21  6:39                     ` Gleb Natapov
2013-02-21 23:03                     ` Marcelo Tosatti
2013-02-22  2:00                       ` Scott Wood
2013-02-23 15:04                         ` Marcelo Tosatti [this message]
2013-02-26  0:27                           ` Scott Wood
2013-02-21  2:05             ` Scott Wood
2013-02-21  8:22               ` Gleb Natapov
2013-02-22  2:17                 ` Scott Wood
2013-02-24 15:46                   ` Gleb Natapov
2013-02-25 15:23                     ` Alexander Graf
2013-02-26  2:38                     ` Scott Wood
2013-02-20 21:17       ` Marcelo Tosatti
2013-02-20 23:20         ` Scott Wood
2013-02-21  0:01           ` Marcelo Tosatti
2013-02-21  0:33             ` Scott Wood
2013-02-25  1:11     ` Paul Mackerras
2013-02-25 13:09       ` Gleb Natapov
2013-02-25 15:29         ` Alexander Graf
2013-02-19  0:44   ` Christoffer Dall
2013-02-19  0:53     ` Scott Wood
2013-02-19  5:50       ` Christoffer Dall
2013-02-19 12:45         ` Gleb Natapov
2013-02-19 20:16         ` Scott Wood
2013-02-20  2:16           ` Christoffer Dall
2013-02-24 13:12             ` Marc Zyngier
2013-03-06  0:59   ` Paul Mackerras
2013-03-06  1:20     ` Scott Wood
2013-03-06  2:48   ` Benjamin Herrenschmidt
2013-03-06  3:36     ` Scott Wood
2013-03-06  4:28       ` Benjamin Herrenschmidt
2013-03-06 10:18     ` Gleb Natapov
2013-02-14  5:49 ` [RFC PATCH 2/6] kvm/ppc: add a notifier chain for vcpu creation/destruction Scott Wood
2013-02-14  5:49 ` [RFC PATCH 3/6] kvm/ppc/mpic: import hw/openpic.c from QEMU Scott Wood
2013-02-14  5:49 ` [RFC PATCH 4/6] kvm/ppc/mpic: remove some obviously unneeded code Scott Wood
2013-02-14  5:49 ` [RFC PATCH 5/6] kvm/ppc/mpic: adapt to kernel style and environment Scott Wood
2013-02-14  5:49 ` [RFC PATCH 6/6] kvm/ppc/mpic: in-kernel MPIC emulation Scott Wood
2013-03-21  8:28   ` Alexander Graf
2013-03-21 14:43     ` Scott Wood
2013-03-21 14:52       ` Alexander Graf
2013-02-18 12:04 ` [RFC PATCH 0/6] kvm/ppc/mpic: in-kernel irqchip Gleb Natapov
2013-02-18 23:05   ` Scott Wood
2013-04-01 22:47 ` [RFC PATCH v2 0/6] device control and in-kernel MPIC Scott Wood
2013-04-01 22:47   ` [RFC PATCH v2 1/6] kvm: add device control API Scott Wood
2013-04-02  6:59     ` tiejun.chen
     [not found]       ` <1364923807.24520.2@snotra>
2013-04-03  1:28         ` tiejun.chen
     [not found]           ` <1364952853.8690.3@snotra>
2013-04-03  1:42             ` tiejun.chen
2013-04-03  1:02     ` Paul Mackerras
2013-04-03  1:19       ` Scott Wood
2013-04-03  2:17         ` Paul Mackerras
2013-04-03 13:22           ` Alexander Graf
2013-04-03 17:37             ` Scott Wood
2013-04-03 17:39               ` Alexander Graf
2013-04-04  9:58                 ` Gleb Natapov
2013-04-03 21:03           ` Scott Wood
2013-04-01 22:47   ` [RFC PATCH v2 2/6] kvm/ppc/mpic: import hw/openpic.c from QEMU Scott Wood
2013-04-01 22:47   ` [RFC PATCH v2 3/6] kvm/ppc/mpic: remove some obviously unneeded code Scott Wood
2013-04-01 22:47   ` [RFC PATCH v2 4/6] kvm/ppc/mpic: adapt to kernel style and environment Scott Wood
2013-04-01 22:47   ` [RFC PATCH v2 5/6] kvm/ppc/mpic: in-kernel MPIC emulation Scott Wood
2013-04-01 22:47   ` [RFC PATCH v2 6/6] kvm/ppc/mpic: add KVM_CAP_IRQ_MPIC Scott Wood
2013-04-03  1:57   ` [RFC PATCH v3 0/6] device control and in-kernel MPIC Scott Wood
2013-04-03  1:57     ` [RFC PATCH v3 1/6] kvm: add device control API Scott Wood
2013-04-03 15:13       ` Alexander Graf
2013-04-04 10:41       ` Gleb Natapov
2013-04-04 23:47         ` Scott Wood
2013-04-08 10:34           ` Gleb Natapov
2013-04-05  1:02         ` Paul Mackerras
2013-04-08 10:37           ` Gleb Natapov
2013-04-08  5:33       ` Paul Mackerras
2013-04-09  0:50         ` Scott Wood
2013-04-03  1:57     ` [RFC PATCH v3 2/6] kvm/ppc/mpic: import hw/openpic.c from QEMU Scott Wood
2013-04-03  1:57     ` [RFC PATCH v3 3/6] kvm/ppc/mpic: remove some obviously unneeded code Scott Wood
2013-04-03  1:57     ` [RFC PATCH v3 4/6] kvm/ppc/mpic: adapt to kernel style and environment Scott Wood
2013-04-03  1:57     ` [RFC PATCH v3 5/6] kvm/ppc/mpic: in-kernel MPIC emulation Scott Wood
2013-04-03 15:55       ` Gleb Natapov
2013-04-03 20:58         ` Scott Wood
2013-04-04  5:59           ` Gleb Natapov
2013-04-04 23:33             ` Scott Wood
2013-04-08 10:39               ` Gleb Natapov
2013-04-03 16:19       ` Alexander Graf
2013-04-03 21:38         ` Scott Wood
2013-04-03 21:58           ` Alexander Graf
2013-04-03 22:07             ` Scott Wood
2013-04-03 22:12               ` Alexander Graf
2013-04-03 22:54                 ` Scott Wood
2013-04-04  9:42                   ` Alexander Graf
2013-04-03 23:23               ` Scott Wood
2013-04-08  6:30       ` Paul Mackerras
2013-04-09  0:49         ` Scott Wood
2013-04-03  1:57     ` [RFC PATCH v3 6/6] kvm/ppc/mpic: add KVM_CAP_IRQ_MPIC Scott Wood
2013-04-04 12:54       ` Alexander Graf
2013-04-04 18:41         ` Scott Wood
2013-04-04 22:30           ` Alexander Graf
2013-04-04 22:35             ` Scott Wood
2013-04-05  6:09               ` Alexander Graf
2013-04-05 17:11                 ` Scott Wood
2013-04-13  0:08     ` [PATCH v4 0/6] device-control and in-kernel MPIC Scott Wood
2013-04-13  0:08       ` [PATCH v4 1/6] kvm: add device control API Scott Wood
2013-04-25  9:43         ` Gleb Natapov
2013-04-25 10:47           ` Alexander Graf
2013-04-25 12:07             ` Gleb Natapov
2013-04-25 13:45               ` Alexander Graf
2013-04-25 13:51                 ` Gleb Natapov
2013-04-25 16:51             ` Scott Wood
2013-04-25 18:22               ` Gleb Natapov
2013-04-25 18:59                 ` Scott Wood
2013-04-26  9:53                   ` Gleb Natapov
2013-04-26  9:55                     ` Alexander Graf
2013-04-26  9:57                       ` Gleb Natapov
2013-04-13  0:08       ` [PATCH v4 2/6] kvm/ppc/mpic: import hw/openpic.c from QEMU Scott Wood
2013-04-13  0:08       ` [PATCH v4 3/6] kvm/ppc/mpic: remove some obviously unneeded code Scott Wood
2013-04-13  0:08       ` [PATCH v4 4/6] kvm/ppc/mpic: adapt to kernel style and environment Scott Wood
2013-04-13  0:08       ` [PATCH v4 5/6] kvm/ppc/mpic: in-kernel MPIC emulation Scott Wood
2013-04-13  0:08       ` [PATCH v4 6/6] kvm/ppc/mpic: add KVM_CAP_IRQ_MPIC Scott Wood
2013-04-15  5:23         ` Paul Mackerras
2013-04-15 17:52           ` Scott Wood
2013-04-16  3:59             ` Paul Mackerras

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=20130223150433.GA5836@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=agraf@suse.de \
    --cc=cdall@cs.columbia.edu \
    --cc=gleb@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=scottwood@freescale.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).