virtio: support packed ring
Subsystems (6)
PATCH v2 4/5 virtio_ring: add event idx support in packed ring
In reply to Tiwei BieThis commit introduces the EVENT_IDX support in packed ring.
--- drivers/virtio/virtio_ring.c | 73 ++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 8 deletions(-)
drivers/virtio/virtio_ring.c +65 -8
@@ -1050,7 +1050,7 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq,static bool virtqueue_kick_prepare_packed (struct virtqueue *_vq) {struct vring_virtqueue *vq =to_vvq (_vq); -u16 flags; +u16 new, old, off_wrap, flags, wrap_counter, event_idx;bool needs_kick;u32 snapshot;
@@ -1059,9 +1059,19 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq)* suppressions. */ virtio_mb (vq->weak_barriers); + old = vq->next_avail_idx - vq->num_added; + new = vq->next_avail_idx; + vq->num_added =0 ; + snapshot =READ_ONCE (*(u32 *)vq->vring_packed.device); + off_wrap =virtio16_to_cpu (_vq->vdev, (__virtio16)(snapshot &0xffff )); flags =virtio16_to_cpu (_vq->vdev, (__virtio16)(snapshot >>16 )) &0x3 ; + wrap_counter = off_wrap >>15 ; + event_idx = off_wrap & ~(1 <<15 ); +if (wrap_counter != vq->avail_wrap_counter) + event_idx -= vq->vring_packed.num; +#ifdef DEBUG if (vq->last_add_time_valid) { WARN_ON(ktime_to_ms(ktime_sub(ktime_get(),
@@ -1070,7 +1080,10 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) vq->last_add_time_valid = false;#endif - needs_kick = (flags !=VRING_EVENT_F_DISABLE ); +if (flags ==VRING_EVENT_F_DESC ) + needs_kick =vring_need_event (event_idx, new, old); +else + needs_kick = (flags !=VRING_EVENT_F_DISABLE );END_USE (vq);return needs_kick; }
@@ -1185,6 +1198,15 @@ static void *virtqueue_get_buf_ctx_packed(struct virtqueue *_vq, ret = vq->desc_state_packed[id].data;detach_buf_packed (vq, id, ctx); +/* If we expect an interrupt for the next entry, tell host +* by writing event index and flush out the write before +* the read in the next get_buf call. */ +if (vq->event_flags_shadow ==VRING_EVENT_F_DESC ) +virtio_store_mb (vq->weak_barriers, + &vq->vring_packed.driver->off_wrap, +cpu_to_virtio16 (_vq->vdev, vq->last_used_idx | + ((u16 )vq->used_wrap_counter <<15 ))); +#ifdef DEBUG vq->last_add_time_valid = false;#endif
@@ -1213,8 +1235,18 @@ static unsigned virtqueue_enable_cb_prepare_packed(struct virtqueue *_vq)/* We optimistically turn back on interrupts, then check if there was * more to do. */ +if (vq->event) { + vq->vring_packed.driver->off_wrap =cpu_to_virtio16 (_vq->vdev, + vq->last_used_idx | + ((u16 )vq->used_wrap_counter <<15 )); +/* We need to update event offset and event wrap +* counter first before updating event flags. */ +virtio_wmb (vq->weak_barriers); + } +if (vq->event_flags_shadow ==VRING_EVENT_F_DISABLE ) { - vq->event_flags_shadow =VRING_EVENT_F_ENABLE ; + vq->event_flags_shadow = vq->event ?VRING_EVENT_F_DESC : +VRING_EVENT_F_ENABLE ; vq->vring_packed.driver->flags =cpu_to_virtio16 (_vq->vdev, vq->event_flags_shadow); }
@@ -1238,22 +1270,47 @@ static bool virtqueue_poll_packed(struct virtqueue *_vq, unsigned off_wrap)static bool virtqueue_enable_cb_delayed_packed (struct virtqueue *_vq) {struct vring_virtqueue *vq =to_vvq (_vq); +u16 bufs, used_idx, wrap_counter;START_USE (vq);/* We optimistically turn back on interrupts, then check if there was * more to do. */ +if (vq->event) { +/* TODO: tune this threshold */ + bufs = (vq->vring_packed.num - _vq->num_free) *3 /4 ; + wrap_counter = vq->used_wrap_counter; + + used_idx = vq->last_used_idx + bufs; +if (used_idx >= vq->vring_packed.num) { + used_idx -= vq->vring_packed.num; + wrap_counter ^=1 ; + } + + vq->vring_packed.driver->off_wrap =cpu_to_virtio16 (_vq->vdev, + used_idx | (wrap_counter <<15 )); + +/* We need to update event offset and event wrap +* counter first before updating event flags. */ +virtio_wmb (vq->weak_barriers); + }else { + used_idx = vq->last_used_idx; + wrap_counter = vq->used_wrap_counter; + } +if (vq->event_flags_shadow ==VRING_EVENT_F_DISABLE ) { - vq->event_flags_shadow =VRING_EVENT_F_ENABLE ; + vq->event_flags_shadow = vq->event ?VRING_EVENT_F_DESC : +VRING_EVENT_F_ENABLE ; vq->vring_packed.driver->flags =cpu_to_virtio16 (_vq->vdev, vq->event_flags_shadow); -/* We need to enable interrupts first before re-checking -* for more used buffers. */ -virtio_mb (vq->weak_barriers); } -if (more_used_packed (vq)) { +/* We need to update event suppression structure first +* before re-checking for more used buffers. */ +virtio_mb (vq->weak_barriers); + +if (is_used_desc_packed (vq, used_idx, wrap_counter)) {END_USE (vq);return false; }
Signature · 1 line
2.18.0
PATCH v2 5/5 virtio_ring: enable packed ring
In reply to Tiwei Bie--- drivers/s390/virtio/virtio_ccw.c | 14 ++++++++++++++ drivers/virtio/virtio_ring.c | 2 ++ 2 files changed, 16 insertions(+)
drivers/s390/virtio/virtio_ccw.c +14 -0
@@ -765,6 +765,17 @@ static u64 virtio_ccw_get_features(struct virtio_device *vdev)return rc; } +static void ccw_transport_features (struct virtio_device *vdev) +{ +/* +* Packed ring isn't enabled on virtio_ccw for now, +* because virtio_ccw uses some legacy accessors, +* e.g. virtqueue_get_avail() and virtqueue_get_used() +* which aren't available in packed ring currently. +*/ +__virtio_clear_bit (vdev,VIRTIO_F_RING_PACKED ); +} +static int virtio_ccw_finalize_features (struct virtio_device *vdev) {struct virtio_ccw_device *vcdev =to_vc_device (vdev);
@@ -791,6 +802,9 @@ static int virtio_ccw_finalize_features(struct virtio_device *vdev)/* Give virtio_ring a chance to accept features. */ vring_transport_features (vdev); +/* Give virtio_ccw a chance to accept features. */ +ccw_transport_features (vdev); + features->index =0 ; features->features =cpu_to_le32 ((u32 )vdev->features);/* Write the first half of the feature bits to the host. */
drivers/virtio/virtio_ring.c +2 -0
@@ -1968,6 +1968,8 @@ void vring_transport_features(struct virtio_device *vdev)break ;case VIRTIO_F_IOMMU_PLATFORM :break ; +case VIRTIO_F_RING_PACKED : +break ;default :/* We don't understand this bit. */ __virtio_clear_bit (vdev, i);
Signature · 1 line
2.18.0
PATCH v2 5/5 virtio_ring: enable packed ring
In reply to Tiwei Bie--- drivers/s390/virtio/virtio_ccw.c | 14 ++++++++++++++ drivers/virtio/virtio_ring.c | 2 ++ 2 files changed, 16 insertions(+)
drivers/s390/virtio/virtio_ccw.c +14 -0
@@ -765,6 +765,17 @@ static u64 virtio_ccw_get_features(struct virtio_device *vdev)return rc; } +static void ccw_transport_features (struct virtio_device *vdev) +{ +/* +* Packed ring isn't enabled on virtio_ccw for now, +* because virtio_ccw uses some legacy accessors, +* e.g. virtqueue_get_avail() and virtqueue_get_used() +* which aren't available in packed ring currently. +*/ +__virtio_clear_bit (vdev,VIRTIO_F_RING_PACKED ); +} +static int virtio_ccw_finalize_features (struct virtio_device *vdev) {struct virtio_ccw_device *vcdev =to_vc_device (vdev);
@@ -791,6 +802,9 @@ static int virtio_ccw_finalize_features(struct virtio_device *vdev)/* Give virtio_ring a chance to accept features. */ vring_transport_features (vdev); +/* Give virtio_ccw a chance to accept features. */ +ccw_transport_features (vdev); + features->index =0 ; features->features =cpu_to_le32 ((u32 )vdev->features);/* Write the first half of the feature bits to the host. */
drivers/virtio/virtio_ring.c +2 -0
@@ -1968,6 +1968,8 @@ void vring_transport_features(struct virtio_device *vdev)break ;case VIRTIO_F_IOMMU_PLATFORM :break ; +case VIRTIO_F_RING_PACKED : +break ;default :/* We don't understand this bit. */ __virtio_clear_bit (vdev, i);
Signature · 1 line
2.18.0
Quoted 76 lines · Tiwei Bie
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ring
Quoted 7 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)
Thanks!
Quoted 76 lines · Tiwei Bie
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ring
Quoted 7 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)
Thanks!
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
David Miller
maintainerFrom: Tiwei Bie <[email protected]>
Date: Wed, 11 Jul 2018 10:27:06 +0800
Quoted 10 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
Michael and Jason, where are we with this series?
Jason Wang
Acked-byQuoted 7 lines · David Miller
From: Tiwei Bie <[email protected]>
Date: Wed, 11 Jul 2018 10:27:06 +0800Quoted 4 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Quoted 7 lines
Quoted 6 lines
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
Michael and Jason, where are we with this series?
For the series:
Jason Wang
Acked-byQuoted 7 lines · David Miller
From: Tiwei Bie <[email protected]>
Date: Wed, 11 Jul 2018 10:27:06 +0800Quoted 4 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Quoted 7 lines
Quoted 6 lines
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
Michael and Jason, where are we with this series?
For the series:
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 7 lines · David Miller
From: Tiwei Bie <[email protected]>
Date: Wed, 11 Jul 2018 10:27:06 +0800Quoted 4 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Quoted 8 lines
Quoted 6 lines
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
Michael and Jason, where are we with this series?
I'm at netdev, won't be able to review before Monday.
Signature · 1 line
MST
Michael S. Tsirkin
maintainerQuoted 7 lines · David Miller
From: Tiwei Bie <[email protected]>
Date: Wed, 11 Jul 2018 10:27:06 +0800Quoted 4 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Quoted 8 lines
Quoted 6 lines
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
Michael and Jason, where are we with this series?
I'm at netdev, won't be able to review before Monday.
Signature · 1 line
MST
Michael S. Tsirkin
maintainerAre there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
Quoted 85 lines · Tiwei Bie
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringdrivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0
Quoted 2 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
Yes, I'm having trouble getting it to work with virtio PMD (it works with Tiweis guest driver though), but I'm getting closer. Should only be 1-2 more days.
regards,
Jens
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return XDP_DROP directly. And in host, testpmd will do txonly fwd.
When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Quoted 92 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Michael S. Tsirkin
maintainerQuoted 27 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
Quoted 93 lines
Quoted 93 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Quoted 34 lines · Michael S. Tsirkin
Quoted 27 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Quoted 3 lines
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
The virtio PMD (drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs. So the ID management for the Rx ring can be quite simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.
But in kernel virtio driver, the virtio_ring.c is very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel's virtio_ring.c isn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes in virtio_ring.c, which shouldn't be part of this patch set. So I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.
Quoted 95 lines
Quoted 95 lines
Quoted 95 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Quoted 36 lines · Tiwei Bie
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 8 lines
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
Quoted 11 lines
The virtio PMD (
drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs. So the ID management for the Rx ring can be quite simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.
Yes it is. I think I've pointed it out in some early version of pmd patch. So I suspect part (or all) of the boost may come from in order feature.
Quoted 10 lines
But in kernel virtio driver, the
virtio_ring.cis very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel'svirtio_ring.cisn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes invirtio_ring.c, which shouldn't be part of this patch set.
Could you please share more thoughts on this e.g how to improve the API? Notice since the API is shared by both split ring and packed ring, it may improve the performance of split ring as well. One can easily imagine a batching API, but it does not have many real users now, the only case is the XDP transmission which can accept an array of XDP frames.
Quoted 4 lines
So
I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.
We can only gain when virtio ring layout is the bottleneck. If there're bottlenecks elsewhere, we probably won't see any increasing in the numbers. Vhost-net is an example, and lots of optimizations have proved that virtio ring is not the main bottleneck for the current codes. I suspect it also the case of virtio driver. Did perf tell us any interesting things in virtio driver?
Thanks
Quoted 92 lines
Quoted 92 lines
Quoted 92 lines
Quoted 92 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Quoted 63 lines · Jason Wang
Quoted 36 lines · Tiwei Bie
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 8 lines
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
Quoted 11 lines
The virtio PMD (
drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs. So the ID management for the Rx ring can be quite simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.Yes it is. I think I've pointed it out in some early version of pmd patch. So I suspect part (or all) of the boost may come from in order feature.
Quoted 10 lines
But in kernel virtio driver, the
virtio_ring.cis very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel'svirtio_ring.cisn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes invirtio_ring.c, which shouldn't be part of this patch set.
Quoted 5 lines
Could you please share more thoughts on this e.g how to improve the API? Notice since the API is shared by both split ring and packed ring, it may improve the performance of split ring as well. One can easily imagine a batching API, but it does not have many real users now, the only case is the XDP transmission which can accept an array of XDP frames.
I don't have detailed thoughts on this yet. But kernel's virtio_ring.c is quite generic compared with what we did in virtio PMD.
Quoted 108 lines
Quoted 5 lines
So
I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.We can only gain when virtio ring layout is the bottleneck. If there're bottlenecks elsewhere, we probably won't see any increasing in the numbers. Vhost-net is an example, and lots of optimizations have proved that virtio ring is not the main bottleneck for the current codes. I suspect it also the case of virtio driver. Did perf tell us any interesting things in virtio driver?
Thanks
Quoted 92 lines
Quoted 92 lines
Quoted 92 lines
Quoted 92 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Michael S. Tsirkin
maintainerQuoted 70 lines · Tiwei Bie
Quoted 63 lines · Jason Wang
Quoted 36 lines · Tiwei Bie
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 8 lines
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
Quoted 11 lines
The virtio PMD (
drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs. So the ID management for the Rx ring can be quite simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.Yes it is. I think I've pointed it out in some early version of pmd patch. So I suspect part (or all) of the boost may come from in order feature.
Quoted 10 lines
But in kernel virtio driver, the
virtio_ring.cis very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel'svirtio_ring.cisn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes invirtio_ring.c, which shouldn't be part of this patch set.Quoted 5 lines
Could you please share more thoughts on this e.g how to improve the API? Notice since the API is shared by both split ring and packed ring, it may improve the performance of split ring as well. One can easily imagine a batching API, but it does not have many real users now, the only case is the XDP transmission which can accept an array of XDP frames.
Quoted 3 lines
I don't have detailed thoughts on this yet. But kernel's
virtio_ring.cis quite generic compared with what we did in virtio PMD.
In what way? What are some things that aren't implemented there?
If what you say is true then we should take a careful look and not supporting these generic things with packed layout. Once we do support them it will be too late and we won't be able to get performance back.
Quoted 108 lines
Quoted 108 lines
Quoted 5 lines
So
I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.We can only gain when virtio ring layout is the bottleneck. If there're bottlenecks elsewhere, we probably won't see any increasing in the numbers. Vhost-net is an example, and lots of optimizations have proved that virtio ring is not the main bottleneck for the current codes. I suspect it also the case of virtio driver. Did perf tell us any interesting things in virtio driver?
Thanks
Quoted 92 lines
Quoted 92 lines
Quoted 92 lines
Quoted 92 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Quoted 71 lines · Michael S. Tsirkin
Quoted 70 lines · Tiwei Bie
Quoted 68 lines · Jason Wang
Quoted 36 lines · Tiwei Bie
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 8 lines
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
Quoted 11 lines
The virtio PMD (
drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs. So the ID management for the Rx ring can be quite simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.Yes it is. I think I've pointed it out in some early version of pmd patch. So I suspect part (or all) of the boost may come from in order feature.
Quoted 10 lines
But in kernel virtio driver, the
virtio_ring.cis very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel'svirtio_ring.cisn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes invirtio_ring.c, which shouldn't be part of this patch set.Could you please share more thoughts on this e.g how to improve the API? Notice since the API is shared by both split ring and packed ring, it may improve the performance of split ring as well. One can easily imagine a batching API, but it does not have many real users now, the only case is the XDP transmission which can accept an array of XDP frames.
Quoted 5 lines
Quoted 3 lines
I don't have detailed thoughts on this yet. But kernel's
virtio_ring.cis quite generic compared with what we did in virtio PMD.In what way? What are some things that aren't implemented there?
Below is the code corresponding to the virtqueue_add() for Rx ring in virtio PMD:
https://github.com/DPDK/dpdk/blob/3605968c2fa7/drivers/net/virtio/virtio_rxtx.c#L278-L304
And below is the code of virtqueue_add() in Linux:
https://github.com/torvalds/linux/blob/54eda9df17f3/drivers/virtio/virtio_ring.c#L275-L417
In virtio PMD, for each packet (mbuf), the code is pretty straightforward, it will just check whether there is one available desc. If it's true, it will just fill this desc directly.
But in virtqueue_add(), it's obvious that, the logic is much more complicated or generic. It's supposed to be able to handle sglist (which may consist of multiple IN buffers and multiple OUT buffers at the same time), and it will try to use indirect descriptors. Then it needs several loops to parse the sglist. That's why I said it's quite generic.
Quoted 5 lines
If what you say is true then we should take a careful look and not supporting these generic things with packed layout. Once we do support them it will be too late and we won't be able to get performance back.
I think it's a good point that we don't need to support everything in packed ring (especially these which would hurt the performance), as the packed ring aims at high performance. I'm also wondering about the features. Is there any possibility that we won't support the out of order processing (at least not by default) in packed ring? If I didn't miss anything, the need to support out of order processing in packed ring will make the data structure inside the driver not cache friendly which is similar to the case of the descriptor table in the split ring (the difference is that, it only happens in driver now).
Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 8 lines
So
I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.We can only gain when virtio ring layout is the bottleneck. If there're bottlenecks elsewhere, we probably won't see any increasing in the numbers. Vhost-net is an example, and lots of optimizations have proved that virtio ring is not the main bottleneck for the current codes. I suspect it also the case of virtio driver. Did perf tell us any interesting things in virtio driver?
Thanks
Quoted 92 lines
Quoted 92 lines
Quoted 92 lines
Quoted 92 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Quoted 4 lines · Tiwei Bie
Quoted 4 lines
If what you say is true then we should take a careful look and not supporting these generic things with packed layout. Once we do support them it will be too late and we won't be able to get performance back.
Quoted 11 lines
I think it's a good point that we don't need to support everything in packed ring (especially these which would hurt the performance), as the packed ring aims at high performance. I'm also wondering about the features. Is there any possibility that we won't support the out of order processing (at least not by default) in packed ring? If I didn't miss anything, the need to support out of order processing in packed ring will make the data structure inside the driver not cache friendly which is similar to the case of the descriptor table in the split ring (the difference is that, it only happens in driver now).
Out of order is not the only user, DMA is another one. We don't have used ring(len), so we need to maintain buffer length somewhere even for in order device. 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 driver.
Thanks
Michael S. Tsirkin
maintainerQuoted 19 lines · Jason Wang
Quoted 4 lines · Tiwei Bie
Quoted 4 lines
If what you say is true then we should take a careful look and not supporting these generic things with packed layout. Once we do support them it will be too late and we won't be able to get performance back.
Quoted 11 lines
I think it's a good point that we don't need to support everything in packed ring (especially these which would hurt the performance), as the packed ring aims at high performance. I'm also wondering about the features. Is there any possibility that we won't support the out of order processing (at least not by default) in packed ring? If I didn't miss anything, the need to support out of order processing in packed ring will make the data structure inside the driver not cache friendly which is similar to the case of the descriptor table in the split ring (the difference is that, it only happens in driver now).
Quoted 3 lines
Out of order is not the only user, DMA is another one. We don't have used ring(len), so we need to maintain buffer length somewhere even for in order device.
For a bunch of systems dma unmap is a nop so we do not really need to maintain it. It's a question of an API to detect that and optimize for it. I posted a proposed patch for that - want to try using that?
Quoted 4 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about IN_ORDER, then if devices are in order it will get enabled by default.
Signature · 1 line
MST
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Jason Wang
Quoted 15 lines · Tiwei Bie
Quoted 4 lines
If what you say is true then we should take a careful look and not supporting these generic things with packed layout. Once we do support them it will be too late and we won't be able to get performance back.
I think it's a good point that we don't need to support everything in packed ring (especially these which would hurt the performance), as the packed ring aims at high performance. I'm also wondering about the features. Is there any possibility that we won't support the out of order processing (at least not by default) in packed ring? If I didn't miss anything, the need to support out of order processing in packed ring will make the data structure inside the driver not cache friendly which is similar to the case of the descriptor table in the split ring (the difference is that, it only happens in driver now).
Quoted 8 lines
Quoted 3 lines
Out of order is not the only user, DMA is another one. We don't have used ring(len), so we need to maintain buffer length somewhere even for in order device.
For a bunch of systems dma unmap is a nop so we do not really need to maintain it. It's a question of an API to detect that and optimize for it. I posted a proposed patch for that - want to try using that?
Yeah, definitely!
Quoted 11 lines
Quoted 5 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about
IN_ORDER, then if devices are in order it will get enabled by default.
Yeah, make sense.
Besides, I have done some further profiling and debugging both in kernel driver and DPDK vhost. Previously I was mislead by a bug in vhost code. I will send a patch to fix that bug. With that bug fixed, the performance of packed ring in the test between kernel driver and DPDK vhost is better now. I will send a new series soon. Thanks!
Quoted 3 lines
Signature · 2 lines
-- MST
Michael S. Tsirkin
maintainerQuoted 11 lines · Tiwei Bie
Quoted 10 lines
Quoted 4 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about
IN_ORDER, then if devices are in order it will get enabled by default.
Quoted 7 lines
Yeah, make sense.
Besides, I have done some further profiling and debugging both in kernel driver and DPDK vhost. Previously I was mislead by a bug in vhost code. I will send a patch to fix that bug. With that bug fixed, the performance of packed ring in the test between kernel driver and DPDK vhost is better now.
OK, if we get a performance gain on the virtio side, we can finally upstream it. If you see that please re-post ASAP so we can put it in the next kernel release.
Signature · 1 line
MST
Quoted 20 lines · Michael S. Tsirkin
Quoted 11 lines · Tiwei Bie
Quoted 10 lines
Quoted 4 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about
IN_ORDER, then if devices are in order it will get enabled by default.Quoted 7 lines
Yeah, make sense.
Besides, I have done some further profiling and debugging both in kernel driver and DPDK vhost. Previously I was mislead by a bug in vhost code. I will send a patch to fix that bug. With that bug fixed, the performance of packed ring in the test between kernel driver and DPDK vhost is better now.
Quoted 3 lines
OK, if we get a performance gain on the virtio side, we can finally upstream it. If you see that please re-post ASAP so we can put it in the next kernel release.
Got it, I will re-post ASAP.
Thanks!
Quoted 3 lines
Signature · 2 lines
-- MST
Quoted 20 lines · Michael S. Tsirkin
Quoted 11 lines · Tiwei Bie
Quoted 10 lines
Quoted 4 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about
IN_ORDER, then if devices are in order it will get enabled by default.Quoted 7 lines
Yeah, make sense.
Besides, I have done some further profiling and debugging both in kernel driver and DPDK vhost. Previously I was mislead by a bug in vhost code. I will send a patch to fix that bug. With that bug fixed, the performance of packed ring in the test between kernel driver and DPDK vhost is better now.
Quoted 3 lines
OK, if we get a performance gain on the virtio side, we can finally upstream it. If you see that please re-post ASAP so we can put it in the next kernel release.
Got it, I will re-post ASAP.
Thanks!
Quoted 3 lines
Signature · 2 lines
-- MST
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Michael S. Tsirkin
maintainerQuoted 21 lines · Tiwei Bie
Quoted 20 lines · Michael S. Tsirkin
Quoted 18 lines · Tiwei Bie
Quoted 10 lines
Quoted 4 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about
IN_ORDER, then if devices are in order it will get enabled by default.Yeah, make sense.
Besides, I have done some further profiling and debugging both in kernel driver and DPDK vhost. Previously I was mislead by a bug in vhost code. I will send a patch to fix that bug. With that bug fixed, the performance of packed ring in the test between kernel driver and DPDK vhost is better now.
Quoted 7 lines
Quoted 3 lines
OK, if we get a performance gain on the virtio side, we can finally upstream it. If you see that please re-post ASAP so we can put it in the next kernel release.
Got it, I will re-post ASAP.
Thanks!
Pls remember to include data on performance gain in the cover letter.
Quoted 4 lines
Quoted 4 lines
Signature · 2 lines
-- MST
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Tiwei Bie
Quoted 23 lines · Michael S. Tsirkin
Quoted 11 lines · Tiwei Bie
Quoted 10 lines
Quoted 4 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about
IN_ORDER, then if devices are in order it will get enabled by default.Quoted 7 lines
Yeah, make sense.
Besides, I have done some further profiling and debugging both in kernel driver and DPDK vhost. Previously I was mislead by a bug in vhost code. I will send a patch to fix that bug. With that bug fixed, the performance of packed ring in the test between kernel driver and DPDK vhost is better now.
OK, if we get a performance gain on the virtio side, we can finally upstream it. If you see that please re-post ASAP so we can put it in the next kernel release.
Quoted 6 lines
Quoted 3 lines
Got it, I will re-post ASAP.
Thanks!
Pls remember to include data on performance gain in the cover letter.
Sure. I'll try to include some performance analyses.
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Tiwei Bie
Quoted 23 lines · Michael S. Tsirkin
Quoted 11 lines · Tiwei Bie
Quoted 10 lines
Quoted 4 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about
IN_ORDER, then if devices are in order it will get enabled by default.Quoted 7 lines
Yeah, make sense.
Besides, I have done some further profiling and debugging both in kernel driver and DPDK vhost. Previously I was mislead by a bug in vhost code. I will send a patch to fix that bug. With that bug fixed, the performance of packed ring in the test between kernel driver and DPDK vhost is better now.
OK, if we get a performance gain on the virtio side, we can finally upstream it. If you see that please re-post ASAP so we can put it in the next kernel release.
Quoted 6 lines
Quoted 3 lines
Got it, I will re-post ASAP.
Thanks!
Pls remember to include data on performance gain in the cover letter.
Sure. I'll try to include some performance analyses.
Michael S. Tsirkin
maintainerQuoted 21 lines · Tiwei Bie
Quoted 20 lines · Michael S. Tsirkin
Quoted 18 lines · Tiwei Bie
Quoted 10 lines
Quoted 4 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about
IN_ORDER, then if devices are in order it will get enabled by default.Yeah, make sense.
Besides, I have done some further profiling and debugging both in kernel driver and DPDK vhost. Previously I was mislead by a bug in vhost code. I will send a patch to fix that bug. With that bug fixed, the performance of packed ring in the test between kernel driver and DPDK vhost is better now.
Quoted 7 lines
Quoted 3 lines
OK, if we get a performance gain on the virtio side, we can finally upstream it. If you see that please re-post ASAP so we can put it in the next kernel release.
Got it, I will re-post ASAP.
Thanks!
Pls remember to include data on performance gain in the cover letter.
Quoted 4 lines
Quoted 4 lines
Signature · 2 lines
-- MST
Michael S. Tsirkin
maintainerQuoted 11 lines · Tiwei Bie
Quoted 10 lines
Quoted 4 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about
IN_ORDER, then if devices are in order it will get enabled by default.
Quoted 7 lines
Yeah, make sense.
Besides, I have done some further profiling and debugging both in kernel driver and DPDK vhost. Previously I was mislead by a bug in vhost code. I will send a patch to fix that bug. With that bug fixed, the performance of packed ring in the test between kernel driver and DPDK vhost is better now.
OK, if we get a performance gain on the virtio side, we can finally upstream it. If you see that please re-post ASAP so we can put it in the next kernel release.
Signature · 1 line
MST
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Jason Wang
Quoted 15 lines · Tiwei Bie
Quoted 4 lines
If what you say is true then we should take a careful look and not supporting these generic things with packed layout. Once we do support them it will be too late and we won't be able to get performance back.
I think it's a good point that we don't need to support everything in packed ring (especially these which would hurt the performance), as the packed ring aims at high performance. I'm also wondering about the features. Is there any possibility that we won't support the out of order processing (at least not by default) in packed ring? If I didn't miss anything, the need to support out of order processing in packed ring will make the data structure inside the driver not cache friendly which is similar to the case of the descriptor table in the split ring (the difference is that, it only happens in driver now).
Quoted 8 lines
Quoted 3 lines
Out of order is not the only user, DMA is another one. We don't have used ring(len), so we need to maintain buffer length somewhere even for in order device.
For a bunch of systems dma unmap is a nop so we do not really need to maintain it. It's a question of an API to detect that and optimize for it. I posted a proposed patch for that - want to try using that?
Yeah, definitely!
Quoted 11 lines
Quoted 5 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about
IN_ORDER, then if devices are in order it will get enabled by default.
Yeah, make sense.
Besides, I have done some further profiling and debugging both in kernel driver and DPDK vhost. Previously I was mislead by a bug in vhost code. I will send a patch to fix that bug. With that bug fixed, the performance of packed ring in the test between kernel driver and DPDK vhost is better now. I will send a new series soon. Thanks!
Quoted 3 lines
Signature · 2 lines
-- MST
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 19 lines · Jason Wang
Quoted 4 lines · Tiwei Bie
Quoted 4 lines
If what you say is true then we should take a careful look and not supporting these generic things with packed layout. Once we do support them it will be too late and we won't be able to get performance back.
Quoted 11 lines
I think it's a good point that we don't need to support everything in packed ring (especially these which would hurt the performance), as the packed ring aims at high performance. I'm also wondering about the features. Is there any possibility that we won't support the out of order processing (at least not by default) in packed ring? If I didn't miss anything, the need to support out of order processing in packed ring will make the data structure inside the driver not cache friendly which is similar to the case of the descriptor table in the split ring (the difference is that, it only happens in driver now).
Quoted 3 lines
Out of order is not the only user, DMA is another one. We don't have used ring(len), so we need to maintain buffer length somewhere even for in order device.
For a bunch of systems dma unmap is a nop so we do not really need to maintain it. It's a question of an API to detect that and optimize for it. I posted a proposed patch for that - want to try using that?
Quoted 4 lines
But if it's not too late, I second for a
OUT_OF_ORDERfeature. Starting from in order can have much simpler code in driver.Thanks
It's tricky to change the flag polarity because of compatibility with legacy interfaces. Why is this such a big deal?
Let's teach drivers about IN_ORDER, then if devices are in order it will get enabled by default.
Signature · 5 lines
MST _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 4 lines · Tiwei Bie
Quoted 4 lines
If what you say is true then we should take a careful look and not supporting these generic things with packed layout. Once we do support them it will be too late and we won't be able to get performance back.
Quoted 11 lines
I think it's a good point that we don't need to support everything in packed ring (especially these which would hurt the performance), as the packed ring aims at high performance. I'm also wondering about the features. Is there any possibility that we won't support the out of order processing (at least not by default) in packed ring? If I didn't miss anything, the need to support out of order processing in packed ring will make the data structure inside the driver not cache friendly which is similar to the case of the descriptor table in the split ring (the difference is that, it only happens in driver now).
Out of order is not the only user, DMA is another one. We don't have used ring(len), so we need to maintain buffer length somewhere even for in order device. 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 driver.
Thanks
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 71 lines · Michael S. Tsirkin
Quoted 70 lines · Tiwei Bie
Quoted 68 lines · Jason Wang
Quoted 36 lines · Tiwei Bie
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 8 lines
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
Quoted 11 lines
The virtio PMD (
drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs. So the ID management for the Rx ring can be quite simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.Yes it is. I think I've pointed it out in some early version of pmd patch. So I suspect part (or all) of the boost may come from in order feature.
Quoted 10 lines
But in kernel virtio driver, the
virtio_ring.cis very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel'svirtio_ring.cisn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes invirtio_ring.c, which shouldn't be part of this patch set.Could you please share more thoughts on this e.g how to improve the API? Notice since the API is shared by both split ring and packed ring, it may improve the performance of split ring as well. One can easily imagine a batching API, but it does not have many real users now, the only case is the XDP transmission which can accept an array of XDP frames.
Quoted 5 lines
Quoted 3 lines
I don't have detailed thoughts on this yet. But kernel's
virtio_ring.cis quite generic compared with what we did in virtio PMD.In what way? What are some things that aren't implemented there?
Below is the code corresponding to the virtqueue_add() for Rx ring in virtio PMD:
https://github.com/DPDK/dpdk/blob/3605968c2fa7/drivers/net/virtio/virtio_rxtx.c#L278-L304
And below is the code of virtqueue_add() in Linux:
https://github.com/torvalds/linux/blob/54eda9df17f3/drivers/virtio/virtio_ring.c#L275-L417
In virtio PMD, for each packet (mbuf), the code is pretty straightforward, it will just check whether there is one available desc. If it's true, it will just fill this desc directly.
But in virtqueue_add(), it's obvious that, the logic is much more complicated or generic. It's supposed to be able to handle sglist (which may consist of multiple IN buffers and multiple OUT buffers at the same time), and it will try to use indirect descriptors. Then it needs several loops to parse the sglist. That's why I said it's quite generic.
Quoted 5 lines
If what you say is true then we should take a careful look and not supporting these generic things with packed layout. Once we do support them it will be too late and we won't be able to get performance back.
I think it's a good point that we don't need to support everything in packed ring (especially these which would hurt the performance), as the packed ring aims at high performance. I'm also wondering about the features. Is there any possibility that we won't support the out of order processing (at least not by default) in packed ring? If I didn't miss anything, the need to support out of order processing in packed ring will make the data structure inside the driver not cache friendly which is similar to the case of the descriptor table in the split ring (the difference is that, it only happens in driver now).
Quoted 104 lines
Quoted 104 lines
Quoted 104 lines
Quoted 8 lines
So
I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.We can only gain when virtio ring layout is the bottleneck. If there're bottlenecks elsewhere, we probably won't see any increasing in the numbers. Vhost-net is an example, and lots of optimizations have proved that virtio ring is not the main bottleneck for the current codes. I suspect it also the case of virtio driver. Did perf tell us any interesting things in virtio driver?
Thanks
Quoted 86 lines
Quoted 86 lines
Quoted 86 lines
Quoted 86 lines · Tiwei Bie
Quoted 83 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringdrivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 70 lines · Tiwei Bie
Quoted 63 lines · Jason Wang
Quoted 36 lines · Tiwei Bie
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 8 lines
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
Quoted 11 lines
The virtio PMD (
drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs. So the ID management for the Rx ring can be quite simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.Yes it is. I think I've pointed it out in some early version of pmd patch. So I suspect part (or all) of the boost may come from in order feature.
Quoted 10 lines
But in kernel virtio driver, the
virtio_ring.cis very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel'svirtio_ring.cisn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes invirtio_ring.c, which shouldn't be part of this patch set.Quoted 5 lines
Could you please share more thoughts on this e.g how to improve the API? Notice since the API is shared by both split ring and packed ring, it may improve the performance of split ring as well. One can easily imagine a batching API, but it does not have many real users now, the only case is the XDP transmission which can accept an array of XDP frames.
Quoted 3 lines
I don't have detailed thoughts on this yet. But kernel's
virtio_ring.cis quite generic compared with what we did in virtio PMD.
In what way? What are some things that aren't implemented there?
If what you say is true then we should take a careful look and not supporting these generic things with packed layout. Once we do support them it will be too late and we won't be able to get performance back.
Quoted 101 lines
Quoted 101 lines
Quoted 5 lines
So
I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.We can only gain when virtio ring layout is the bottleneck. If there're bottlenecks elsewhere, we probably won't see any increasing in the numbers. Vhost-net is an example, and lots of optimizations have proved that virtio ring is not the main bottleneck for the current codes. I suspect it also the case of virtio driver. Did perf tell us any interesting things in virtio driver?
Thanks
Quoted 86 lines
Quoted 86 lines
Quoted 86 lines
Quoted 86 lines · Tiwei Bie
Quoted 83 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringdrivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 63 lines · Jason Wang
Quoted 36 lines · Tiwei Bie
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 8 lines
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
Quoted 11 lines
The virtio PMD (
drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs. So the ID management for the Rx ring can be quite simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.Yes it is. I think I've pointed it out in some early version of pmd patch. So I suspect part (or all) of the boost may come from in order feature.
Quoted 10 lines
But in kernel virtio driver, the
virtio_ring.cis very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel'svirtio_ring.cisn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes invirtio_ring.c, which shouldn't be part of this patch set.
Quoted 5 lines
Could you please share more thoughts on this e.g how to improve the API? Notice since the API is shared by both split ring and packed ring, it may improve the performance of split ring as well. One can easily imagine a batching API, but it does not have many real users now, the only case is the XDP transmission which can accept an array of XDP frames.
I don't have detailed thoughts on this yet. But kernel's virtio_ring.c is quite generic compared with what we did in virtio PMD.
Quoted 6 lines
Quoted 5 lines
So
I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.
Quoted 102 lines
We can only gain when virtio ring layout is the bottleneck. If there're bottlenecks elsewhere, we probably won't see any increasing in the numbers. Vhost-net is an example, and lots of optimizations have proved that virtio ring is not the main bottleneck for the current codes. I suspect it also the case of virtio driver. Did perf tell us any interesting things in virtio driver?
Thanks
Quoted 92 lines
Quoted 92 lines
Quoted 92 lines
Quoted 92 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 36 lines · Tiwei Bie
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 8 lines
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
Quoted 11 lines
The virtio PMD (
drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs. So the ID management for the Rx ring can be quite simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.
Yes it is. I think I've pointed it out in some early version of pmd patch. So I suspect part (or all) of the boost may come from in order feature.
Quoted 10 lines
But in kernel virtio driver, the
virtio_ring.cis very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel'svirtio_ring.cisn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes invirtio_ring.c, which shouldn't be part of this patch set.
Could you please share more thoughts on this e.g how to improve the API? Notice since the API is shared by both split ring and packed ring, it may improve the performance of split ring as well. One can easily imagine a batching API, but it does not have many real users now, the only case is the XDP transmission which can accept an array of XDP frames.
Quoted 4 lines
So
I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.
We can only gain when virtio ring layout is the bottleneck. If there're bottlenecks elsewhere, we probably won't see any increasing in the numbers. Vhost-net is an example, and lots of optimizations have proved that virtio ring is not the main bottleneck for the current codes. I suspect it also the case of virtio driver. Did perf tell us any interesting things in virtio driver?
Thanks
Quoted 86 lines
Quoted 86 lines
Quoted 86 lines
Quoted 86 lines · Tiwei Bie
Quoted 83 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringdrivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 52 lines · Tiwei Bie
Quoted 34 lines · Michael S. Tsirkin
Quoted 27 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Quoted 3 lines
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
The virtio PMD (
drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs.
So the ID management for the Rx ring can be quite
simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.
Quoted 12 lines
But in kernel virtio driver, the
virtio_ring.cis very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel'svirtio_ring.cisn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes invirtio_ring.c, which shouldn't be part of this patch set. So I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.
So what are the cases that make things complex?
Maybe we should drop support for them completely.
Quoted 95 lines
Quoted 95 lines
Quoted 95 lines
Quoted 95 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Michael S. Tsirkin
maintainerQuoted 52 lines · Tiwei Bie
Quoted 34 lines · Michael S. Tsirkin
Quoted 27 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Quoted 3 lines
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
The virtio PMD (
drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs.
So the ID management for the Rx ring can be quite
simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.
Quoted 12 lines
But in kernel virtio driver, the
virtio_ring.cis very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel'svirtio_ring.cisn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes invirtio_ring.c, which shouldn't be part of this patch set. So I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.
So what are the cases that make things complex?
Maybe we should drop support for them completely.
Quoted 95 lines
Quoted 95 lines
Quoted 95 lines
Quoted 95 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Quoted 34 lines · Michael S. Tsirkin
Quoted 27 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Quoted 3 lines
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
The virtio PMD (drivers/net/virtio) in DPDK doesn't need to share the virtio ring operation code with other drivers and is highly optimized for network. E.g. in Rx, the Rx burst function won't chain descs. So the ID management for the Rx ring can be quite simple and straightforward, we just need to initialize these IDs when initializing the ring and don't need to change these IDs in data path anymore (the mergable Rx code in that patch set assumes the descs will be written back in order, which should be fixed. I.e., the ID in the desc should be used to index vq->descx[]). The Tx code in that patch set also assumes the descs will be written back by device in order, which should be fixed.
But in kernel virtio driver, the virtio_ring.c is very generic. The enqueue (virtqueue_add()) and dequeue (virtqueue_get_buf_ctx()) functions need to support all the virtio devices and should be able to handle all the possible cases that may happen. So although the packed ring can be very efficient in some cases, currently the room to optimize the performance in kernel's virtio_ring.c isn't that much. If we want to take the fully advantage of the packed ring's efficiency, we need some further e.g. API changes in virtio_ring.c, which shouldn't be part of this patch set. So I still think this patch set is mainly to make the kernel virtio driver to have a full functional support of the packed ring, and we can't expect impressive performance boost with it.
Quoted 95 lines
Quoted 95 lines
Quoted 95 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Michael S. Tsirkin
maintainerQuoted 27 lines · Tiwei Bie
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return
XDP_DROPdirectly. And in host, testpmd will do txonly fwd.When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
Quoted 5 lines
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Just this: Jens seems to report a nice gain with virtio and vhost pmd across the board. Try to compare virtio and virtio pmd to see what does pmd do better?
Quoted 93 lines
Quoted 93 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Quoted 3 lines · Michael S. Tsirkin
Are there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
I tried some performance tests with vhost PMD. In guest, the XDP program will return XDP_DROP directly. And in host, testpmd will do txonly fwd.
When burst size is 1 and packet size is 64 in testpmd and testpmd needs to iterate 5 Tx queues (but only the first two queues are enabled) to prepare and inject packets, I got ~12% performance boost (5.7Mpps -> 6.4Mpps). And if the vhost PMD is faster (e.g. just need to iterate the first two queues to prepare and inject packets), then I got similar performance for both rings (~9.9Mpps) (packed ring's performance can be lower, because it's more complicated in driver.)
I think packed ring makes vhost PMD faster, but it doesn't make the driver faster. In packed ring, the ring is simplified, and the handling of the ring in vhost (device) is also simplified, but things are not simplified in driver, e.g. although there is no desc table in the virtqueue anymore, driver still needs to maintain a private desc state table (which is still managed as a list in this patch set) to support the out-of-order desc processing in vhost (device).
I think this patch set is mainly to make the driver have a full functional support for the packed ring, which makes it possible to leverage the packed ring feature in vhost (device). But I'm not sure whether there is any other better idea, I'd like to hear your thoughts. Thanks!
Quoted 92 lines · Tiwei Bie
Quoted 76 lines
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringQuoted 9 lines
drivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Michael S. Tsirkin
maintainerAre there still plans to test the performance with vost pmd? vhost doesn't seem to show a performance gain ...
Quoted 85 lines · Tiwei Bie
Hello everyone,
This patch set implements packed ring support in virtio driver.
Some functional tests have been done with Jason's
packed ring implementation in vhost:https://lkml.org/lkml/2018/7/3/33
Both of ping and netperf worked as expected.
v1 -> v2:
- UseREAD_ONCE()to read eventoff_wrapand flags together (Jason);
- Add comments related to ccw (Jason);RFC (v6) -> v1:
- Avoid extravirtio_wmb()invirtqueue_enable_cb_delayed_packed()when event idx is off (Jason);
- Fix bufs calculation invirtqueue_enable_cb_delayed_packed()(Jason);
- Test the state of the desc atused_idxinstead oflast_used_idxinvirtqueue_enable_cb_delayed_packed()(Jason);
- Save wrap counter (as part of queue state) in the return value ofvirtqueue_enable_cb_prepare_packed();
- Refine the packed ring definitions in uapi;
- Rebase on the net-next tree;RFC v5 -> RFC v6:
- Avoid tracking addr/len/flags when DMA API isn't used (MST/Jason);
- Define wrap counter as bool (Jason);
- UseALIGN()invring_init_packed()(Jason);
- Avoid using pointer to tracknextindetach_buf_packed()(Jason);
- Add comments for barriers (Jason);
- Don't enableRING_PACKEDon ccw for now (noticed by Jason);
- Refine the memory barrier invirtqueue_poll();
- Add a missing memory barrier invirtqueue_enable_cb_delayed_packed();
- Remove the hacks invirtqueue_enable_cb_prepare_packed();RFC v4 -> RFC v5:
- Save DMA addr, etc in desc state (Jason);
- Track used wrap counter;RFC v3 -> RFC v4:
- Make ID allocation support out-of-order (Jason);
- Various fixes forEVENT_IDXsupport;RFC v2 -> RFC v3:
- Split into small patches (Jason);
- Add helpervirtqueue_use_indirect()(Jason);
- Just set id for the last descriptor of a list (Jason);
- Calculate the prev invirtqueue_add_packed()(Jason);
- Fix/improve desc suppression code (Jason/MST);
- Refine the code layout for XXX_split/packed and wrappers (MST);
- Fix the comments and API in uapi (MST);
- Remove theBUG_ON()for indirect (Jason);
- Some other refinements and bug fixes;RFC v1 -> RFC v2:
- Add indirect descriptor support - compile test only;
- Add event suppression supprt - compile test only;
- Movevring_packed_init()out of uapi (Jason, MST);
- Merge two loops into one invirtqueue_add_packed()(Jason);
- Splitvring_unmap_one()for packed ring and split ring (Jason);
- Avoid using '%' operator (Jason);
- Renamefree_head->next_avail_idx(Jason);
- Add comments forvirtio_wmb()invirtqueue_add_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 ringdrivers/s390/virtio/virtio_ccw.c | 14 + drivers/virtio/virtio_ring.c | 1365 ++++++++++++++++++++++------ include/linux/virtio_ring.h | 8 +- include/uapi/linux/virtio_config.h | 3 + include/uapi/linux/virtio_ring.h | 43 + 5 files changed, 1157 insertions(+), 276 deletions(-)Signature · 1 line
2.18.0