[dpdk-dev] [PATCH] vhost: remove lockless enqueue to the virtio ring

Tan, Jianfeng jianfeng.tan at intel.com
Tue Jan 19 17:25:22 CET 2016


Hi Huawei,

On 1/4/2016 10:46 PM, Huawei Xie wrote:
> This patch removes the internal lockless enqueue implmentation.
> DPDK doesn't support receiving/transmitting packets from/to the same
> queue. Vhost PMD wraps vhost device as normal DPDK port. DPDK
> applications normally have their own lock implmentation when enqueue
> packets to the same queue of a port.
>
> The atomic cmpset is a costly operation. This patch should help
> performance a bit.
>
> Signed-off-by: Huawei Xie <huawei.xie at intel.com>
> ---
>   lib/librte_vhost/vhost_rxtx.c | 86 +++++++++++++------------------------------
>   1 file changed, 25 insertions(+), 61 deletions(-)
>
> diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
> index bbf3fac..26a1b9c 100644
> --- a/lib/librte_vhost/vhost_rxtx.c
> +++ b/lib/librte_vhost/vhost_rxtx.c

I think vhost example will not work well with this patch when 
vm2vm=software.

Test case:
Two virtio ports handled by two pmd threads. Thread 0 polls pkts from 
physical NIC and sends to virtio0, while thread0 receives pkts from 
virtio1 and routes it to virtio0.

> -
>   		*(volatile uint16_t *)&vq->used->idx += entry_success;

Another unrelated question: We ever try to move this assignment out of 
loop to save cost as it's a data contention?

Thanks,
Jianfeng



More information about the dev mailing list