DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Joyce Kong <joyce.kong@arm.com>, dev@dpdk.org
Cc: nd@arm.com, tiwei.bie@intel.com, zhihong.wang@intel.com,
	amorenoz@redhat.com, xiao.w.wang@intel.com, yong.liu@intel.com,
	jfreimann@redhat.com, honnappa.nagarahalli@arm.com,
	gavin.hu@arm.com
Subject: Re: [dpdk-dev] [PATCH v2 1/2] virtio: one way barrier for packed vring desc avail flags
Date: Fri, 6 Sep 2019 18:01:54 +0200	[thread overview]
Message-ID: <eda33785-98b8-611c-e75e-5d6783926fa1@redhat.com> (raw)
In-Reply-To: <1567769688-34413-2-git-send-email-joyce.kong@arm.com>

Hi Joyce,

On 9/6/19 1:34 PM, Joyce Kong wrote:
> In case VIRTIO_F_ORDER_PLATFORM(36) is not negotiated, then the frontend
> and backend are assumed to be implemented in software, that is they can
> run on identical CPUs in an SMP configuration. Thus a weak form of memory
> barriers like rte_smp_r/wmb, other than rte_cio_r/wmb, is sufficient for
> this case(vq->hw->weak_barriers == 1) and yields better performance.
> For the above case, this patch helps yielding even better performance
> by replacing the two-way barriers with C11 one-way barriers.
> 
> Meanwhile, a read barrier is required to ensure ordering between
> descriptor's flags and content reads[1]. With C11, load-acquire can
> enforce the ordering instead of rmb barrier.
> 
> [1]https://patchwork.dpdk.org/patch/49109/
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> ---
>  drivers/net/virtio/virtio_rxtx.c                 | 26 ++++++++++++++++++------
>  drivers/net/virtio/virtio_user/virtio_user_dev.c |  6 +++++-
>  lib/librte_vhost/vhost.h                         |  2 +-
>  lib/librte_vhost/virtio_net.c                    | 11 +++++-----
>  4 files changed, 31 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
> index 27ead19..2a2153c 100644
> --- a/drivers/net/virtio/virtio_rxtx.c
> +++ b/drivers/net/virtio/virtio_rxtx.c
> @@ -456,8 +456,14 @@ virtqueue_enqueue_recv_refill_packed(struct virtqueue *vq,
>  		vq->vq_desc_head_idx = dxp->next;
>  		if (vq->vq_desc_head_idx == VQ_RING_DESC_CHAIN_END)
>  			vq->vq_desc_tail_idx = vq->vq_desc_head_idx;
> -		virtio_wmb(hw->weak_barriers);
> -		start_dp[idx].flags = flags;
> +
> +		if (hw->weak_barriers)
> +			__atomic_store_n(&start_dp[idx].flags, flags,
> +					 __ATOMIC_RELEASE);
> +		else {
> +			rte_cio_wmb();
> +			start_dp[idx].flags = flags;
> +		}
It looks good to me.
I just wonder whether it would be cleaner to put that in an inline
function:

static inline void
virtqueue_store_flags_packed()

Same for the fetch.


  reply	other threads:[~2019-09-06 16:02 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27  8:19 [dpdk-dev] [RFC PATCH 0/2] virtio: one way barrier for packed vring flags Joyce Kong
2019-08-27  8:19 ` [dpdk-dev] [RFC PATCH 1/2] virtio: one way barrier for packed vring desc avail flags Joyce Kong
2019-08-27  8:19 ` [dpdk-dev] [RFC PATCH 2/2] virtio: one way barrier for packed vring desc used flags Joyce Kong
2019-09-06 11:34 ` [dpdk-dev] [PATCH v2 0/2] virtio: one way barrier for packed vring flags Joyce Kong
2019-09-06 11:34 ` [dpdk-dev] [PATCH v2 1/2] virtio: one way barrier for packed vring desc avail flags Joyce Kong
2019-09-06 16:01   ` Maxime Coquelin [this message]
2019-09-09  9:24     ` Joyce Kong (Arm Technology China)
2019-09-06 11:34 ` [dpdk-dev] [PATCH v2 2/2] virtio: one way barrier for packed vring desc used flags Joyce Kong
2019-09-09  9:14 ` [dpdk-dev] [PATCH v3 0/2] virtio: one way barrier for packed vring flags Joyce Kong
2019-09-09  9:14 ` [dpdk-dev] [PATCH v3 1/2] virtio: one way barrier for packed vring desc avail flags Joyce Kong
2019-09-09 10:10   ` Maxime Coquelin
2019-09-10  3:54     ` Wang, Yinan
2019-09-10  9:48       ` Gavin Hu (Arm Technology China)
2019-09-10 10:17         ` Maxime Coquelin
2019-09-11  2:39         ` Liu, Yong
2019-09-11  3:35           ` Gavin Hu (Arm Technology China)
2019-09-11  6:29             ` Liu, Yong
2019-09-11  8:32               ` Gavin Hu (Arm Technology China)
2019-09-11 10:02                 ` Bruce Richardson
2019-09-12  8:21                   ` Gavin Hu (Arm Technology China)
2019-09-09  9:14 ` [dpdk-dev] [PATCH v3 2/2] virtio: one way barrier for packed vring desc used flags Joyce Kong
2019-09-09 10:11   ` Maxime Coquelin
2019-09-17  5:28 ` [dpdk-dev] [PATCH v4 0/2] virtio: one way barrier for packed vring flags Joyce Kong
2019-10-16 11:07   ` Maxime Coquelin
2019-09-17  5:28 ` [dpdk-dev] [PATCH v4 1/2] virtio: one way barrier for packed vring desc avail flags Joyce Kong
2019-10-14  7:42   ` Maxime Coquelin
2019-09-17  5:28 ` [dpdk-dev] [PATCH v4 2/2] virtio: one way barrier for packed vring desc used flags Joyce Kong
2019-09-18  5:20   ` Wang, Yinan
2019-09-19  4:04     ` Gavin Hu (Arm Technology China)
2019-10-14  7:43   ` Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eda33785-98b8-611c-e75e-5d6783926fa1@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=amorenoz@redhat.com \
    --cc=dev@dpdk.org \
    --cc=gavin.hu@arm.com \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=jfreimann@redhat.com \
    --cc=joyce.kong@arm.com \
    --cc=nd@arm.com \
    --cc=tiwei.bie@intel.com \
    --cc=xiao.w.wang@intel.com \
    --cc=yong.liu@intel.com \
    --cc=zhihong.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).