All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: linux-kernel@vger.kernel.org,
	John Fastabend <john.fastabend@gmail.com>,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 3/6] virtio: allow extra context per descriptor
Date: Thu, 30 Mar 2017 17:34:17 +0300	[thread overview]
Message-ID: <20170330173243-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20170330092316.2a25e4f1.cornelia.huck@de.ibm.com>

On Thu, Mar 30, 2017 at 09:23:16AM +0200, Cornelia Huck wrote:
> On Wed, 29 Mar 2017 23:48:53 +0300
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > Allow extra context per descriptor. To avoid slow down for data path,
> > this disables use of indirect descriptors for this vq.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  drivers/virtio/virtio_ring.c | 70 ++++++++++++++++++++++++++++++++++++--------
> >  include/linux/virtio.h       |  9 ++++++
> >  2 files changed, 66 insertions(+), 13 deletions(-)
> > 
> 
> >  /**
> > + * virtqueue_add_inbuf_ctx - expose input buffers to other end
> > + * @vq: the struct virtqueue we're talking about.
> > + * @sg: scatterlist (must be well-formed and terminated!)
> > + * @num: the number of entries in @sg writable by other side
> > + * @data: the token identifying the buffer.
> > + * @ctx: extra context for the token
> 
> I think that needs do that ctx != NULL collides with indirect
> descriptors.

At the API level what happens is that ctx needs to be enabled
at find_vqs time. Doing that will disable indirect descriptors
but this is not visible in the API.

> > + * @gfp: how to do memory allocations (if necessary).
> > + *
> > + * Caller must ensure we don't call this with other virtqueue operations
> > + * at the same time (except where noted).
> > + *
> > + * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO).
> > + */
> > +int virtqueue_add_inbuf_ctx(struct virtqueue *vq,
> > +			struct scatterlist *sg, unsigned int num,
> > +			void *data,
> > +			void *ctx,
> > +			gfp_t gfp)
> > +{
> > +	return virtqueue_add(vq, &sg, num, 0, 1, data, ctx, gfp);
> > +}
> > +EXPORT_SYMBOL_GPL(virtqueue_add_inbuf_ctx);

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: John Fastabend <john.fastabend@gmail.com>,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 3/6] virtio: allow extra context per descriptor
Date: Thu, 30 Mar 2017 17:34:17 +0300	[thread overview]
Message-ID: <20170330173243-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20170330092316.2a25e4f1.cornelia.huck@de.ibm.com>

On Thu, Mar 30, 2017 at 09:23:16AM +0200, Cornelia Huck wrote:
> On Wed, 29 Mar 2017 23:48:53 +0300
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > Allow extra context per descriptor. To avoid slow down for data path,
> > this disables use of indirect descriptors for this vq.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  drivers/virtio/virtio_ring.c | 70 ++++++++++++++++++++++++++++++++++++--------
> >  include/linux/virtio.h       |  9 ++++++
> >  2 files changed, 66 insertions(+), 13 deletions(-)
> > 
> 
> >  /**
> > + * virtqueue_add_inbuf_ctx - expose input buffers to other end
> > + * @vq: the struct virtqueue we're talking about.
> > + * @sg: scatterlist (must be well-formed and terminated!)
> > + * @num: the number of entries in @sg writable by other side
> > + * @data: the token identifying the buffer.
> > + * @ctx: extra context for the token
> 
> I think that needs do that ctx != NULL collides with indirect
> descriptors.

At the API level what happens is that ctx needs to be enabled
at find_vqs time. Doing that will disable indirect descriptors
but this is not visible in the API.

> > + * @gfp: how to do memory allocations (if necessary).
> > + *
> > + * Caller must ensure we don't call this with other virtqueue operations
> > + * at the same time (except where noted).
> > + *
> > + * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO).
> > + */
> > +int virtqueue_add_inbuf_ctx(struct virtqueue *vq,
> > +			struct scatterlist *sg, unsigned int num,
> > +			void *data,
> > +			void *ctx,
> > +			gfp_t gfp)
> > +{
> > +	return virtqueue_add(vq, &sg, num, 0, 1, data, ctx, gfp);
> > +}
> > +EXPORT_SYMBOL_GPL(virtqueue_add_inbuf_ctx);

  reply	other threads:[~2017-03-30 14:34 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 20:48 [PATCH 0/6] virtio: support extra per-buffer context Michael S. Tsirkin
2017-03-29 20:48 ` [PATCH 1/6] virtio: wrap find_vqs Michael S. Tsirkin
2017-03-29 20:48   ` Michael S. Tsirkin
2017-03-30  0:50   ` Gonglei (Arei)
2017-03-30  0:50   ` Gonglei (Arei)
2017-03-30  0:50     ` Gonglei (Arei)
2017-03-30  0:50     ` Gonglei (Arei)
2017-03-30  0:50     ` Gonglei (Arei)
2017-03-30  6:00   ` Jason Wang
2017-03-30  6:00   ` Jason Wang
2017-03-30  6:00     ` Jason Wang
2017-03-30 14:32     ` Michael S. Tsirkin
2017-03-30 14:32       ` Michael S. Tsirkin
2017-03-31  4:04       ` Jason Wang
2017-03-31  4:04       ` Jason Wang
2017-03-31  4:04         ` Jason Wang
2017-03-31 16:21         ` Michael S. Tsirkin
2017-03-31 16:21           ` Michael S. Tsirkin
2017-03-31 16:21         ` Michael S. Tsirkin
2017-03-30 14:32     ` Michael S. Tsirkin
2017-03-30  7:18   ` Cornelia Huck
2017-03-30  7:18     ` Cornelia Huck
2017-03-30  7:18   ` Cornelia Huck
2017-04-01 16:13   ` Bjorn Andersson
2017-04-01 16:13     ` Bjorn Andersson
2017-03-29 20:48 ` [PATCH 2/6] virtio: add context flag to find vqs Michael S. Tsirkin
2017-03-29 20:48   ` Michael S. Tsirkin
2017-03-30  7:17   ` Cornelia Huck
2017-03-30  7:17     ` Cornelia Huck
2017-03-30 14:57     ` Michael S. Tsirkin
2017-03-30 14:57       ` Michael S. Tsirkin
2017-03-30  7:17   ` Cornelia Huck
2017-03-29 20:48 ` [PATCH 3/6] virtio: allow extra context per descriptor Michael S. Tsirkin
2017-03-29 20:48   ` Michael S. Tsirkin
2017-03-30  7:23   ` Cornelia Huck
2017-03-30  7:23     ` Cornelia Huck
2017-03-30 14:34     ` Michael S. Tsirkin [this message]
2017-03-30 14:34       ` Michael S. Tsirkin
2017-03-29 20:48 ` [PATCH 4/6] virtio_net: allow specifying context for rx Michael S. Tsirkin
2017-03-29 20:48   ` Michael S. Tsirkin
2017-03-30  7:26   ` Cornelia Huck
2017-03-30 14:31     ` Michael S. Tsirkin
2017-03-30 14:46       ` Cornelia Huck
2017-03-30 14:46         ` Cornelia Huck
2017-03-30 14:31     ` Michael S. Tsirkin
2017-03-30  7:26   ` Cornelia Huck
2017-03-29 20:48 ` [PATCH 5/6] virtio_net: rework mergeable buffer handling Michael S. Tsirkin
2017-03-29 20:48   ` Michael S. Tsirkin
2017-03-29 20:48 ` [PATCH 6/6] virtio_net: reduce alignment for buffers Michael S. Tsirkin
2017-03-29 20:48   ` 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=20170330173243-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=john.fastabend@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 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.