From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 95600A00BE;
	Tue,  7 Jul 2020 15:59:13 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 768971DD02;
	Tue,  7 Jul 2020 15:59:13 +0200 (CEST)
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com
 [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id D54C31D617
 for <dev@dpdk.org>; Tue,  7 Jul 2020 15:59:12 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1594130352;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=j3eL2CUfguRcpxjNEev32uCz/FrGK5u1UbwkuxyLTv8=;
 b=UpLWRNEQf8ZdNet2Jb3uM75lW6SPRJtRjAd2cre8mYRKelhxvjPOiIzUPv/lBAgjUc7cn5
 VhMtBMiJHggwUsqCKPFmWVjI1PwRwUb6bvnnwgmPBMtkABnIw1y+vPEInbl+iBKB2/OFbR
 zsmbmJvRQKOguk+zZfeNElT9lpHr9DA=
Received: from mail-ua1-f70.google.com (mail-ua1-f70.google.com
 [209.85.222.70]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-479-13W2wwGZM_6YB27t8Zu9SA-1; Tue, 07 Jul 2020 09:59:08 -0400
X-MC-Unique: 13W2wwGZM_6YB27t8Zu9SA-1
Received: by mail-ua1-f70.google.com with SMTP id 14so11044648uac.8
 for <dev@dpdk.org>; Tue, 07 Jul 2020 06:59:08 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=j3eL2CUfguRcpxjNEev32uCz/FrGK5u1UbwkuxyLTv8=;
 b=fokNUIEQUoS5jVWCBANbjoh9GqWA3zxf29JQz33CRnN/Qk3ZoDUvhIoU5b6ceZFdbG
 q8IBQ43TrjhwL9bOD7Tr8K0L26qmPNaHRi5mumuge4Dy8ab6BIVF5Od1uPr0uIt1ggOK
 A2YY2sk+v3ICT+yvdYhXj0oJDGRsoyGLqx05LULkaa/d66of4txPPPtEXxDasbqvNGhf
 PGFPfm/k1DVLo1JnJQn6FSAOMHA1KyZylr4l8niU87tKzVakGt9mL/hAQtx7TP9tpydV
 uVzvKnvmzI0wd6/HUHmlrlD/ZfALqds+FnvPrhuLHZ6txZ7Q4ZwohTVmBtRS614I2HmL
 vcWA==
X-Gm-Message-State: AOAM531uL9gRGqLis4azIBvbjZZNccPwQsuGtOiCXzTgs/4gtM6ZyTcO
 rm8Bg26xMt1yAlN1CyG0lSv54CGL0FETOHj8QFe2/jzyORNEGRBOVo3xtZAxKFC6zl3eRRjW8X8
 EYy7B09P9iogVyFZgb6A=
X-Received: by 2002:ab0:316:: with SMTP id 22mr39239760uat.41.1594130347991;
 Tue, 07 Jul 2020 06:59:07 -0700 (PDT)
X-Google-Smtp-Source: ABdhPJwmJMrB9O5o7/3UBEgCkGWss8x0S4rBe/pt3mp+ClOEw99F3hxrxdsuW6zI+PknFdFL3TLHCCFhMTuaZqKbtjg=
X-Received: by 2002:ab0:316:: with SMTP id 22mr39239731uat.41.1594130347712;
 Tue, 07 Jul 2020 06:59:07 -0700 (PDT)
MIME-Version: 1.0
References: <20200611033248.39049-1-joyce.kong@arm.com>
 <20200706074930.54299-1-joyce.kong@arm.com>
 <20200706074930.54299-4-joyce.kong@arm.com>
In-Reply-To: <20200706074930.54299-4-joyce.kong@arm.com>
From: David Marchand <david.marchand@redhat.com>
Date: Tue, 7 Jul 2020 15:58:56 +0200
Message-ID: <CAJFAV8y71aph-fKbiKGveXJH6+y_9TYDfuZjTePgiSkxvUv9ag@mail.gmail.com>
To: Joyce Kong <joyce.kong@arm.com>, Zhihong Wang <zhihong.wang@intel.com>, 
 Adrian Moreno Zapata <amorenoz@redhat.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>, 
 Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
 Xiaolong Ye <xiaolong.ye@intel.com>, 
 Beilei Xing <beilei.xing@intel.com>, Jeff Guo <jia.guo@intel.com>, 
 "Mcnamara, John" <john.mcnamara@intel.com>, Matan Azrad <matan@mellanox.com>, 
 Shahaf Shuler <shahafs@mellanox.com>,
 Viacheslav Ovsiienko <viacheslavo@mellanox.com>, 
 Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
 Phil Yang <phil.yang@arm.com>, 
 "Ruifeng Wang (Arm Technology China)" <ruifeng.wang@arm.com>,
 dev <dev@dpdk.org>, nd <nd@arm.com>
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH v2 3/6] lib/vhost: restrict pointer aliasing
 for packed vpmd
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Mon, Jul 6, 2020 at 9:50 AM Joyce Kong <joyce.kong@arm.com> wrote:
>
> Restrict pointer aliasing to allow the compiler to vectorize loop
> more aggressively.
>
> With this patch, a 9.6% improvement is observed in throughput for
> the packed virtio-net PVP case, and a 2.8% improvement in throughput
> for the packed virtio-user PVP case. All performance data are measured
> under 0.001% acceptable packet loss with 1 core on both vhost and
> virtio side.
>
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> ---
>  drivers/net/virtio/virtio_rxtx_simple_neon.c |  5 +++--
>  lib/librte_vhost/virtio_net.c                | 14 +++++++-------
>  2 files changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_rxtx_simple_neon.c b/drivers/net/virtio/virtio_rxtx_simple_neon.c
> index 5febfb0f5..31824a931 100644
> --- a/drivers/net/virtio/virtio_rxtx_simple_neon.c
> +++ b/drivers/net/virtio/virtio_rxtx_simple_neon.c
> @@ -36,8 +36,9 @@
>   * - nb_pkts < RTE_VIRTIO_DESC_PER_LOOP, just return no packet
>   */
>  uint16_t
> -virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf
> -               **__rte_restrict rx_pkts, uint16_t nb_pkts)
> +virtio_recv_pkts_vec(void *rx_queue,
> +               struct rte_mbuf **__rte_restrict rx_pkts,
> +               uint16_t nb_pkts)
>  {
>         struct virtnet_rx *rxvq = rx_queue;
>         struct virtqueue *vq = rxvq->vq;

For the neon bits, I trust you.


> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 751c1f373..e60358251 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -1133,8 +1133,8 @@ virtio_dev_rx_single_packed(struct virtio_net *dev,
>
>  static __rte_noinline uint32_t
>  virtio_dev_rx_packed(struct virtio_net *dev,
> -                    struct vhost_virtqueue *vq,
> -                    struct rte_mbuf **pkts,
> +                    struct vhost_virtqueue *__rte_restrict vq,
> +                    struct rte_mbuf **__rte_restrict pkts,
>                      uint32_t count)
>  {
>         uint32_t pkt_idx = 0;

But for the generic part, I'd like to get others opinion.
Added Zhihong and Adrian.


> @@ -1219,7 +1219,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
>
>  uint16_t
>  rte_vhost_enqueue_burst(int vid, uint16_t queue_id,
> -       struct rte_mbuf **pkts, uint16_t count)
> +       struct rte_mbuf **__rte_restrict pkts, uint16_t count)
>  {
>         struct virtio_net *dev = get_device(vid);
>
> @@ -2124,9 +2124,9 @@ free_zmbuf(struct vhost_virtqueue *vq)
>
>  static __rte_noinline uint16_t
>  virtio_dev_tx_packed_zmbuf(struct virtio_net *dev,
> -                          struct vhost_virtqueue *vq,
> +                          struct vhost_virtqueue *__rte_restrict vq,
>                            struct rte_mempool *mbuf_pool,
> -                          struct rte_mbuf **pkts,
> +                          struct rte_mbuf **__rte_restrict pkts,
>                            uint32_t count)
>  {
>         uint32_t pkt_idx = 0;
> @@ -2160,9 +2160,9 @@ virtio_dev_tx_packed_zmbuf(struct virtio_net *dev,
>
>  static __rte_noinline uint16_t
>  virtio_dev_tx_packed(struct virtio_net *dev,
> -                    struct vhost_virtqueue *vq,
> +                    struct vhost_virtqueue *__rte_restrict vq,
>                      struct rte_mempool *mbuf_pool,
> -                    struct rte_mbuf **pkts,
> +                    struct rte_mbuf **__rte_restrict pkts,
>                      uint32_t count)
>  {
>         uint32_t pkt_idx = 0;
> --
> 2.27.0
>