From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 18E93A04FD; Wed, 8 Jun 2022 14:30:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0896042BE1; Wed, 8 Jun 2022 14:30:13 +0200 (CEST) Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by mails.dpdk.org (Postfix) with ESMTP id 956D242BB9 for ; Wed, 8 Jun 2022 14:30:11 +0200 (CEST) Received: by mail-qk1-f178.google.com with SMTP id x75so11934839qkb.12 for ; Wed, 08 Jun 2022 05:30:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=q4mb7CQrKNcf81cF07s1xA5/UTEHU/Ox2Z13/0J9zcA=; b=rhlRReFKzLKIlZ9top7Ui3JeVKQMQ47LraeeL/TFYuXr6/wY7Li6ImA+NfFthuqiE/ zuLlFnzkfmu8yTv3C2aXh3rEXa/YJgjmJrFxPSdciudsE1IbDSjbe00ggT5dmt8vM9DW izgS7EwU3nqF1B3CbFupg+lYXVvsuS11/TWkVvGutr2TbOqhj4RdZ5luJGLrcXcqehVd WD47dRwxJBpYjr1W7DixFi63bBw5rd4vQEiKR6FNL/72mnUrFscsrcX/dKoRS6LHzziY f/RYSWwY+RR6mLNYYQkwI4KplBZp0hUvLMjrCh3T5Y9lkB1qIu7Y0oiYP7VA+hJY9/R3 REpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=q4mb7CQrKNcf81cF07s1xA5/UTEHU/Ox2Z13/0J9zcA=; b=EPBQ9UFXyjgckx1TCe7FwiCcQF8iNvIUMIMXwBnUI2cTxH8g/4xyVlj83sQFiR9+IM s/fsv76Dtoui+QX5GTgy62F+inhrqC5UqhQvI+3prLBWlx2pdrEed0dgvSK8sopbvZgC e+nt0e2gju3cBJ6ZJr1nYuq9QaT0NULxMRLgh6Os0kklN/sgOqAQwHML3wCrWPmZ8Nml +tF0XgdLCZ6N0cajoOBoljT3S+N2cls0r82tzSg3Oh78IUoqszvw5L3YdmrIp61E8OAi ADoafcBHxX3UkvEdHJH47P/g3cvJGP7KC21d3a2elmCUqVQCXEBICB4hUEpc/BymzYwh GRvA== X-Gm-Message-State: AOAM530InFMnXlPhs4J0ZQeLyYlXHXrjLHgbsrhn8DULu+JwNiOs+4fU j4Cgu1EGQtWEoQJvj9Ktr6KM0+2cbpH3cHIHSyojMA== X-Google-Smtp-Source: ABdhPJyVE3FvQB7v6PM0G1s1cLYnI97vzk4wbja1WpcYeNTGO2w/n8CLEHO0hLh/CKx2FgHEFBuPDVxukPPl0ebgO18= X-Received: by 2002:a05:620a:1b94:b0:6a6:d20c:c2fd with SMTP id dv20-20020a05620a1b9400b006a6d20cc2fdmr7695326qkb.459.1654691410887; Wed, 08 Jun 2022 05:30:10 -0700 (PDT) MIME-Version: 1.0 References: <20220607171746.461772-1-stephen@networkplumber.org> <20220607171746.461772-2-stephen@networkplumber.org> In-Reply-To: <20220607171746.461772-2-stephen@networkplumber.org> From: =?UTF-8?Q?Micha=C5=82_Krawczyk?= Date: Wed, 8 Jun 2022 14:29:58 +0200 Message-ID: Subject: Re: [RFC 1/8] net/ena: fix warnings related to rte_memcpy and gcc-12 To: Stephen Hemminger Cc: dev , Marcin Wojtas , Shai Brandes , Evgeny Schemeilin , Igor Chauskin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org wt., 7 cze 2022 o 19:17 Stephen Hemminger napisa=C5=82(a): > > Rte_memcpy is not needed for small objects only used on control > path. Regular memcpy is as fast or faster and there is more > robust since static analysis etc knows what it does. > > In this driver it was redefining all memcpy as rte_memcpy > which is even worse. Hi Stephen, I would like to shed some light on why we're redefining all the memcpy as rte_memcpy. The ENA HAL is unmodifiable, as it's shared across many platforms and we cannot simply adjust it for the DPDK. We can use the ena_plat_dpdk.h to change the ena_com (HAL) definitions, and that's what we're doing with memcpy. It's being used on the data path for the Tx, to copy the bounce buffers. Following the recommendations in [1] plus the results from [2], we wanted to make use of the optimized memcpy on the ENA's data path as well to reduce the CPU time spent in the PMD. I'm worried that removing rte_memcpy from the ena_plat_dpdk.h will result in some performance degradation for the ENA data path. However I understand your concerns for the control path and I'm ok with it. [1] https://doc.dpdk.org/guides/prog_guide/writing_efficient_code.html#memo= ry [2] https://www.intel.com/content/www/us/en/developer/articles/technical/pe= rformance-optimization-of-memcpy-in-dpdk.html Thanks, Michal > > Signed-off-by: Stephen Hemminger > --- > drivers/net/ena/base/ena_plat_dpdk.h | 10 +--------- > drivers/net/ena/ena_ethdev.c | 8 ++++---- > drivers/net/ena/ena_rss.c | 2 +- > 3 files changed, 6 insertions(+), 14 deletions(-) > > diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/= ena_plat_dpdk.h > index 8f2b3a87c2ab..caea763e3eca 100644 > --- a/drivers/net/ena/base/ena_plat_dpdk.h > +++ b/drivers/net/ena/base/ena_plat_dpdk.h > @@ -26,7 +26,6 @@ > #include > > #include > -#include > > typedef uint64_t u64; > typedef uint32_t u32; > @@ -67,14 +66,7 @@ typedef uint64_t dma_addr_t; > #define ENA_UDELAY(x) rte_delay_us_block(x) > > #define ENA_TOUCH(x) ((void)(x)) > -/* Redefine memcpy with caution: rte_memcpy can be simply aliased to mem= cpy, so > - * make the redefinition only if it's safe (and beneficial) to do so. > - */ > -#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64_MEMCPY) || \ > - defined(RTE_ARCH_ARM_NEON_MEMCPY) > -#undef memcpy > -#define memcpy rte_memcpy > -#endif > + > #define wmb rte_wmb > #define rmb rte_rmb > #define mb rte_mb > diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c > index 68768cab7077..5f87429606e6 100644 > --- a/drivers/net/ena/ena_ethdev.c > +++ b/drivers/net/ena/ena_ethdev.c > @@ -481,7 +481,7 @@ ENA_PROXY_DESC(ena_com_get_dev_basic_stats, ENA_MP_DE= V_STATS_GET, > ENA_TOUCH(rsp); > ENA_TOUCH(ena_dev); > if (stats !=3D &adapter->basic_stats) > - rte_memcpy(stats, &adapter->basic_stats, sizeof(*stats)); > + memcpy(stats, &adapter->basic_stats, sizeof(*stats)); > }), > struct ena_com_dev *ena_dev, struct ena_admin_basic_stats *stats)= ; > > @@ -496,7 +496,7 @@ ENA_PROXY_DESC(ena_com_get_eni_stats, ENA_MP_ENI_STAT= S_GET, > ENA_TOUCH(rsp); > ENA_TOUCH(ena_dev); > if (stats !=3D (struct ena_admin_eni_stats *)&adapter->eni_stats) > - rte_memcpy(stats, &adapter->eni_stats, sizeof(*stats)); > + memcpy(stats, &adapter->eni_stats, sizeof(*stats)); > }), > struct ena_com_dev *ena_dev, struct ena_admin_eni_stats *stats); > > @@ -538,8 +538,8 @@ ENA_PROXY_DESC(ena_com_indirect_table_get, ENA_MP_IND= _TBL_GET, > ENA_TOUCH(rsp); > ENA_TOUCH(ena_dev); > if (ind_tbl !=3D adapter->indirect_table) > - rte_memcpy(ind_tbl, adapter->indirect_table, > - sizeof(adapter->indirect_table)); > + memcpy(ind_tbl, adapter->indirect_table, > + sizeof(adapter->indirect_table)); > }), > struct ena_com_dev *ena_dev, u32 *ind_tbl); > > diff --git a/drivers/net/ena/ena_rss.c b/drivers/net/ena/ena_rss.c > index b6c4f76e3820..c723d3f5fca1 100644 > --- a/drivers/net/ena/ena_rss.c > +++ b/drivers/net/ena/ena_rss.c > @@ -59,7 +59,7 @@ void ena_rss_key_fill(void *key, size_t size) > key_generated =3D true; > } > > - rte_memcpy(key, default_key, size); > + memcpy(key, default_key, size); > } > > int ena_rss_reta_update(struct rte_eth_dev *dev, > -- > 2.35.1 >