From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 6C901A0524;
	Tue, 13 Apr 2021 20:51:14 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 55B35161283;
	Tue, 13 Apr 2021 20:51:14 +0200 (CEST)
Received: from mail-io1-f43.google.com (mail-io1-f43.google.com
 [209.85.166.43])
 by mails.dpdk.org (Postfix) with ESMTP id 911FA161273
 for <dev@dpdk.org>; Tue, 13 Apr 2021 20:51:13 +0200 (CEST)
Received: by mail-io1-f43.google.com with SMTP id d5so8688863iof.3
 for <dev@dpdk.org>; Tue, 13 Apr 2021 11:51:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=OBf1v8+n7J/nEsZJzbxB/83Dsdy5MMoSfxCnORDyCsU=;
 b=TvnVLiZXeC2l6pK3daqRDsP48znsC0q25LGIo+WuvtrHcjja+fBJgEGcdOhiYWhqDB
 u5IYzde+XgQAeDQ6dvSRP9d/CabQw6cr/0Y4ovk8T4AEKEZmwiLd4zbvp8m0TOqDoWqx
 TYKaWlJ9y7dbS3Nd39AQqeUkZNX5RV7Ou7fLxipP6xbi6Xa4W2B/ww+tzESmjyRbnsY1
 YhM5HHH7S+nbBY1J6jbAR6D+0XqMQJuKzMAaYhWd6o5pW+T4udjnvAcmU5bC7E0v8yqU
 QzUjHRdDQP/n/uW5kpN8HkHLS0krY27C4W+DZQCLFNq29g0L22mnmLrCaQM9lFrmJU1N
 zrJQ==
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=OBf1v8+n7J/nEsZJzbxB/83Dsdy5MMoSfxCnORDyCsU=;
 b=C7KTc+yTShyfblhX1Y3o3KWGPTy2/DGWz0IHQfWvlWYpiZvpT6fsqFBJqRGX3L8nwl
 9rOcI9vBRpW65Mk+zjhyLK3bW6Jrzppbv0ahEVfnjjqoP2Bteo0UbwectTwGwa7Ao9HV
 M7mgwIDLMPHfiyCX0ejPK+eVy5BQzBz0GLVsmEhbsINoV52tLExwh0n9uGrPiN/1BRbO
 f3hTqFvvRnPogkMVEG3+gzjp3CLjJWO9Ba/83oRsP1gCWypunR5lVkFZmOIY9fk0iO5r
 wO73IVWrzbq2DVz0kz2UzANcrNRLkYxT1UEIZ3xdtJTajjz7ttckOpeXv+X/pPtFg99t
 2HxQ==
X-Gm-Message-State: AOAM530Yt8FMtzZ5MGHNil39GBog1JijMDgS2y4D110JCMdYtegoIHKH
 Q0A1y86Ugbj0EoGu7UoJBy61GT0Y1MwUUgwXaCw=
X-Google-Smtp-Source: ABdhPJyaRm29JcvqIy45SI32OFNLW+tkYV8b3WruUlZyebIqhF9oRKu3MGbqlKj2sTMK5CooG7zsdmk1GdNj2U4mulY=
X-Received: by 2002:a02:7086:: with SMTP id
 f128mr34654791jac.104.1618339872870; 
 Tue, 13 Apr 2021 11:51:12 -0700 (PDT)
MIME-Version: 1.0
References: <20210318102550.59265-1-ruifeng.wang@arm.com>
 <20210318102550.59265-2-ruifeng.wang@arm.com>
In-Reply-To: <20210318102550.59265-2-ruifeng.wang@arm.com>
From: Jerin Jacob <jerinjacobk@gmail.com>
Date: Wed, 14 Apr 2021 00:20:56 +0530
Message-ID: <CALBAE1PiXCypP1=d5t1L+JovQgh882AUWNtkV48Fka+evDYskQ@mail.gmail.com>
To: Ruifeng Wang <ruifeng.wang@arm.com>
Cc: Jerin Jacob <jerinj@marvell.com>, Hemant Agrawal <hemant.agrawal@nxp.com>, 
 Ferruh Yigit <ferruh.yigit@intel.com>,
 Thomas Monjalon <thomas@monjalon.net>, 
 David Marchand <david.marchand@redhat.com>, dpdk-dev <dev@dpdk.org>,
 nd <nd@arm.com>, Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH 1/4] examples/l3fwd: tune prefetch for better
 performance
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
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 Thu, Mar 18, 2021 at 3:56 PM Ruifeng Wang <ruifeng.wang@arm.com> wrote:
>
> Packet header is prefetched before packet processing for better
> memory access performance. As L2 header will be updated by l3fwd,
> using of prefetch for store hint will set cache line to proper
> status and reduce cache maintenance overhead.

The code does read the cache line too. Right?

>
> With this change, 12.9% performance uplift was measured on N1SDP
> platform with MLX5 NIC.
>
> Suggested-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
>
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>


On the octeontx2 platform, It is 2% regression.

Looks like micro architecture-specific item of handing write hint on the memory
the area that does read and write.


I am testing the LPM lookup miss case.

My test command:
./build/examples/dpdk-l3fwd  -c 0x0100  -- -p 0x1 --config="(0,0,8)" -P



> ---
>  examples/l3fwd/l3fwd_lpm_neon.h | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h
> index d6c0ba64a..ae8840694 100644
> --- a/examples/l3fwd/l3fwd_lpm_neon.h
> +++ b/examples/l3fwd/l3fwd_lpm_neon.h
> @@ -97,13 +97,13 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst,
>
>         if (k) {
>                 for (i = 0; i < FWDSTEP; i++) {
> -                       rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i],
> +                       rte_prefetch0_write(rte_pktmbuf_mtod(pkts_burst[i],
>                                                 struct rte_ether_hdr *) + 1);
>                 }
>
>                 for (j = 0; j != k - FWDSTEP; j += FWDSTEP) {
>                         for (i = 0; i < FWDSTEP; i++) {
> -                               rte_prefetch0(rte_pktmbuf_mtod(
> +                               rte_prefetch0_write(rte_pktmbuf_mtod(
>                                                 pkts_burst[j + i + FWDSTEP],
>                                                 struct rte_ether_hdr *) + 1);
>                         }
> @@ -124,17 +124,17 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst,
>                 /* Prefetch last up to 3 packets one by one */
>                 switch (m) {
>                 case 3:
> -                       rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j],
> +                       rte_prefetch0_write(rte_pktmbuf_mtod(pkts_burst[j],
>                                                 struct rte_ether_hdr *) + 1);
>                         j++;
>                         /* fallthrough */
>                 case 2:
> -                       rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j],
> +                       rte_prefetch0_write(rte_pktmbuf_mtod(pkts_burst[j],
>                                                 struct rte_ether_hdr *) + 1);
>                         j++;
>                         /* fallthrough */
>                 case 1:
> -                       rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j],
> +                       rte_prefetch0_write(rte_pktmbuf_mtod(pkts_burst[j],
>                                                 struct rte_ether_hdr *) + 1);
>                         j++;
>                 }
> --
> 2.25.1
>