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: [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-21 Thread Tiwei Bie
> > No. > > > Hmm.. Sorry, I didn't describe my question 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: [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

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: [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: [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

[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

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

2018-12-07 Thread Tiwei Bie
This is a follow up of the discussion in this thread: https://patchwork.ozlabs.org/patch/1001015/#2042353 Tiwei Bie (3): virtio_ring: define flags as shifts consistently virtio_ring: add VIRTIO_RING_NO_LEGACY virtio_ring: use new vring flags drivers/virtio/virtio_ring.c | 100

[RFC 3/3] virtio_ring: use new vring flags

2018-12-07 Thread Tiwei Bie
Switch to using the _SPLIT_ and _PACKED_ variants of vring flags in split ring and packed ring respectively. Signed-off-by: Tiwei Bie --- drivers/virtio/virtio_ring.c | 100 +-- 1 file changed, 59 insertions(+), 41 deletions(-) diff --git a/drivers/virtio

[RFC 2/3] virtio_ring: add VIRTIO_RING_NO_LEGACY

2018-12-07 Thread Tiwei Bie
Introduce VIRTIO_RING_NO_LEGACY to support disabling legacy macros and layout definitions. Suggested-by: Michael S. Tsirkin Signed-off-by: Tiwei Bie --- VRING_AVAIL_ALIGN_SIZE, VRING_USED_ALIGN_SIZE and VRING_DESC_ALIGN_SIZE are not pre-virtio 1.0, but can also be disabled by

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

2018-12-08 Thread Tiwei Bie
On Fri, Dec 07, 2018 at 01:11:42PM -0500, Michael S. Tsirkin wrote: > On Fri, Dec 07, 2018 at 04:48:39PM +0800, Tiwei Bie wrote: > > This is a follow up of the discussion in this thread: > > https://patchwork.ozlabs.org/patch/1001015/#2042353 > > How was this tested? I'

Re: [RFC 2/3] virtio_ring: add VIRTIO_RING_NO_LEGACY

2018-12-08 Thread Tiwei Bie
On Fri, Dec 07, 2018 at 01:05:35PM -0500, Michael S. Tsirkin wrote: > On Fri, Dec 07, 2018 at 04:48:41PM +0800, Tiwei Bie wrote: > > Introduce VIRTIO_RING_NO_LEGACY to support disabling legacy > > macros and layout definitions. > > > > Suggested-by: Michael S. Tsirki

Re: [RFC 3/3] virtio_ring: use new vring flags

2018-12-08 Thread Tiwei Bie
On Fri, Dec 07, 2018 at 01:10:48PM -0500, Michael S. Tsirkin wrote: > On Fri, Dec 07, 2018 at 04:48:42PM +0800, Tiwei Bie wrote: > > Switch to using the _SPLIT_ and _PACKED_ variants of vring flags > > in split ring and packed ring respectively. > > > &g

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 > &

[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 a

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-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: [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 not sup

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

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: > > >

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

2018-05-22 Thread Tiwei Bie
() for 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

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

2018-05-22 Thread Tiwei Bie
Signed-off-by: Tiwei Bie --- 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/virtio/virtio_ring.c @@ -1956,6

[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 --- drivers/virtio/virtio_ring.c | 801 +++ include/linux

[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 --- drivers/virtio/virtio_ring.c | 67 ++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index

[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 --- drivers/virtio/virtio_ring.c | 474 ++- 1 file changed, 468 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio

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

2018-05-22 Thread Tiwei Bie
Signed-off-by: Tiwei Bie --- 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/linux/virtio_config.h index

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, > > > >

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 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(). Thank

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 intro

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 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: > > >

[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 --- drivers/virtio/virtio_ring.c | 5 + include/uapi/linux/virtio_config.h | 8 +++- 2 files changed, 12

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. > > &

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 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 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 interrupts, th

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

2018-05-16 Thread Tiwei Bie
e() for 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 rin

[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 --- drivers/virtio/virtio_ring.c | 764 +++ include/linux

[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 --- drivers/virtio/virtio_ring.c | 491 ++- 1 file changed, 481 insertions(+), 10 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio

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

2018-05-16 Thread Tiwei Bie
Signed-off-by: Tiwei Bie --- 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/virtio/virtio_ring.c @@ -1940,6

[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 --- drivers/virtio/virtio_ring.c | 75 +--- 1 file changed, 70 insertions(+), 5 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index

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

2018-05-16 Thread Tiwei Bie
Signed-off-by: Tiwei Bie --- 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/linux/virtio_config.h index

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 > > --- > > drivers/virtio/virtio_ring.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/dri

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 > >>> --- > >>> drivers/virtio/virtio_ring.c | 2 ++ > >>> 1 file changed, 2 insertions(+) &

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 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 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 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

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

2018-04-24 Thread Tiwei Bie
d_packed() (Jason); - 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 rin

[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 --- drivers/virtio/virtio_ring.c | 764 --- include/linux

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

2018-04-24 Thread Tiwei Bie
kick is needed? Signed-off-by: Tiwei Bie --- 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 0181e93897be..b1039c2985b9 100644 --- a

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

2018-04-24 Thread Tiwei Bie
Signed-off-by: Tiwei Bie --- 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/virtio/virtio_ring.c @@ -1873,6

[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 --- drivers/virtio/virtio_ring.c | 444 ++- 1 file changed, 434 insertions(+), 10 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers

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

2018-04-24 Thread Tiwei Bie
Signed-off-by: Tiwei Bie --- 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/linux/virtio_config.h

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

2019-09-02 Thread Tiwei Bie
On Mon, Sep 02, 2019 at 12:15:05PM +0800, Jason Wang wrote: > On 2019/8/28 下午1:37, Tiwei Bie wrote: > > Details about this can be found here: > > > > https://lwn.net/Articles/750770/ > > > > What's new in this version > > == &

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

2019-09-03 Thread Tiwei Bie
On Tue, Sep 03, 2019 at 07:26:03AM -0400, Michael S. Tsirkin wrote: > On Wed, Aug 28, 2019 at 01:37:12PM +0800, Tiwei Bie wrote: > > Details about this can be found here: > > > > https://lwn.net/Articles/750770/ > > > > What's new in this version > > =

[PATCH 1/2] vhost/test: fix build for vhost test

2019-08-27 Thread Tiwei Bie
Since below commit, callers need to specify the iov_limit in vhost_dev_init() explicitly. Fixes: b46a0bf78ad7 ("vhost: fix OOB in get_rx_bufs()") Cc: sta...@vger.kernel.org Signed-off-by: Tiwei Bie --- drivers/vhost/test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) di

[PATCH 2/2] vhost/test: fix build for vhost test

2019-08-27 Thread Tiwei Bie
") Cc: sta...@vger.kernel.org Signed-off-by: Tiwei Bie --- drivers/vhost/test.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index ac4f762c4f65..7804869c6a31 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/

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

2019-08-27 Thread Tiwei Bie
sed to setup the device. And the device will report device_api as "vfio-vhost". Note that, there are dirty hacks in this version. If we decide to go this way, some refactoring in vhost.c/vhost.h may be needed. PS. The direct mapping of the notify registers isn't implemented

Re: [RFC PATCH 3/4] virtio: introudce a mdev based transport

2019-09-10 Thread Tiwei Bie
On Tue, Sep 10, 2019 at 04:19:34PM +0800, Jason Wang wrote: > This path introduces a new mdev transport for virtio. This is used to > use kernel virtio driver to drive the mediated device that is capable > of populating virtqueue directly. > > A new virtio-mdev driver will be registered to the mde

Re: [RFC PATCH 3/4] virtio: introudce a mdev based transport

2019-09-10 Thread Tiwei Bie
On Wed, Sep 11, 2019 at 10:52:03AM +0800, Jason Wang wrote: > On 2019/9/11 上午9:47, Tiwei Bie wrote: > > On Tue, Sep 10, 2019 at 04:19:34PM +0800, Jason Wang wrote: > > > This path introduces a new mdev transport for virtio. This is used to > > > use kernel virtio d

[RFC v4 0/3] vhost: introduce mdev based hardware backend

2019-09-16 Thread Tiwei Bie
do VHOST_MDEV_SET_BACKEND ioctl with VFIO group fd and device fd first before doing other vhost ioctls); Only compile test has been done for this series for now. RFCv3: https://patchwork.kernel.org/patch/7785/ [1] https://lkml.org/lkml/2019/9/10/135 Tiwei Bie (3): vfio: support getting

[RFC v4 1/3] vfio: support getting vfio device from device fd

2019-09-16 Thread Tiwei Bie
This patch introduces the support for getting VFIO device from VFIO device fd. With this support, it's possible for vhost to get VFIO device from the group fd and device fd set by the userspace. Signed-off-by: Tiwei Bie --- drivers/vfio/vfio.c | 25 + include/

[RFC v4 2/3] vfio: support checking vfio driver by device ops

2019-09-16 Thread Tiwei Bie
This patch introduces the support for checking the VFIO driver by device ops. And vfio-mdev's device ops is also exported to make it possible to check whether a VFIO device is based on a mdev device. Signed-off-by: Tiwei Bie --- drivers/vfio/mdev/vfio_mdev.c | 3 ++- drivers/vfio/v

[RFC v4 3/3] vhost: introduce mdev based hardware backend

2019-09-16 Thread Tiwei Bie
More details about this patch can be found from the cover letter for now. Only compile test has been done for now. Signed-off-by: Tiwei Bie --- drivers/vhost/Kconfig| 9 + drivers/vhost/Makefile | 3 + drivers/vhost/mdev.c | 462

Re: [RFC v4 0/3] vhost: introduce mdev based hardware backend

2019-09-17 Thread Tiwei Bie
On Tue, Sep 17, 2019 at 11:32:03AM +0800, Jason Wang wrote: > On 2019/9/17 上午9:02, Tiwei Bie wrote: > > This RFC is to demonstrate below ideas, > > > > a) Build vhost-mdev on top of the same abstraction defined in > > the virtio-mdev series [1]; > > >

Re: [RFC v4 0/3] vhost: introduce mdev based hardware backend

2019-09-19 Thread Tiwei Bie
On Thu, Sep 19, 2019 at 09:08:11PM +0800, Jason Wang wrote: > On 2019/9/18 下午10:32, Michael S. Tsirkin wrote: > > > > > So I have some questions: > > > > > > > > > > 1) Compared to method 2, what's the advantage of creating a new vhost > > > > > char > > > > > device? I guess it's for keep the AP

Re: [RFC v4 0/3] vhost: introduce mdev based hardware backend

2019-09-19 Thread Tiwei Bie
On Fri, Sep 20, 2019 at 09:30:58AM +0800, Jason Wang wrote: > On 2019/9/19 下午11:45, Tiwei Bie wrote: > > On Thu, Sep 19, 2019 at 09:08:11PM +0800, Jason Wang wrote: > > > On 2019/9/18 下午10:32, Michael S. Tsirkin wrote: > > > > > > > So I have some qu

Re: [RFC v4 3/3] vhost: introduce mdev based hardware backend

2019-09-19 Thread Tiwei Bie
On Tue, Sep 17, 2019 at 03:26:30PM +0800, Jason Wang wrote: > On 2019/9/17 上午9:02, Tiwei Bie wrote: > > diff --git a/drivers/vhost/mdev.c b/drivers/vhost/mdev.c > > new file mode 100644 > > index ..8c6597aff45e > > --- /dev/null > > +++ b/driver

[PATCH] vhost: introduce mdev based hardware backend

2019-09-25 Thread Tiwei Bie
this device, userspace can use vhost ioctls to setup the backend. Signed-off-by: Tiwei Bie --- This patch depends on below series: https://lkml.org/lkml/2019/9/24/357 RFC v4 -> v1: - Implement vhost-mdev as a mdev device driver directly and connect it to VFIO container/group. (Jason); - P

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

2019-09-26 Thread Tiwei Bie
On Thu, Sep 26, 2019 at 04:35:18AM -0400, Michael S. Tsirkin wrote: > On Thu, Sep 26, 2019 at 12:54:27PM +0800, Tiwei Bie wrote: [...] > > diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h > > index 40d028eed645..5afbc2f08fa3 100644 > > --- a/include/uapi/li

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

2019-09-26 Thread Tiwei Bie
On Thu, Sep 26, 2019 at 09:26:22AM -0400, Michael S. Tsirkin wrote: > On Thu, Sep 26, 2019 at 09:14:39PM +0800, Tiwei Bie wrote: > > > 4. Does device need to limit max ring size? > > > 5. Does device need to limit max number of queues? > > > > I think so. It'

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

2019-09-26 Thread Tiwei Bie
On Fri, Sep 27, 2019 at 11:51:35AM +0800, Jason Wang wrote: > On 2019/9/27 上午11:46, Jason Wang wrote: > > + > > +static struct mdev_class_id id_table[] = { > > +    { MDEV_ID_VHOST }, > > +    { 0 }, > > +}; > > + > > +static struct mdev_driver vhost_mdev_driver = { > > +    .name    = "vhost_mdev"

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

2019-09-26 Thread Tiwei Bie
On Fri, Sep 27, 2019 at 11:46:06AM +0800, Jason Wang wrote: > On 2019/9/26 下午12:54, Tiwei Bie wrote: > > + > > +static long vhost_mdev_start(struct vhost_mdev *m) > > +{ > > + struct mdev_device *mdev = m->mdev; > > + const struct virtio_mdev_dev

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

2019-09-27 Thread Tiwei Bie
On Fri, Sep 27, 2019 at 03:14:42PM +0800, Jason Wang wrote: > On 2019/9/27 下午12:54, Tiwei Bie wrote: > > > > + > > > > + /* > > > > +* In vhost-mdev, userspace should pass ring addresses > > > > +* in

[PATCH v2] vhost: introduce mdev based hardware backend

2019-10-22 Thread Tiwei Bie
this device, userspace can use vhost ioctls to setup the backend. Signed-off-by: Tiwei Bie --- This patch depends on below series: https://lkml.org/lkml/2019/10/17/286 v1 -> v2: - Replace _SET_STATE with _SET_STATUS (MST); - Check status bits at each step (MST); - Report the max ring size and

Re: [PATCH v2] vhost: introduce mdev based hardware backend

2019-10-22 Thread Tiwei Bie
On Tue, Oct 22, 2019 at 09:30:16PM +0800, Jason Wang wrote: > On 2019/10/22 下午5:52, Tiwei Bie wrote: > > This patch introduces a mdev based hardware vhost backend. > > This backend is built on top of the same abstraction used > > in virtio-mdev and provides a generi

Re: [PATCH v2] vhost: introduce mdev based hardware backend

2019-10-23 Thread Tiwei Bie
On Wed, Oct 23, 2019 at 01:46:23PM +0800, Jason Wang wrote: > On 2019/10/23 上午11:02, Tiwei Bie wrote: > > On Tue, Oct 22, 2019 at 09:30:16PM +0800, Jason Wang wrote: > > > On 2019/10/22 下午5:52, Tiwei Bie wrote: > > > > This patch introduces a mdev based hardware vhost

Re: [PATCH v2] vhost: introduce mdev based hardware backend

2019-10-23 Thread Tiwei Bie
On Wed, Oct 23, 2019 at 03:25:00PM +0800, Jason Wang wrote: > On 2019/10/23 下午3:07, Tiwei Bie wrote: > > On Wed, Oct 23, 2019 at 01:46:23PM +0800, Jason Wang wrote: > > > On 2019/10/23 上午11:02, Tiwei Bie wrote: > > > > On Tue, Oct 22, 2019 at 09:30:16PM +0800, Jason

[PATCH] virtio: support VIRTIO_F_ORDER_PLATFORM

2019-01-22 Thread Tiwei Bie
This patch introduces the support for VIRTIO_F_ORDER_PLATFORM. When this feature is negotiated, driver will use the barriers suitable for hardware devices. Signed-off-by: Tiwei Bie --- drivers/virtio/virtio_ring.c | 8 include/uapi/linux/virtio_config.h | 6 ++ 2 files

Re: [PATCH] virtio: support VIRTIO_F_ORDER_PLATFORM

2019-01-23 Thread Tiwei Bie
On Tue, Jan 22, 2019 at 11:04:29PM -0500, Michael S. Tsirkin wrote: > On Wed, Jan 23, 2019 at 01:03:46AM +0800, Tiwei Bie wrote: > > This patch introduces the support for VIRTIO_F_ORDER_PLATFORM. > > When this feature is negotiated, driver will use the barriers > > suitable

[PATCH v2] virtio: support VIRTIO_F_ORDER_PLATFORM

2019-01-23 Thread Tiwei Bie
but not accepted. Signed-off-by: Tiwei Bie --- v2: - Add more explanations in commit log (MST); drivers/virtio/virtio_ring.c | 8 include/uapi/linux/virtio_config.h | 6 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio

Re: [PATCH] virtio: drop internal struct from UAPI

2019-02-01 Thread Tiwei Bie
On Fri, Feb 01, 2019 at 05:16:01PM -0500, Michael S. Tsirkin wrote: > There's no reason to expose struct vring_packed in UAPI - if we do we > won't be able to change or drop it, and it's not part of any interface. > > Let's move it to virtio_ring.c > > Cc:

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

2019-07-03 Thread Tiwei Bie
zeof(queue_idx), vfio->notify_offset + offset); .. } 3. VFIO interrupt ioctl API VFIO interrupt ioctl API is used to setup device interrupts. IRQ-bypass can also be supported. Currently, the data path interrupt can be configured via the VFIO_VHOST_VQ_IR

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

2019-07-03 Thread Tiwei Bie
On Wed, Jul 03, 2019 at 06:09:51PM +0800, Jason Wang wrote: > On 2019/7/3 下午5:13, Tiwei Bie wrote: > > Details about this can be found here: > > > > https://lwn.net/Articles/750770/ > > > > What's new in this version > > == &

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

2019-07-03 Thread Tiwei Bie
On Wed, Jul 03, 2019 at 08:16:23PM +0800, Jason Wang wrote: > On 2019/7/3 下午7:52, Tiwei Bie wrote: > > On Wed, Jul 03, 2019 at 06:09:51PM +0800, Jason Wang wrote: > > > On 2019/7/3 下午5:13, Tiwei Bie wrote: > > > > Details about this can be found here: > > &

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

2019-07-03 Thread Tiwei Bie
On Wed, Jul 03, 2019 at 12:31:57PM -0600, Alex Williamson wrote: > On Wed, 3 Jul 2019 17:13:39 +0800 > Tiwei Bie wrote: > > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h > > index 8f10748dac79..6c5718ab7eeb 100644 > > --- a/include/uapi/linux/vfio.

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

2019-07-03 Thread Tiwei Bie
On Thu, Jul 04, 2019 at 12:31:48PM +0800, Jason Wang wrote: > On 2019/7/3 下午9:08, Tiwei Bie wrote: > > On Wed, Jul 03, 2019 at 08:16:23PM +0800, Jason Wang wrote: > > > On 2019/7/3 下午7:52, Tiwei Bie wrote: > > > > On Wed, Jul 03, 2019 at 06:09:51PM +0800, Jason Wang w

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

2019-07-04 Thread Tiwei Bie
On Thu, Jul 04, 2019 at 02:35:20PM +0800, Jason Wang wrote: > On 2019/7/4 下午2:21, Tiwei Bie wrote: > > On Thu, Jul 04, 2019 at 12:31:48PM +0800, Jason Wang wrote: > > > On 2019/7/3 下午9:08, Tiwei Bie wrote: > > > > On Wed, Jul 03, 2019 at 08:16:23PM +0800, Jason Wang w

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

2019-07-04 Thread Tiwei Bie
On Fri, Jul 05, 2019 at 08:30:00AM +0800, Jason Wang wrote: > On 2019/7/4 下午3:02, Tiwei Bie wrote: > > On Thu, Jul 04, 2019 at 02:35:20PM +0800, Jason Wang wrote: > > > On 2019/7/4 下午2:21, Tiwei Bie wrote: > > > > On Thu, Jul 04, 2019 at 12:31:48PM +0800, Jason Wang w

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

2019-07-07 Thread Tiwei Bie
On Fri, Jul 05, 2019 at 08:49:46AM -0600, Alex Williamson wrote: > On Thu, 4 Jul 2019 14:21:34 +0800 > Tiwei Bie wrote: > > On Thu, Jul 04, 2019 at 12:31:48PM +0800, Jason Wang wrote: > > > On 2019/7/3 下午9:08, Tiwei Bie wrote: > > > > On Wed, Jul 03, 2019 at 0

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

2019-07-08 Thread Tiwei Bie
On Tue, Jul 09, 2019 at 10:50:38AM +0800, Jason Wang wrote: > On 2019/7/8 下午2:16, Tiwei Bie wrote: > > On Fri, Jul 05, 2019 at 08:49:46AM -0600, Alex Williamson wrote: > > > On Thu, 4 Jul 2019 14:21:34 +0800 > > > Tiwei Bie wrote: > > > > On Thu, Jul 04, 201

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

2019-07-09 Thread Tiwei Bie
On Wed, Jul 10, 2019 at 10:26:10AM +0800, Jason Wang wrote: > On 2019/7/9 下午2:33, Tiwei Bie wrote: > > On Tue, Jul 09, 2019 at 10:50:38AM +0800, Jason Wang wrote: > > > On 2019/7/8 下午2:16, Tiwei Bie wrote: > > > > On Fri, Jul 05, 2019 at 08:49:46AM -0600, Alex William

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

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-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.

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, > +

[RFC v2] virtio: support packed ring

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

  1   2   >