From: Rusty Russell <rusty@rustcorp.com.au>
To: "Michael S. Tsirkin" <mst@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Amit Shah <amit.shah@redhat.com>
Subject: Re: [RFC PATCH] virtio_console: link vq to port with a private pointer in struct virtqueue
Date: Thu, 10 May 2012 10:56:09 +0930 [thread overview]
Message-ID: <877gwkddxq.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20120508101839.GA15598@redhat.com>
On Tue, 8 May 2012 13:18:39 +0300, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Tue, May 08, 2012 at 11:45:55AM +0200, Paolo Bonzini wrote:
> > --- a/drivers/virtio/virtio_ring.c
> > +++ b/drivers/virtio/virtio_ring.c
> > @@ -76,8 +76,6 @@
> >
> > struct vring_virtqueue
> > {
> > - struct virtqueue vq;
> > -
> > /* Actual memory layout for this queue */
> > struct vring vring;
> >
> > @@ -106,6 +104,9 @@ struct vring_virtqueue
> > /* How to notify other side. FIXME: commonalize hcalls! */
> > void (*notify)(struct virtqueue *vq);
> >
> > + /* Tokens for callbacks. */
> > + void **data;
> > +
> > #ifdef DEBUG
> > /* They're supposed to lock for us. */
> > unsigned int in_use;
> > @@ -115,8 +116,9 @@ struct vring_virtqueue
> > ktime_t last_add_time;
> > #endif
> >
> > - /* Tokens for callbacks. */
> > - void *data[];
> > + struct virtqueue vq;
> > +
> > + /* Bus-specific virtqueue data goes here. */
> > };
> >
> > #define to_vvq(_vq) container_of(_vq, struct vring_virtqueue, vq)
>
>
> This moves the data out of line and the bus specific stuff inline.
> But bus accesses only happen on io and interrupt which are already
> slow, while data accesses happen on fast path.
>
> >From that POV this looks like a wrong thing to do.
(Resend to all)
Most of it was on a different cacheline anyway though, so it's probably
not measurable. We avoid the pci_vq->vq indirection, but add the
vq->data indirection.
I share your discomfort with the offset arg method, too.
So unless benchmarks show otherwise, let's do it the vanilla way?
I think that making vring_virtqueue public looks like the way to go,
too.
Of course, a nice series would be great as well :)
Thanks!
Rusty.
next prev parent reply other threads:[~2012-05-10 1:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-18 13:33 [RFC PATCH] virtio_console: link vq to port with a private pointer in struct virtqueue Paolo Bonzini
2012-04-18 14:21 ` Michael S. Tsirkin
2012-04-18 14:34 ` Paolo Bonzini
2012-04-18 16:10 ` Michael S. Tsirkin
2012-04-18 18:38 ` Paolo Bonzini
2012-04-18 18:48 ` Michael S. Tsirkin
2012-04-19 6:21 ` Amit Shah
2012-05-08 2:11 ` Rusty Russell
2012-05-08 6:43 ` Paolo Bonzini
2012-05-08 9:45 ` Paolo Bonzini
2012-05-08 10:18 ` Michael S. Tsirkin
2012-05-10 1:26 ` Rusty Russell [this message]
2012-05-10 6:02 ` Michael S. Tsirkin
2012-05-08 10:56 ` [PATCH untested] virtio: allocate extra memory before the ring ( was Re: [RFC PATCH] virtio_console: link vq to port with a private) " Michael S. Tsirkin
2012-05-08 11:06 ` Paolo Bonzini
2012-05-08 11:53 ` Michael S. Tsirkin
2012-05-08 11:34 ` Michael S. Tsirkin
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=877gwkddxq.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=amit.shah@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/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