DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: use SMP memory barrier before kicking guest
@ 2018-06-07 14:38 Maxime Coquelin
  2018-06-12  6:41 ` Tiwei Bie
  2018-06-15  8:49 ` Maxime Coquelin
  0 siblings, 2 replies; 3+ messages in thread
From: Maxime Coquelin @ 2018-06-07 14:38 UTC (permalink / raw)
  To: zhihong.wang, tiwei.bie, dev; +Cc: Maxime Coquelin

vhost_vring_call() used rte_mb(), which translates into
mfence instruction on x86.

This patch changes to use rte_smp_mb(), which changed recently
to translate into a locked ADD instruction for performance
reason.

The measured gain is up to 3% with the testpmd benchmarks.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/vhost.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
index 58c425a5c..1bc99ed3c 100644
--- a/lib/librte_vhost/vhost.h
+++ b/lib/librte_vhost/vhost.h
@@ -591,7 +591,7 @@ static __rte_always_inline void
 vhost_vring_call(struct virtio_net *dev, struct vhost_virtqueue *vq)
 {
 	/* Flush used->idx update before we read avail->flags. */
-	rte_mb();
+	rte_smp_mb();
 
 	/* Don't kick guest if we don't reach index specified by guest. */
 	if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {
-- 
2.14.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: use SMP memory barrier before kicking guest
  2018-06-07 14:38 [dpdk-dev] [PATCH] vhost: use SMP memory barrier before kicking guest Maxime Coquelin
@ 2018-06-12  6:41 ` Tiwei Bie
  2018-06-15  8:49 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Tiwei Bie @ 2018-06-12  6:41 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: zhihong.wang, dev

On Thu, Jun 07, 2018 at 04:38:26PM +0200, Maxime Coquelin wrote:
> vhost_vring_call() used rte_mb(), which translates into
> mfence instruction on x86.
> 
> This patch changes to use rte_smp_mb(), which changed recently
> to translate into a locked ADD instruction for performance
> reason.
> 
> The measured gain is up to 3% with the testpmd benchmarks.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/librte_vhost/vhost.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index 58c425a5c..1bc99ed3c 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -591,7 +591,7 @@ static __rte_always_inline void
>  vhost_vring_call(struct virtio_net *dev, struct vhost_virtqueue *vq)
>  {
>  	/* Flush used->idx update before we read avail->flags. */
> -	rte_mb();
> +	rte_smp_mb();
>  
>  	/* Don't kick guest if we don't reach index specified by guest. */
>  	if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {
> -- 
> 2.14.3
> 

Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: use SMP memory barrier before kicking guest
  2018-06-07 14:38 [dpdk-dev] [PATCH] vhost: use SMP memory barrier before kicking guest Maxime Coquelin
  2018-06-12  6:41 ` Tiwei Bie
@ 2018-06-15  8:49 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2018-06-15  8:49 UTC (permalink / raw)
  To: zhihong.wang, tiwei.bie, dev



On 06/07/2018 04:38 PM, Maxime Coquelin wrote:
> vhost_vring_call() used rte_mb(), which translates into
> mfence instruction on x86.
> 
> This patch changes to use rte_smp_mb(), which changed recently
> to translate into a locked ADD instruction for performance
> reason.
> 
> The measured gain is up to 3% with the testpmd benchmarks.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>   lib/librte_vhost/vhost.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index 58c425a5c..1bc99ed3c 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -591,7 +591,7 @@ static __rte_always_inline void
>   vhost_vring_call(struct virtio_net *dev, struct vhost_virtqueue *vq)
>   {
>   	/* Flush used->idx update before we read avail->flags. */
> -	rte_mb();
> +	rte_smp_mb();
>   
>   	/* Don't kick guest if we don't reach index specified by guest. */
>   	if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {
> 

Applied to dpdk-next-virtio

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-15  8:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-07 14:38 [dpdk-dev] [PATCH] vhost: use SMP memory barrier before kicking guest Maxime Coquelin
2018-06-12  6:41 ` Tiwei Bie
2018-06-15  8:49 ` Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).