public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Gregory Haskins <ghaskins@novell.com>
Cc: avi@redhat.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, mtosatti@redhat.com,
	paulmck@linux.vnet.ibm.com, markmc@redhat.com
Subject: Re: [PATCH RFC] pass write value to in_range pointers
Date: Mon, 22 Jun 2009 20:27:21 +0300	[thread overview]
Message-ID: <20090622172720.GC15228@redhat.com> (raw)
In-Reply-To: <4A3FB156.3030301@novell.com>

On Mon, Jun 22, 2009 at 12:29:10PM -0400, Gregory Haskins wrote:
> Michael S. Tsirkin wrote:
> > On Mon, Jun 22, 2009 at 11:45:00AM -0400, Gregory Haskins wrote:
> >   
> >> Michael S. Tsirkin wrote:
> >>     
> >>> It seems that a lot of complexity and trickiness with iosignalfd is
> >>> handling the group/item relationship, which comes about because kvm does
> >>> not currently let a device on the bus claim a write transaction based on the
> >>> value written.  This could be greatly simplified if the value written
> >>> was passed to the in_range check for write operation.  We could then
> >>> simply make each kvm_iosignalfd a device on the bus.
> >>>
> >>> What does everyone think of the following lightly tested patch?
> >>>   
> >>>       
> >> Hi Michael,
> >>   Its interesting, but I am not convinced its necessary.  We created the
> >> group/item layout because iosignalfds are unique in that they are
> >> probably the only IO device that wants to do some kind of address
> >> aliasing.
> >>     
> >
> > We actually already have aliasing: is_write flag is used for this
> > purpose.
> 
> Yes, but read/write address aliasing is not the same thing is
> multi-match data aliasing.

What's the big difference?

> Besides, your proposal also breaks

s/break/removes limitation/ :)

> some of
> the natural relationship models
> (e.g. all the aliased iosignal_items
> always belong to the same underlying device.  io_bus entries have an
> arbitrary topology).

iosignal_item is an artifact, they are not seen by user -
they are just a work around an API limitation.

And they are only grouped if the same PIO offset is used for all accesses.
Why is not always the case. If a device uses several PIO offsets
(as virtio does), you create separate devices for a single guest device too.

> 
> >  Actually, it's possible to remove is_write by passing
> > a null pointer in write_val for reads. I like this a bit less as
> > the code generated is less compact ... Avi, what do you think?
> >
> >   
> >>  With what you are proposing here, you are adding aliasing
> >> support to the general infrastructure which I am not (yet) convinced is
> >> necessary.
> >>     
> >
> > Infrastructure is a big name for something that adds a total of 10 lines to kvm.
> > And it should at least halve the size of your 450-line patch.
> >   
> 
> Your patch isn't complete until some critical missing features are added
> to io_bus, though, so its not really just 10 lines.
>  For one, it will
> need to support much more than 6 devices.

Isn't this like a #define change? With the item patch we are still
limited in the number of groups we can create.

What we gain is a simple array/list instead of a tree of
linked lists that makes cheshire cheese out of CPU data cache.

>  It will also need to support
> multiple matches.

What, signal many fds on the same address/value pair?
I see this as a bug. Why is this a good thing to support?
Just increases the chance of leaking this fd.

> Also you are proposing an general interface change
> that doesn't make sense to all but one device type.  So now every
> io-device developer that comes along will scratch their head at what to
> do with that field.

What do they do with is_write now? Ignore it. It's used in a whole
of 1 place.

> 
> None of these are insurmountable hurdles, but my point is that today the
> complexity is encapsulated in the proper place IMO.

It's better to get rid of complexity than encapsulate it.

>  E.g. The one and
> only device that cares to do this "weird" thing handles it behind an
> interface that makes sense to all parties involved.
> >   
> >> If there isn't a use case for other devices to have
> >> aliasing, I would think the logic is best contained in iosignalfd.  Do
> >> you have something in mind?
> >>     
> >
> > One is enough :)
> >   
> 
> I am not convinced yet. ;)  It appears to me that we are leaking
> iosignalfd-isms into the general code.  If there is another device that
> wants to do something similar, ok.  But I can't think of any.

You never know. is_write was used by a whole of 1 user: coalesced_mmio,
then your patch comes along ...


> > Seriously, do you see that this saves you all of RCU, linked lists and
> > counters?
> 
> Well, also keep in mind we will probably be converting io_bus to RCU
> very soon, so we are going the opposite direction ;)
> 
> Kind Regards,
> -Greg
> 

Same direction. Let's put RCU in iobus, we don't need another one on
top of it. That's encapsulating complexity.


  reply	other threads:[~2009-06-22 17:27 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-19  0:30 [KVM PATCH v8 0/3] iosignalfd Gregory Haskins
2009-06-19  0:30 ` [KVM PATCH v8 1/3] KVM: make io_bus interface more robust Gregory Haskins
2009-06-25 14:22   ` Gregory Haskins
2009-06-25 14:53     ` Michael S. Tsirkin
2009-06-25 14:56       ` Gregory Haskins
2009-06-19  0:30 ` [KVM PATCH v8 2/3] KVM: add per-vm limit on the maximum number of io-devices supported Gregory Haskins
2009-06-19  0:30 ` [KVM PATCH v8 3/3] KVM: add iosignalfd support Gregory Haskins
2009-06-22 10:44   ` Michael S. Tsirkin
2009-06-22 12:13     ` Gregory Haskins
2009-06-22 12:26       ` Paolo Bonzini
2009-06-22 12:30       ` Michael S. Tsirkin
2009-06-22 12:56         ` Gregory Haskins
2009-06-22 13:08           ` Michael S. Tsirkin
2009-06-22 13:12             ` Gregory Haskins
2009-06-22 13:13             ` Avi Kivity
2009-06-22 13:04         ` Gregory Haskins
2009-06-22 13:13           ` Michael S. Tsirkin
2009-06-22 13:19             ` Gregory Haskins
2009-06-22 14:30               ` Avi Kivity
2009-06-22 14:39                 ` Gregory Haskins
2009-06-22 14:28             ` Avi Kivity
2009-06-22 15:16   ` [PATCH RFC] pass write value to in_range pointers Michael S. Tsirkin
2009-06-22 15:45     ` Gregory Haskins
2009-06-22 16:08       ` Michael S. Tsirkin
2009-06-22 16:29         ` Gregory Haskins
2009-06-22 17:27           ` Michael S. Tsirkin [this message]
2009-06-23  4:04             ` Gregory Haskins
2009-06-23 11:44               ` Michael S. Tsirkin
2009-06-23 11:52                 ` Gregory Haskins
2009-06-23 11:56                 ` Avi Kivity
2009-06-23 12:01                   ` Gregory Haskins
2009-06-23 12:19                     ` Avi Kivity
2009-06-23 11:53               ` Avi Kivity
2009-06-23  9:54           ` Avi Kivity
2009-06-23  9:52         ` Avi Kivity
2009-06-23 11:41           ` Gregory Haskins
2009-06-23 11:46             ` Michael S. Tsirkin
2009-06-23  8:56   ` [KVM PATCH v8 3/3] KVM: add iosignalfd support Michael S. Tsirkin
2009-06-23  9:57     ` Avi Kivity
2009-06-23 10:48       ` Michael S. Tsirkin
2009-06-23 11:24         ` Avi Kivity
2009-06-23 11:33     ` Gregory Haskins
2009-06-23 11:36       ` Michael S. Tsirkin
2009-06-23 11:40         ` Gregory Haskins
2009-06-23 13:22     ` Gregory Haskins

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=20090622172720.GC15228@redhat.com \
    --to=mst@redhat.com \
    --cc=avi@redhat.com \
    --cc=ghaskins@novell.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markmc@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=paulmck@linux.vnet.ibm.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