[RFC 1/3] virtio_ring: define flags as shifts consistently

2018-12-07 Thread Tiwei Bie
Introduce _SPLIT_ and/or _PACKED_ variants for VRING_DESC_F_*, VRING_AVAIL_F_NO_INTERRUPT and VRING_USED_F_NO_NOTIFY. These variants are defined as shifts instead of shifted values for consistency with other _F_ flags. Suggested-by: Michael S. Tsirkin Signed-off-by: Tiwei Bie --- include/uapi

Re: [PATCH net-next v3 01/13] virtio: add packed ring types and macros

2018-11-30 Thread Tiwei Bie
On Fri, Nov 30, 2018 at 08:52:42AM -0500, Michael S. Tsirkin wrote: > On Fri, Nov 30, 2018 at 02:01:06PM +0100, Maxime Coquelin wrote: > > On 11/30/18 1:47 PM, Michael S. Tsirkin wrote: > > > On Fri, Nov 30, 2018 at 05:53:40PM +0800, Tiwei Bie wrote: > > > > On F

Re: [PATCH net-next v3 01/13] virtio: add packed ring types and macros

2018-11-30 Thread Tiwei Bie
On Fri, Nov 30, 2018 at 04:10:55PM +0800, Jason Wang wrote: > > On 2018/11/21 下午6:03, Tiwei Bie wrote: > > Add types and macros for packed ring. > > > > Signed-off-by: Tiwei Bie > > --- > > include/uapi/linux/virtio_config.h | 3 +++ > >

Re: [virtio-dev] Re: [PATCH net-next v2 0/5] virtio: support packed ring

2018-10-11 Thread Tiwei Bie
On Thu, Oct 11, 2018 at 10:17:15AM -0400, Michael S. Tsirkin wrote: > On Thu, Oct 11, 2018 at 10:13:31PM +0800, Tiwei Bie wrote: > > On Thu, Oct 11, 2018 at 09:48:48AM -0400, Michael S. Tsirkin wrote: > > > On Thu, Oct 11, 2018 at 08:12:21PM +0800, Tiwei Bie wrote: > > >

Re: [virtio-dev] Re: [PATCH net-next v2 0/5] virtio: support packed ring

2018-10-11 Thread Tiwei Bie
On Thu, Oct 11, 2018 at 09:48:48AM -0400, Michael S. Tsirkin wrote: > On Thu, Oct 11, 2018 at 08:12:21PM +0800, Tiwei Bie wrote: > > > > But if it's not too late, I second for a OUT_OF_ORDER feature. > > > > Starting from in order can have much simpler code in driv

Re: [virtio-dev] Re: [PATCH net-next v2 0/5] virtio: support packed ring

2018-10-11 Thread Tiwei Bie
On Wed, Oct 10, 2018 at 10:36:26AM -0400, Michael S. Tsirkin wrote: > On Thu, Sep 13, 2018 at 05:47:29PM +0800, Jason Wang wrote: > > On 2018年09月13日 16:59, Tiwei Bie wrote: > > > > If what you say is true then we should take a careful look > > > > and no

Re: [RFC v6 4/5] virtio_ring: add event idx support in packed ring

2018-06-08 Thread Tiwei Bie
On Thu, Jun 07, 2018 at 05:50:32PM +0800, Jason Wang wrote: > On 2018年06月05日 15:40, Tiwei Bie wrote: > > static bool virtqueue_enable_cb_delayed_packed(struct virtqueue *_vq) > > { > > struct vring_virtqueue *vq = to_vvq(_vq); > > + u16 bufs, used_idx, wrap_co

[PATCH] virtio: update the comments for transport features

2018-06-01 Thread Tiwei Bie
Suggested-by: Michael S. Tsirkin Signed-off-by: Tiwei Bie --- This patch is generated on top of below patch: https://lists.oasis-open.org/archives/virtio-dev/201805/msg00212.html include/uapi/linux/virtio_config.h | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git

Re: [RFC v5 2/5] virtio_ring: support creating packed ring

2018-05-28 Thread Tiwei Bie
On Tue, May 29, 2018 at 10:49:11AM +0800, Jason Wang wrote: > On 2018年05月22日 16:16, Tiwei Bie wrote: > > This commit introduces the support for creating packed ring. > > All split ring specific functions are added _split suffix. > > Some necessary stubs for packe

Re: [RFC v5 3/5] virtio_ring: add packed ring support

2018-05-28 Thread Tiwei Bie
On Tue, May 29, 2018 at 11:18:57AM +0800, Jason Wang wrote: > On 2018年05月22日 16:16, Tiwei Bie wrote: [...] > > +static void detach_buf_packed(struct vring_virtqueue *vq, > > + unsigned int id, void **ctx) > > +{ > > + struct vring_desc_state_pa

Re: [RFC v5 0/5] virtio: support packed ring

2018-05-24 Thread Tiwei Bie
On Fri, May 25, 2018 at 10:31:26AM +0800, Jason Wang wrote: > On 2018年05月22日 16:16, Tiwei Bie wrote: > > Hello everyone, > > > > This RFC implements packed ring support in virtio driver. > > > > Some simple functional tests have been done with Jason's > > p

[RFC v5 1/5] virtio: add packed ring definitions

2018-05-22 Thread Tiwei Bie
Signed-off-by: Tiwei Bie <tiwei@intel.com> --- include/uapi/linux/virtio_config.h | 5 - include/uapi/linux/virtio_ring.h | 36 ++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/virtio_config.h b/include/uapi

[RFC v5 3/5] virtio_ring: add packed ring support

2018-05-22 Thread Tiwei Bie
This commit introduces the support (without EVENT_IDX) for packed ring. Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 474 ++- 1 file changed, 468 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_ri

[RFC v5 2/5] virtio_ring: support creating packed ring

2018-05-22 Thread Tiwei Bie
This commit introduces the support for creating packed ring. All split ring specific functions are added _split suffix. Some necessary stubs for packed ring are also added. Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c

[RFC v5 4/5] virtio_ring: add event idx support in packed ring

2018-05-22 Thread Tiwei Bie
This commit introduces the EVENT_IDX support in packed ring. Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 67 ++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/

[RFC v5 5/5] virtio_ring: enable packed ring

2018-05-22 Thread Tiwei Bie
Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 1ee52a89cb04..355dfef4f1eb 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/

[RFC v5 0/5] virtio: support packed ring

2018-05-22 Thread Tiwei Bie
packed ring and split ring (Jason); - Avoid using '%' operator (Jason); - Rename free_head -> next_avail_idx (Jason); - Add comments for virtio_wmb() in virtqueue_add_packed() (Jason); - Some other refinements and bug fixes; Thanks! Tiwei Bie (5): virtio: add packed ring definitions virti

Re: [RFC v4 3/5] virtio_ring: add packed ring support

2018-05-20 Thread Tiwei Bie
On Mon, May 21, 2018 at 10:30:51AM +0800, Jason Wang wrote: > On 2018年05月19日 10:29, Tiwei Bie wrote: > > > I don't hope so. > > > > > > > I agreed driver should track the DMA addrs or some > > > > other necessary things from the very beginning. And

Re: [RFC v4 3/5] virtio_ring: add packed ring support

2018-05-18 Thread Tiwei Bie
On Sat, May 19, 2018 at 09:12:30AM +0800, Jason Wang wrote: > On 2018年05月18日 22:33, Tiwei Bie wrote: > > On Fri, May 18, 2018 at 09:17:05PM +0800, Jason Wang wrote: > > > On 2018年05月18日 19:29, Tiwei Bie wrote: > > > > On Thu, May 17, 2018 at 08:01:52PM +0800, Jason Wa

Re: [RFC v4 3/5] virtio_ring: add packed ring support

2018-05-18 Thread Tiwei Bie
On Fri, May 18, 2018 at 09:17:05PM +0800, Jason Wang wrote: > On 2018年05月18日 19:29, Tiwei Bie wrote: > > On Thu, May 17, 2018 at 08:01:52PM +0800, Jason Wang wrote: > > > On 2018年05月16日 22:33, Tiwei Bie wrote: > > > > On Wed, May 16, 2018 at 10:05:44PM +0800, Jason Wa

Re: [RFC v4 3/5] virtio_ring: add packed ring support

2018-05-18 Thread Tiwei Bie
On Thu, May 17, 2018 at 08:01:52PM +0800, Jason Wang wrote: > On 2018年05月16日 22:33, Tiwei Bie wrote: > > On Wed, May 16, 2018 at 10:05:44PM +0800, Jason Wang wrote: > > > On 2018年05月16日 21:45, Tiwei Bie wrote: > > > > On Wed, May 16, 2018 at 08:51:43PM +0800, Jason Wa

Re: [RFC v4 3/5] virtio_ring: add packed ring support

2018-05-16 Thread Tiwei Bie
On Wed, May 16, 2018 at 10:05:44PM +0800, Jason Wang wrote: > On 2018年05月16日 21:45, Tiwei Bie wrote: > > On Wed, May 16, 2018 at 08:51:43PM +0800, Jason Wang wrote: > > > On 2018年05月16日 20:39, Tiwei Bie wrote: > > > > On Wed, May 16, 2018 at 07:50:16PM +0800, Jason Wa

Re: [RFC v4 3/5] virtio_ring: add packed ring support

2018-05-16 Thread Tiwei Bie
On Wed, May 16, 2018 at 08:51:43PM +0800, Jason Wang wrote: > On 2018年05月16日 20:39, Tiwei Bie wrote: > > On Wed, May 16, 2018 at 07:50:16PM +0800, Jason Wang wrote: > > > On 2018年05月16日 16:37, Tiwei Bie wrote: > > [...] > > > >struct vring_virtqueue

Re: [RFC v4 4/5] virtio_ring: add event idx support in packed ring

2018-05-16 Thread Tiwei Bie
On Wed, May 16, 2018 at 08:17:21PM +0800, Jason Wang wrote: > On 2018年05月16日 16:37, Tiwei Bie wrote: [...] > > @@ -1160,15 +1186,27 @@ static void virtqueue_disable_cb_packed(struct > > virtqueue *_vq) > > static unsigned virtqueue_enable_cb_prepare_packed(

Re: [RFC v4 3/5] virtio_ring: add packed ring support

2018-05-16 Thread Tiwei Bie
On Wed, May 16, 2018 at 07:50:16PM +0800, Jason Wang wrote: > On 2018年05月16日 16:37, Tiwei Bie wrote: [...] > > struct vring_virtqueue { > > @@ -116,6 +117,9 @@ struct vring_virtqueue { > > /* Last written value to driver->flags in > >

Re: [RFC v4 5/5] virtio_ring: enable packed ring

2018-05-16 Thread Tiwei Bie
On Wed, May 16, 2018 at 02:42:53PM +0300, Sergei Shtylyov wrote: > On 05/16/2018 01:21 PM, Tiwei Bie wrote: > > >>> Signed-off-by: Tiwei Bie <tiwei@intel.com> > >>> --- > >>> drivers/virtio/virtio_ring.c | 2 ++ > >>> 1 file chan

Re: [RFC v4 5/5] virtio_ring: enable packed ring

2018-05-16 Thread Tiwei Bie
On Wed, May 16, 2018 at 01:15:48PM +0300, Sergei Shtylyov wrote: > On 5/16/2018 11:37 AM, Tiwei Bie wrote: > > > Signed-off-by: Tiwei Bie <tiwei@intel.com> > > --- > > drivers/virtio/virtio_ring.c | 2 ++ > > 1 file changed, 2 insertions(+)

[RFC v4 1/5] virtio: add packed ring definitions

2018-05-16 Thread Tiwei Bie
Signed-off-by: Tiwei Bie <tiwei@intel.com> --- include/uapi/linux/virtio_config.h | 12 +- include/uapi/linux/virtio_ring.h | 36 ++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/virtio_config.h b/include/uapi

[RFC v4 4/5] virtio_ring: add event idx support in packed ring

2018-05-16 Thread Tiwei Bie
This commit introduces the event idx support in packed ring. Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 75 +--- 1 file changed, 70 insertions(+), 5 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/

[RFC v4 5/5] virtio_ring: enable packed ring

2018-05-16 Thread Tiwei Bie
Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index de3839f3621a..b158692263b0 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/

[RFC v4 3/5] virtio_ring: add packed ring support

2018-05-16 Thread Tiwei Bie
This commit introduces the basic support (without EVENT_IDX) for packed ring. Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 491 ++- 1 file changed, 481 insertions(+), 10 deletions(-) diff --git a/drivers/virtio/virtio_ri

[RFC v4 2/5] virtio_ring: support creating packed ring

2018-05-16 Thread Tiwei Bie
This commit introduces the support for creating packed ring. All split ring specific functions are added _split suffix. Some necessary stubs for packed ring are also added. Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c

[RFC v4 0/5] virtio: support packed ring

2018-05-16 Thread Tiwei Bie
or packed ring and split ring (Jason); - Avoid using '%' operator (Jason); - Rename free_head -> next_avail_idx (Jason); - Add comments for virtio_wmb() in virtqueue_add_packed() (Jason); - Some other refinements and bug fixes; Thanks! Tiwei Bie (5): virtio: add packed ring definitions

Re: [RFC v3 4/5] virtio_ring: add event idx support in packed ring

2018-05-15 Thread Tiwei Bie
On Wed, May 16, 2018 at 01:01:04PM +0800, Jason Wang wrote: > On 2018年04月25日 13:15, Tiwei Bie wrote: [...] > > @@ -1143,10 +1160,17 @@ static unsigned > > virtqueue_enable_cb_prepare_packed(struct virtqueue *_vq) > > /* We optimistically turn back on i

Re: [virtio-dev] Re: [PATCH v1] virtio: support VIRTIO_F_IO_BARRIER

2018-05-10 Thread Tiwei Bie
On Thu, May 10, 2018 at 04:02:58PM +0100, Stefan Hajnoczi wrote: > On Thu, May 10, 2018 at 06:39:41PM +0800, Tiwei Bie wrote: > > On Thu, May 10, 2018 at 10:53:17AM +0100, Stefan Hajnoczi wrote: > > > On Fri, May 04, 2018 at 12:59:15PM +0800, Tiwei Bie wrote: > > >

Re: [RFC v3 3/5] virtio_ring: add packed ring support

2018-05-10 Thread Tiwei Bie
On Thu, May 10, 2018 at 05:49:20PM +0800, Jason Wang wrote: > On 2018年05月10日 16:56, Tiwei Bie wrote: > > On Thu, May 10, 2018 at 03:34:50PM +0800, Jason Wang wrote: > > > On 2018年05月10日 15:32, Jason Wang wrote: > > > > On 2018年04月25日 13:15, Tiwei Bie wrote: >

Re: [PATCH v1] virtio: support VIRTIO_F_IO_BARRIER

2018-05-10 Thread Tiwei Bie
On Thu, May 10, 2018 at 10:53:17AM +0100, Stefan Hajnoczi wrote: > On Fri, May 04, 2018 at 12:59:15PM +0800, Tiwei Bie wrote: > > diff --git a/include/uapi/linux/virtio_config.h > > b/include/uapi/linux/virtio_config.h > > index 308e2096291f..9fb519a9df28 100644 > &g

Re: [RFC v3 3/5] virtio_ring: add packed ring support

2018-05-10 Thread Tiwei Bie
On Thu, May 10, 2018 at 03:34:50PM +0800, Jason Wang wrote: > On 2018年05月10日 15:32, Jason Wang wrote: > > On 2018年04月25日 13:15, Tiwei Bie wrote: > > > +    /* We're using some buffers from the free list. */ > > > +    vq->vq.num_free -= descs_used; > > &

Re: [RFC v3 4/5] virtio_ring: add event idx support in packed ring

2018-05-08 Thread Tiwei Bie
On Tue, May 08, 2018 at 05:34:40PM +0800, Jason Wang wrote: > On 2018年05月08日 17:16, Tiwei Bie wrote: > > On Tue, May 08, 2018 at 03:16:53PM +0800, Jason Wang wrote: > > > On 2018年05月08日 14:44, Tiwei Bie wrote: > > > > On Tue, May 08, 2018 at 01:40:40PM +0800, Jason Wa

Re: [RFC v3 4/5] virtio_ring: add event idx support in packed ring

2018-05-08 Thread Tiwei Bie
On Tue, May 08, 2018 at 03:16:53PM +0800, Jason Wang wrote: > On 2018年05月08日 14:44, Tiwei Bie wrote: > > On Tue, May 08, 2018 at 01:40:40PM +0800, Jason Wang wrote: > > > On 2018年05月08日 11:05, Jason Wang wrote: > > > > > Because in virtqueue_enable_cb_delayed(),

Re: [RFC v3 4/5] virtio_ring: add event idx support in packed ring

2018-05-08 Thread Tiwei Bie
The vq->last_used_idx + bufs (in driver) can be bigger than vq->vring_packed.num, and: 1. `off` will wrap; 2. wrap counters won't match; 3. off < new; And d1 (i.e. new + vq->num - off - 1) will be a value bigger than vq->num. I'm okay with this, although it's a bit weird. Best regards, Tiwei Bie >     else >         d1 = new - off - 1; > >     if (new > old) >         d2 = new - old; >     else >         d2 = new + vq->num - old; > >     return d1 < d2; > } > > Thanks >

[PATCH v1] virtio: support VIRTIO_F_IO_BARRIER

2018-05-03 Thread Tiwei Bie
This patch introduces the support for VIRTIO_F_IO_BARRIER. When this feature is negotiated, driver will use the barriers suitable for hardware devices. Signed-off-by: Tiwei Bie <tiwei@intel.com> --- This patch depends on below proposal for virtio-spec: https://lists.oasis-open.org/ar

Re: [RFC] virtio: support VIRTIO_F_IO_BARRIER

2018-05-03 Thread Tiwei Bie
On Thu, May 03, 2018 at 08:57:20PM +0300, Michael S. Tsirkin wrote: > On Thu, May 03, 2018 at 10:59:55AM +0800, Tiwei Bie wrote: > > This patch introduces the support for VIRTIO_F_IO_BARRIER. > > When this feature is negotiated, driver will use the barriers > > suitable

Re: [RFC v3 4/5] virtio_ring: add event idx support in packed ring

2018-05-03 Thread Tiwei Bie
On Thu, May 03, 2018 at 03:25:29PM +0800, Jason Wang wrote: > On 2018年05月03日 10:09, Tiwei Bie wrote: > > > > > So how about we use the straightforward way then? > > > > You mean we do new += vq->vring_packed.num instead > > > > of eve

Re: [RFC] virtio: support VIRTIO_F_IO_BARRIER

2018-05-03 Thread Tiwei Bie
On Thu, May 03, 2018 at 10:06:52AM +0100, Stefan Hajnoczi wrote: > On Thu, May 03, 2018 at 10:59:55AM +0800, Tiwei Bie wrote: > > This patch introduces the support for VIRTIO_F_IO_BARRIER. > > When this feature is negotiated, driver will use the barriers > > suitable

Re: [RFC] virtio: support VIRTIO_F_IO_BARRIER

2018-05-03 Thread Tiwei Bie
On Thu, May 03, 2018 at 05:09:44PM +0800, Jason Wang wrote: > On 2018年05月03日 16:30, Tiwei Bie wrote: > > On Thu, May 03, 2018 at 03:30:03PM +0800, Jason Wang wrote: > > > On 2018年05月03日 10:59, Tiwei Bie wrote: > > > > This patch introduces the support for VIR

Re: [RFC] virtio: support VIRTIO_F_IO_BARRIER

2018-05-03 Thread Tiwei Bie
On Thu, May 03, 2018 at 03:30:03PM +0800, Jason Wang wrote: > On 2018年05月03日 10:59, Tiwei Bie wrote: > > This patch introduces the support for VIRTIO_F_IO_BARRIER. > > When this feature is negotiated, driver will use the barriers > > suitable for hardware devices. > > &

[RFC] virtio: support VIRTIO_F_IO_BARRIER

2018-05-02 Thread Tiwei Bie
This patch introduces the support for VIRTIO_F_IO_BARRIER. When this feature is negotiated, driver will use the barriers suitable for hardware devices. Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 5 + include/uapi/linux/virtio_config

Re: [RFC v3 4/5] virtio_ring: add event idx support in packed ring

2018-05-02 Thread Tiwei Bie
On Thu, May 03, 2018 at 04:44:39AM +0300, Michael S. Tsirkin wrote: > On Thu, May 03, 2018 at 09:11:16AM +0800, Tiwei Bie wrote: > > On Wed, May 02, 2018 at 06:42:57PM +0300, Michael S. Tsirkin wrote: > > > On Wed, May 02, 2018 at 11:12:55PM +0800, Tiwei Bie wrote: > >

Re: [RFC v3 4/5] virtio_ring: add event idx support in packed ring

2018-05-02 Thread Tiwei Bie
On Wed, May 02, 2018 at 06:42:57PM +0300, Michael S. Tsirkin wrote: > On Wed, May 02, 2018 at 11:12:55PM +0800, Tiwei Bie wrote: > > On Wed, May 02, 2018 at 04:51:01PM +0300, Michael S. Tsirkin wrote: > > > On Wed, May 02, 2018 at 03:28:19PM +0800, Tiwei Bie wrote: > >

Re: [RFC v3 4/5] virtio_ring: add event idx support in packed ring

2018-05-02 Thread Tiwei Bie
On Wed, May 02, 2018 at 04:51:01PM +0300, Michael S. Tsirkin wrote: > On Wed, May 02, 2018 at 03:28:19PM +0800, Tiwei Bie wrote: > > On Wed, May 02, 2018 at 10:51:06AM +0800, Jason Wang wrote: > > > On 2018年04月25日 13:15, Tiwei Bie wrote: > > > > This commit in

Re: [RFC V3 PATCH 1/8] vhost: move get_rx_bufs to vhost.c

2018-05-02 Thread Tiwei Bie
On Mon, Apr 23, 2018 at 01:34:53PM +0800, Jason Wang wrote: > Move get_rx_bufs() to vhost.c and rename it to > vhost_get_rx_bufs(). This helps to hide vring internal layout from A small typo. Based on the code change in this patch, it seems that this function is renamed to vhost_get_bufs().

Re: [RFC v3 4/5] virtio_ring: add event idx support in packed ring

2018-05-02 Thread Tiwei Bie
On Wed, May 02, 2018 at 10:51:06AM +0800, Jason Wang wrote: > On 2018年04月25日 13:15, Tiwei Bie wrote: > > This commit introduces the event idx support in packed > > ring. This feature is temporarily disabled, because the > > implementation in this patch may not work as e

Re: [RFC v3 0/5] virtio: support packed ring

2018-04-27 Thread Tiwei Bie
On Fri, Apr 27, 2018 at 02:17:51PM +0800, Jason Wang wrote: > On 2018年04月27日 12:18, Michael S. Tsirkin wrote: > > On Fri, Apr 27, 2018 at 11:56:05AM +0800, Jason Wang wrote: > > > On 2018年04月25日 13:15, Tiwei Bie wrote: > > > > Hello everyone, > > > >

[RFC v3 1/5] virtio: add packed ring definitions

2018-04-24 Thread Tiwei Bie
Signed-off-by: Tiwei Bie <tiwei@intel.com> --- include/uapi/linux/virtio_config.h | 12 +++- include/uapi/linux/virtio_ring.h | 36 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/virtio_config.h b/includ

[RFC v3 3/5] virtio_ring: add packed ring support

2018-04-24 Thread Tiwei Bie
This commit introduces the basic support (without EVENT_IDX) for packed ring. Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 444 ++- 1 file changed, 434 insertions(+), 10 deletions(-) diff --git a/drivers/

[RFC v3 5/5] virtio_ring: enable packed ring

2018-04-24 Thread Tiwei Bie
Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index b1039c2985b9..9a3d13e1e2ba 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/

[RFC v3 4/5] virtio_ring: add event idx support in packed ring

2018-04-24 Thread Tiwei Bie
a kick is needed? Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 53 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 0181e9

[RFC v3 2/5] virtio_ring: support creating packed ring

2018-04-24 Thread Tiwei Bie
This commit introduces the support for creating packed ring. All split ring specific functions are added _split suffix. Some necessary stubs for packed ring are also added. Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c

[RFC v3 0/5] virtio: support packed ring

2018-04-24 Thread Tiwei Bie
- Some other refinements and bug fixes; Thanks! Tiwei Bie (5): virtio: add packed ring definitions virtio_ring: support creating packed ring virtio_ring: add packed ring support virtio_ring: add event idx support in packed ring virtio_ring: enable packed ring drivers/virtio/v

Re: [RFC v2] virtio: support packed ring

2018-04-23 Thread Tiwei Bie
On Tue, Apr 24, 2018 at 04:43:22AM +0300, Michael S. Tsirkin wrote: > On Tue, Apr 24, 2018 at 09:37:47AM +0800, Tiwei Bie wrote: > > On Tue, Apr 24, 2018 at 04:29:51AM +0300, Michael S. Tsirkin wrote: > > > On Tue, Apr 24, 2018 at 09:16:38AM +0800, Tiwei Bie wrote: > >

Re: [RFC v2] virtio: support packed ring

2018-04-23 Thread Tiwei Bie
On Tue, Apr 24, 2018 at 04:29:51AM +0300, Michael S. Tsirkin wrote: > On Tue, Apr 24, 2018 at 09:16:38AM +0800, Tiwei Bie wrote: > > On Tue, Apr 24, 2018 at 04:05:07AM +0300, Michael S. Tsirkin wrote: > > > On Tue, Apr 24, 2018 at 08:54:52AM +0800

Re: [RFC v2] virtio: support packed ring

2018-04-23 Thread Tiwei Bie
On Tue, Apr 24, 2018 at 04:05:07AM +0300, Michael S. Tsirkin wrote: > On Tue, Apr 24, 2018 at 08:54:52AM +0800, Jason Wang wrote: > > > > > > On 2018年04月23日 17:29, Tiwei Bie wrote: > > > On Mon, Apr 23, 2018 at 01:42:14PM +0800, Jason Wang wrote: > > >

Re: [RFC v2] virtio: support packed ring

2018-04-23 Thread Tiwei Bie
On Mon, Apr 23, 2018 at 01:42:14PM +0800, Jason Wang wrote: > On 2018年04月01日 22:12, Tiwei Bie wrote: > > Hello everyone, > > > > This RFC implements packed ring support for virtio driver. > > > > The code was tested with DPDK vhost (testpmd/vhost-PMD) implement

Re: [RFC] vhost: introduce mdev based hardware vhost backend

2018-04-19 Thread Tiwei Bie
userspace directly is that, currently IOMMU drivers don't support mdev bus. > > Yes, maybe if device is not buggy it's all fine, but > it's better if we do not have to trust the device > otherwise the security picture becomes more murky. > > I suggested attaching a PASID to (some) queues - see my old post "using > PASIDs to enable a safe variant of direct ring access". It's pretty cool. We also have some similar ideas. Cunming will talk more about this. Best regards, Tiwei Bie > > Then using IOMMU with VFIO to limit access through queue to corrent > ranges of memory. > > > -- > MST

Re: [RFC v2] virtio: support packed ring

2018-04-17 Thread Tiwei Bie
On Tue, Apr 17, 2018 at 06:54:51PM +0300, Michael S. Tsirkin wrote: > On Tue, Apr 17, 2018 at 10:56:26PM +0800, Tiwei Bie wrote: > > On Tue, Apr 17, 2018 at 05:04:59PM +0300, Michael S. Tsirkin wrote: > > > On Tue, Apr 17, 2018 at 08:47:16PM +0800, Tiwei Bie wrote: > >

Re: [RFC v2] virtio: support packed ring

2018-04-17 Thread Tiwei Bie
On Tue, Apr 17, 2018 at 05:04:59PM +0300, Michael S. Tsirkin wrote: > On Tue, Apr 17, 2018 at 08:47:16PM +0800, Tiwei Bie wrote: > > On Tue, Apr 17, 2018 at 03:17:41PM +0300, Michael S. Tsirkin wrote: > > > On Tue, Apr 17, 2018 at 10:51:33AM +0800, Tiwei Bie wrote: > >

Re: [RFC v2] virtio: support packed ring

2018-04-17 Thread Tiwei Bie
On Tue, Apr 17, 2018 at 03:17:41PM +0300, Michael S. Tsirkin wrote: > On Tue, Apr 17, 2018 at 10:51:33AM +0800, Tiwei Bie wrote: > > On Tue, Apr 17, 2018 at 10:11:58AM +0800, Jason Wang wrote: > > > On 2018年04月13日 15:15, Tiwei Bie wrote: > > > > On Fri, Apr 13, 2018 a

Re: [RFC v2] virtio: support packed ring

2018-04-16 Thread Tiwei Bie
On Tue, Apr 17, 2018 at 10:11:58AM +0800, Jason Wang wrote: > On 2018年04月13日 15:15, Tiwei Bie wrote: > > On Fri, Apr 13, 2018 at 12:30:24PM +0800, Jason Wang wrote: > > > On 2018年04月01日 22:12, Tiwei Bie wrote: [...] > > > > +static int detach_buf_packed(struct vri

Re: [RFC v2] virtio: support packed ring

2018-04-14 Thread Tiwei Bie
On Fri, Apr 13, 2018 at 06:22:45PM +0300, Michael S. Tsirkin wrote: > On Sun, Apr 01, 2018 at 10:12:16PM +0800, Tiwei Bie wrote: > > +static inline bool more_used(const struct vring_virtqueue *vq) > > +{ > > + return vq->packed ? more_used_packed(vq) : more_used_split(vq)

Re: [RFC v2] virtio: support packed ring

2018-04-13 Thread Tiwei Bie
On Fri, Apr 13, 2018 at 12:30:24PM +0800, Jason Wang wrote: > On 2018年04月01日 22:12, Tiwei Bie wrote: > > Hello everyone, > > > > This RFC implements packed ring support for virtio driver. > > > > The code was tested with DPDK vhost (testpmd/vhost-PMD) implement

Re: [RFC] vhost: introduce mdev based hardware vhost backend

2018-04-09 Thread Tiwei Bie
On Tue, Apr 10, 2018 at 10:52:52AM +0800, Jason Wang wrote: > On 2018年04月02日 23:23, Tiwei Bie wrote: > > This patch introduces a mdev (mediated device) based hardware > > vhost backend. This backend is an abstraction of the various > > hardware vhost accelerators (potentially

Re: [RFC v2] virtio: support packed ring

2018-04-09 Thread Tiwei Bie
On Tue, Apr 10, 2018 at 10:55:25AM +0800, Jason Wang wrote: > On 2018年04月01日 22:12, Tiwei Bie wrote: > > Hello everyone, > > > > This RFC implements packed ring support for virtio driver. > > > > The code was tested with DPDK vhost (testpmd/vhost-PMD) implement

[RFC] vhost: introduce mdev based hardware vhost backend

2018-04-02 Thread Tiwei Bie
the thoughts from the community. So any comments would be appreciated! Thanks! :-) Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/vhost/Makefile | 3 + drivers/vhost/vdpa.c | 805 + include/linux/vdpa_mdev.h | 76 + include

[RFC v2] virtio: support packed ring

2018-04-01 Thread Tiwei Bie
packed() (Jason); - Some other refinements and bug fixes; Thanks! Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 1094 +--- include/linux/virtio_ring.h|8 +- include/uapi/linux/virtio_config.h | 12 +-

Re: [RFC PATCH V2 8/8] vhost: event suppression for packed ring

2018-03-29 Thread Tiwei Bie
On Mon, Mar 26, 2018 at 11:38:53AM +0800, Jason Wang wrote: > This patch introduces basic support for event suppression aka driver > and device area. Compile tested only. > > Signed-off-by: Jason Wang > --- [...] > + > +static bool vhost_notify_packed(struct vhost_dev *dev,

Re: [PATCH RFC 2/2] virtio_ring: support packed ring

2018-03-21 Thread Tiwei Bie
stion well. > > > I mean do you have any suggestions about the API > > > design for packed ring in uapi header? Currently > > > I introduced below two new helpers: > > > > > > static inline void vring_packed_init(struct vring_packed *vr, unsigned > > > int num, > > >void *p, unsigned long align); > > > static inline unsigned vring_packed_size(unsigned int num, unsigned long > > > align); > > > > > > When new rings are introduced in the future, above > > > helpers can't be reused. Maybe we should make the > > > helpers be able to determine the ring type? > > > > Let's wait for Michael's comment here. Generally, I fail to understand why > > vring_init() become a part of uapi. Git grep shows the only use cases are > > virtio_test/vringh_test. > > > > Thanks > > For init - I think it's a mistake that stems from lguest which sometimes > made it less than obvious which code is where. I don't see a reason to > add to it. Got it! I'll move vring_packed_init() out of uapi. Many thanks! :) Best regards, Tiwei Bie > > -- > MST

Re: [PATCH RFC 2/2] virtio_ring: support packed ring

2018-03-21 Thread Tiwei Bie
On Fri, Mar 16, 2018 at 07:36:47PM +0800, Jason Wang wrote: > On 2018年03月16日 18:04, Tiwei Bie wrote: > > On Fri, Mar 16, 2018 at 04:34:28PM +0800, Jason Wang wrote: > > > On 2018年03月16日 15:40, Tiwei Bie wrote: > > > > On Fri, Mar 16, 2018 at 02:44:12PM +0800, Jason Wa

Re: [PATCH RFC 2/2] virtio_ring: support packed ring

2018-03-16 Thread Tiwei Bie
On Fri, Mar 16, 2018 at 04:34:28PM +0800, Jason Wang wrote: > On 2018年03月16日 15:40, Tiwei Bie wrote: > > On Fri, Mar 16, 2018 at 02:44:12PM +0800, Jason Wang wrote: > > > On 2018年03月16日 14:10, Tiwei Bie wrote: > > > > On Fri, Mar 16, 2018 at 12:03:25PM +0800, Jason Wa

Re: [PATCH RFC 2/2] virtio_ring: support packed ring

2018-03-16 Thread Tiwei Bie
On Fri, Mar 16, 2018 at 02:44:12PM +0800, Jason Wang wrote: > On 2018年03月16日 14:10, Tiwei Bie wrote: > > On Fri, Mar 16, 2018 at 12:03:25PM +0800, Jason Wang wrote: > > > On 2018年02月23日 19:18, Tiwei Bie wrote: > > > > Signed-off-by: Tiwei Bie <tiwei@intel.co

Re: [PATCH RFC 2/2] virtio_ring: support packed ring

2018-03-16 Thread Tiwei Bie
On Fri, Mar 16, 2018 at 12:03:25PM +0800, Jason Wang wrote: > On 2018年02月23日 19:18, Tiwei Bie wrote: > > Signed-off-by: Tiwei Bie <tiwei@intel.com> > > --- > > drivers/virtio/virtio_ring.c | 699 > > +-- > &g

Re: [PATCH RFC 1/2] virtio: introduce packed ring defines

2018-02-27 Thread Tiwei Bie
On Tue, Feb 27, 2018 at 09:54:58AM +0100, Jens Freimann wrote: > On Fri, Feb 23, 2018 at 07:18:00PM +0800, Tiwei Bie wrote: [...] > > > > +struct vring_packed_desc_event { > > + /* Descriptor Event Offset */ > > + __virtio16 desc_event_off : 15, > > +

Re: [PATCH RFC 1/2] virtio: introduce packed ring defines

2018-02-27 Thread Tiwei Bie
On Tue, Feb 27, 2018 at 09:26:27AM +, David Laight wrote: > From: Tiwei Bie > > Sent: 23 February 2018 11:18 > ... > > +struct vring_packed_desc_event { > > + /* Descriptor Event Offset */ > > + __virtio16 desc_event_off : 15, > >

Re: [PATCH RFC 2/2] vhost: packed ring support

2018-02-27 Thread Tiwei Bie
6 avail_idx = vq->last_avail_idx; > + > + /* When we start there are none of either input nor output. */ > + *out_num = *in_num = 0; > + if (unlikely(log)) > + *log_num = 0; > + > + do { > + unsigned int iov_count = *in_num + *out_num; > + > + i = vq->last_avail_idx & (vq->num - 1); The queue size may not be a power of 2 in packed ring. Best regards, Tiwei Bie

[PATCH] virtio_ring: fix num_free handling in error case

2018-02-23 Thread Tiwei Bie
The vq->vq.num_free hasn't been changed when error happens, so it shouldn't be changed when handling the error. Fixes: 780bc7903a32 ("virtio_ring: Support DMA APIs") Cc: Andy Lutomirski <l...@kernel.org> Cc: Michael S. Tsirkin <m...@redhat.com> Cc: sta...@vger.kernel.org

[PATCH RFC 0/2] Packed ring for virtio

2018-02-23 Thread Tiwei Bie
details Thanks! Best regards, Tiwei Bie Tiwei Bie (2): virtio: introduce packed ring defines virtio_ring: support packed ring drivers/virtio/virtio_ring.c | 699 - include/linux/virtio_ring.h| 8 +- include/uapi/linux/virtio_config.h | 18

[PATCH RFC 1/2] virtio: introduce packed ring defines

2018-02-23 Thread Tiwei Bie
Signed-off-by: Tiwei Bie <tiwei@intel.com> --- include/uapi/linux/virtio_config.h | 18 +- include/uapi/linux/virtio_ring.h | 68 ++ 2 files changed, 85 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/virtio_config.h b/includ

[PATCH RFC 2/2] virtio_ring: support packed ring

2018-02-23 Thread Tiwei Bie
Signed-off-by: Tiwei Bie <tiwei@intel.com> --- drivers/virtio/virtio_ring.c | 699 +-- include/linux/virtio_ring.h | 8 +- 2 files changed, 618 insertions(+), 89 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_