Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934134AbdC3OeV (ORCPT ); Thu, 30 Mar 2017 10:34:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52586 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933165AbdC3OeU (ORCPT ); Thu, 30 Mar 2017 10:34:20 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1F83C7AEB1 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mst@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1F83C7AEB1 Date: Thu, 30 Mar 2017 17:34:17 +0300 From: "Michael S. Tsirkin" To: Cornelia Huck Cc: linux-kernel@vger.kernel.org, John Fastabend , virtualization@lists.linux-foundation.org Subject: Re: [PATCH 3/6] virtio: allow extra context per descriptor Message-ID: <20170330173243-mutt-send-email-mst@kernel.org> References: <1490820507-8005-1-git-send-email-mst@redhat.com> <1490820507-8005-4-git-send-email-mst@redhat.com> <20170330092316.2a25e4f1.cornelia.huck@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170330092316.2a25e4f1.cornelia.huck@de.ibm.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 30 Mar 2017 14:34:19 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1709 Lines: 45 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" 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 > > --- > > 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);