[RFC,v4,0/5] vhost: ring format independence
mbox series

Message ID 20191013113940.2863-1-mst@redhat.com
Headers show
Series
  • vhost: ring format independence
Related show

Message

Michael S. Tsirkin Oct. 13, 2019, 11:41 a.m. UTC
This adds infrastructure required for supporting
multiple ring formats.

The idea is as follows: we convert descriptors to an
independent format first, and process that converting to
iov later.

The point is that we have a tight loop that fetches
descriptors, which is good for cache utilization.
This will also allow all kind of batching tricks -
e.g. it seems possible to keep SMAP disabled while
we are fetching multiple descriptors.

This seems to perform exactly the same as the original
code already based on a microbenchmark.
Lightly tested.
More testing would be very much appreciated.

To use new code:
	echo 1 > /sys/module/vhost_test/parameters/newcode
or
	echo 1 > /sys/module/vhost_net/parameters/newcode

changes from v3:
        - fixed error handling in case of indirect descriptors
        - add BUG_ON to detect buffer overflow in case of bugs
                in response to comment by Jason Wang
        - minor code tweaks

Changes from v2:
	- fixed indirect descriptor batching
                reported by Jason Wang

Changes from v1:
	- typo fixes


Michael S. Tsirkin (5):
  vhost: option to fetch descriptors through an independent struct
  vhost/test: add an option to test new code
  vhost: batching fetches
  vhost/net: add an option to test new code
  vhost: last descriptor must have NEXT clear

 drivers/vhost/net.c   |  32 ++++-
 drivers/vhost/test.c  |  19 ++-
 drivers/vhost/vhost.c | 328 +++++++++++++++++++++++++++++++++++++++++-
 drivers/vhost/vhost.h |  20 ++-
 4 files changed, 385 insertions(+), 14 deletions(-)

Comments

Jason Wang Oct. 15, 2019, 2:58 a.m. UTC | #1
On 2019/10/13 下午7:41, Michael S. Tsirkin wrote:
> This adds infrastructure required for supporting
> multiple ring formats.
>
> The idea is as follows: we convert descriptors to an
> independent format first, and process that converting to
> iov later.
>
> The point is that we have a tight loop that fetches
> descriptors, which is good for cache utilization.
> This will also allow all kind of batching tricks -
> e.g. it seems possible to keep SMAP disabled while
> we are fetching multiple descriptors.
>
> This seems to perform exactly the same as the original
> code already based on a microbenchmark.
> Lightly tested.
> More testing would be very much appreciated.
>
> To use new code:
> 	echo 1 > /sys/module/vhost_test/parameters/newcode
> or
> 	echo 1 > /sys/module/vhost_net/parameters/newcode
>
> changes from v3:
>          - fixed error handling in case of indirect descriptors
>          - add BUG_ON to detect buffer overflow in case of bugs
>                  in response to comment by Jason Wang
>          - minor code tweaks
>
> Changes from v2:
> 	- fixed indirect descriptor batching
>                  reported by Jason Wang
>
> Changes from v1:
> 	- typo fixes


I've just done some quick benchmark with testpmd + vhost_net txonly.

With 256 queue size, no difference but in 1024 queue size 1% regression 
of PPS were found.

Thanks


>
>
> Michael S. Tsirkin (5):
>    vhost: option to fetch descriptors through an independent struct
>    vhost/test: add an option to test new code
>    vhost: batching fetches
>    vhost/net: add an option to test new code
>    vhost: last descriptor must have NEXT clear
>
>   drivers/vhost/net.c   |  32 ++++-
>   drivers/vhost/test.c  |  19 ++-
>   drivers/vhost/vhost.c | 328 +++++++++++++++++++++++++++++++++++++++++-
>   drivers/vhost/vhost.h |  20 ++-
>   4 files changed, 385 insertions(+), 14 deletions(-)
>