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 B52DBA0544; Wed, 8 Jun 2022 17:32:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9826A4069C; Wed, 8 Jun 2022 17:32:35 +0200 (CEST) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id E856140687 for ; Wed, 8 Jun 2022 17:32:34 +0200 (CEST) Received: by mail-pj1-f48.google.com with SMTP id cx11so18926120pjb.1 for ; Wed, 08 Jun 2022 08:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MdZiItCgT0HfCPUS29CX6iMCWtUuipVs/qLnd9/j6vU=; b=NwVenNTELH966GQnZcx3eAFwNBtE9taTQRKyiKVJ7pLaxDMVKu6motraQgIw5pESR9 CtO1GgJxAArrE79sgfvqbqJsnrtzopi1p0jMFDqaQODcQ3k2W1pSIfJ8ByGhc8FUTpLy t4CZXCI54bXLCdy4IwA0EmUwfDsjm0+nth6BRCjoTCtBSXDFhR63A/7H/3ZWrdmMbh0v 1yG3Mpsla4UKRg+IF/2Uz2xLVfP30Zv4pwnTlIaSIFbDTRiRBorBFmDDlcLWORPT4nTe LlNYsG2uLhNViLwZPoqvTduBBDaUhprv6l/o83RpRxELRO2YlQJRb090oVcQKN1j3Kah Yncw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MdZiItCgT0HfCPUS29CX6iMCWtUuipVs/qLnd9/j6vU=; b=rvh6DUSCkuJqZHtNt5PQlsuPcJjRr7R+EVv/NQs1YN4LSNTh/TbunuDa8op8fHs8Yh LFM0ZUrIWYyYC/iZMMcjqhpJajowOMzdB2i/KpCt6EHfiIZpA8xWcx2mNuP2AaW/3RT5 80rsepPFYS57puJ+yd0xdORdWQoPhWDnbjN/X79KuEXWZOef4qHwNP/Bwqx0OqFRvnDW S2khdDWiqyTkNJ40Tr7xkNXFfcC/a9nGTQAmJ3THfNvvSTzQEhsWurC0cy+Yqrnm8n0N Otmfqs5M0KGbUGWrhFOOoudou/CDb/pskfsREutjQRh3xvBxUfp+8lqN4G+byGcw6JR7 /+tg== X-Gm-Message-State: AOAM530x966dY+8PyzL4+CyfXhFDpFFtFmdI6dmSJRY+Evp8Z+RuA6l+ IFtMPpG5XvDMoJkp43xyiyEw7A== X-Google-Smtp-Source: ABdhPJzVvbSmfBH6eB39YzPmKkzILX3dNFMuzraKcwnqPQSgstNp3bamx9tt6QKGBAaBnwKrlR2vvg== X-Received: by 2002:a17:90b:368b:b0:1e6:67a0:1c17 with SMTP id mj11-20020a17090b368b00b001e667a01c17mr40315396pjb.203.1654702354076; Wed, 08 Jun 2022 08:32:34 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id a2-20020a17090aa50200b001e871124c69sm6937632pjq.40.2022.06.08.08.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 08:32:33 -0700 (PDT) Date: Wed, 8 Jun 2022 08:32:31 -0700 From: Stephen Hemminger To: =?UTF-8?B?TWljaGHFgg==?= Krawczyk Cc: dev , Marcin Wojtas , Shai Brandes , Evgeny Schemeilin , Igor Chauskin Subject: Re: [RFC 1/8] net/ena: fix warnings related to rte_memcpy and gcc-12 Message-ID: <20220608083231.1bcb1a01@hermes.local> In-Reply-To: References: <20220607171746.461772-1-stephen@networkplumber.org> <20220607171746.461772-2-stephen@networkplumber.org> MIME-Version: 1.0 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 On Wed, 8 Jun 2022 14:29:58 +0200 Micha=C5=82 Krawczyk wrote: > 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. =20 >=20 > Hi Stephen, >=20 > 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. >=20 > [1] https://doc.dpdk.org/guides/prog_guide/writing_efficient_code.html#me= mory > [2] https://www.intel.com/content/www/us/en/developer/articles/technical/= performance-optimization-of-memcpy-in-dpdk.html >=20 > Thanks, > Michal >=20 I admit to having little sympathy unfixable for base/ style code. You could have just replaced memcpy() in their with an abstraction layer like other drivers. The full gcc-12 warnings are: 913/2989] Compiling C object drivers/libtmp_rte_net_ena.a.p/net_ena_ena_rss= .c.o In file included from /usr/lib/gcc/x86_64-linux-gnu/12/include/immintrin.h:= 43, from /usr/lib/gcc/x86_64-linux-gnu/12/include/x86intrin.h:= 32, from ../lib/eal/x86/include/rte_vect.h:31, from ../lib/eal/x86/include/rte_memcpy.h:17, from ../lib/mempool/rte_mempool.h:46, from ../lib/mbuf/rte_mbuf.h:38, from ../lib/net/rte_ether.h:22, from ../drivers/net/ena/ena_ethdev.h:10, from ../drivers/net/ena/ena_rss.c:6: In function =E2=80=98_mm256_loadu_si256=E2=80=99, inlined from =E2=80=98rte_mov32=E2=80=99 at ../lib/eal/x86/include/rte_= memcpy.h:346:9, inlined from =E2=80=98rte_mov128=E2=80=99 at ../lib/eal/x86/include/rte= _memcpy.h:369:2, inlined from =E2=80=98rte_memcpy_generic=E2=80=99 at ../lib/eal/x86/inc= lude/rte_memcpy.h:445:4, inlined from =E2=80=98rte_memcpy=E2=80=99 at ../lib/eal/x86/include/rte= _memcpy.h:853:10, inlined from =E2=80=98ena_rss_key_fill=E2=80=99 at ../drivers/net/ena/e= na_rss.c:62:2: /usr/lib/gcc/x86_64-linux-gnu/12/include/avxintrin.h:929:10: warning: array= subscript =E2=80=98__m256i_u[1]=E2=80=99 is partly outside array bounds of= =E2=80=98uint8_t[40]=E2=80=99 {aka =E2=80=98unsigned char[40]=E2=80=99} [-= Warray-bounds] 929 | return *__P; | ^~~~ ../drivers/net/ena/ena_rss.c: In function =E2=80=98ena_rss_key_fill=E2=80= =99: ../drivers/net/ena/ena_rss.c:51:24: note: at offset 32 into object =E2=80= =98default_key=E2=80=99 of size 40 51 | static uint8_t default_key[ENA_HASH_KEY_SIZE]; | ^~~~~~~~~~~ In function =E2=80=98_mm256_loadu_si256=E2=80=99, inlined from =E2=80=98rte_mov32=E2=80=99 at ../lib/eal/x86/include/rte_= memcpy.h:346:9, inlined from =E2=80=98rte_mov128=E2=80=99 at ../lib/eal/x86/include/rte= _memcpy.h:370:2, inlined from =E2=80=98rte_memcpy_generic=E2=80=99 at ../lib/eal/x86/inc= lude/rte_memcpy.h:445:4, inlined from =E2=80=98rte_memcpy=E2=80=99 at ../lib/eal/x86/include/rte= _memcpy.h:853:10, inlined from =E2=80=98ena_rss_key_fill=E2=80=99 at ../drivers/net/ena/e= na_rss.c:62:2: /usr/lib/gcc/x86_64-linux-gnu/12/include/avxintrin.h:929:10: warning: array= subscript 2 is outside array bounds of =E2=80=98uint8_t[40]=E2=80=99 {aka = =E2=80=98unsigned char[40]=E2=80=99} [-Warray-bounds] 929 | return *__P; | ^~~~ ../drivers/net/ena/ena_rss.c: In function =E2=80=98ena_rss_key_fill=E2=80= =99: ../drivers/net/ena/ena_rss.c:51:24: note: at offset 64 into object =E2=80= =98default_key=E2=80=99 of size 40 51 | static uint8_t default_key[ENA_HASH_KEY_SIZE]; | ^~~~~~~~~~~ In function =E2=80=98_mm256_loadu_si256=E2=80=99, inlined from =E2=80=98rte_mov32=E2=80=99 at ../lib/eal/x86/include/rte_= memcpy.h:346:9, inlined from =E2=80=98rte_mov128=E2=80=99 at ../lib/eal/x86/include/rte= _memcpy.h:371:2, inlined from =E2=80=98rte_memcpy_generic=E2=80=99 at ../lib/eal/x86/inc= lude/rte_memcpy.h:445:4, inlined from =E2=80=98rte_memcpy=E2=80=99 at ../lib/eal/x86/include/rte= _memcpy.h:853:10, inlined from =E2=80=98ena_rss_key_fill=E2=80=99 at ../drivers/net/ena/e= na_rss.c:62:2: /usr/lib/gcc/x86_64-linux-gnu/12/include/avxintrin.h:929:10: warning: array= subscript 3 is outside array bounds of =E2=80=98uint8_t[40]=E2=80=99 {aka = =E2=80=98unsigned char[40]=E2=80=99} [-Warray-bounds] 929 | return *__P; | ^~~~ ../drivers/net/ena/ena_rss.c: In function =E2=80=98ena_rss_key_fill=E2=80= =99: ../drivers/net/ena/ena_rss.c:51:24: note: at offset 96 into object =E2=80= =98default_key=E2=80=99 of size 40 51 | static uint8_t default_key[ENA_HASH_KEY_SIZE]; | ^~~~~~~~~~~ In function =E2=80=98_mm256_loadu_si256=E2=80=99, inlined from =E2=80=98rte_mov32=E2=80=99 at ../lib/eal/x86/include/rte_= memcpy.h:346:9, inlined from =E2=80=98rte_mov64=E2=80=99 at ../lib/eal/x86/include/rte_= memcpy.h:358:2, inlined from =E2=80=98rte_memcpy_generic=E2=80=99 at ../lib/eal/x86/inc= lude/rte_memcpy.h:452:4, inlined from =E2=80=98rte_memcpy=E2=80=99 at ../lib/eal/x86/include/rte= _memcpy.h:853:10, inlined from =E2=80=98ena_rss_key_fill=E2=80=99 at ../drivers/net/ena/e= na_rss.c:62:2: /usr/lib/gcc/x86_64-linux-gnu/12/include/avxintrin.h:929:10: warning: array= subscript =E2=80=98__m256i_u[1]=E2=80=99 is partly outside array bounds of= =E2=80=98const void[40]=E2=80=99 [-Warray-bounds] 929 | return *__P; | ^~~~ ../drivers/net/ena/ena_rss.c: In function =E2=80=98ena_rss_key_fill=E2=80= =99: ../drivers/net/ena/ena_rss.c:51:24: note: at offset 32 into object =E2=80= =98default_key=E2=80=99 of size 40 51 | static uint8_t default_key[ENA_HASH_KEY_SIZE]; | ^~~~~~~~~~~ ../drivers/net/ena/ena_rss.c:51:24: note: at offset [33, 40] into object = =E2=80=98default_key=E2=80=99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: at offset 160 into object =E2=80= =98default_key=E2=80=99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: at offset 32 into object =E2=80= =98default_key=E2=80=99 of size 40 In function =E2=80=98_mm256_loadu_si256=E2=80=99, inlined from =E2=80=98rte_mov32=E2=80=99 at ../lib/eal/x86/include/rte_= memcpy.h:346:9, inlined from =E2=80=98rte_memcpy_generic=E2=80=99 at ../lib/eal/x86/inc= lude/rte_memcpy.h:457:4, inlined from =E2=80=98rte_memcpy=E2=80=99 at ../lib/eal/x86/include/rte= _memcpy.h:853:10, inlined from =E2=80=98ena_rss_key_fill=E2=80=99 at ../drivers/net/ena/e= na_rss.c:62:2: /usr/lib/gcc/x86_64-linux-gnu/12/include/avxintrin.h:929:10: warning: array= subscript [2, 288230376151711745] is outside array bounds of =E2=80=98cons= t void[40]=E2=80=99 [-Warray-bounds] 929 | return *__P; | ^~~~ ../drivers/net/ena/ena_rss.c: In function =E2=80=98ena_rss_key_fill=E2=80= =99: ../drivers/net/ena/ena_rss.c:51:24: note: object =E2=80=98default_key=E2=80= =99 of size 40 51 | static uint8_t default_key[ENA_HASH_KEY_SIZE]; | ^~~~~~~~~~~ ../drivers/net/ena/ena_rss.c:51:24: note: at offset [1, 40] into object =E2= =80=98default_key=E2=80=99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: at offset [128, 192] into object = =E2=80=98default_key=E2=80=99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: object =E2=80=98default_key=E2=80= =99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: at offset [1, 40] into object =E2= =80=98default_key=E2=80=99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: at offset [128, 192] into object = =E2=80=98default_key=E2=80=99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: object =E2=80=98default_key=E2=80= =99 of size 40 In function =E2=80=98_mm256_loadu_si256=E2=80=99, inlined from =E2=80=98rte_mov32=E2=80=99 at ../lib/eal/x86/include/rte_= memcpy.h:346:9, inlined from =E2=80=98rte_memcpy_generic=E2=80=99 at ../lib/eal/x86/inc= lude/rte_memcpy.h:458:4, inlined from =E2=80=98rte_memcpy=E2=80=99 at ../lib/eal/x86/include/rte= _memcpy.h:853:10, inlined from =E2=80=98ena_rss_key_fill=E2=80=99 at ../drivers/net/ena/e= na_rss.c:62:2: /usr/lib/gcc/x86_64-linux-gnu/12/include/avxintrin.h:929:10: warning: array= subscript [2, 288230376151711746] is outside array bounds of =E2=80=98cons= t void[40]=E2=80=99 [-Warray-bounds] 929 | return *__P; | ^~~~ ../drivers/net/ena/ena_rss.c: In function =E2=80=98ena_rss_key_fill=E2=80= =99: ../drivers/net/ena/ena_rss.c:51:24: note: at offset [1, 40] into object =E2= =80=98default_key=E2=80=99 of size 40 51 | static uint8_t default_key[ENA_HASH_KEY_SIZE]; | ^~~~~~~~~~~ ../drivers/net/ena/ena_rss.c:51:24: note: at offset [2, 40] into object =E2= =80=98default_key=E2=80=99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: at offset [129, 193] into object = =E2=80=98default_key=E2=80=99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: at offset [1, 40] into object =E2= =80=98default_key=E2=80=99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: at offset [2, 40] into object =E2= =80=98default_key=E2=80=99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: at offset [129, 193] into object = =E2=80=98default_key=E2=80=99 of size 40 ../drivers/net/ena/ena_rss.c:51:24: note: at offset [1, 40] into object =E2= =80=98default_key=E2=80=99 of size 40 In function =E2=80=98_mm256_loadu_si256=E2=80=99, inlined from =E2=80=98rte_mov32=E2=80=99 at ../lib/eal/x86/include/rte_= memcpy.h:346:9, inlined from =E2=80=98rte_memcpy_generic=E2=80=99 at ../lib/eal/x86/inc= lude/rte_memcpy.h:438:3, inlined from =E2=80=98rte_memcpy=E2=80=99 at ../lib/eal/x86/include/rte= _memcpy.h:853:10, inlined from =E2=80=98ena_rss_key_fill=E2=80=99 at ../drivers/net/ena/e= na_rss.c:62:2: /usr/lib/gcc/x86_64-linux-gnu/12/include/avxintrin.h:929:10: warning: array= subscript =E2=80=98__m256i_u[0]=E2=80=99 is partly outside array bounds of= =E2=80=98uint8_t[40]=E2=80=99 {aka =E2=80=98unsigned char[40]=E2=80=99} [-= Warray-bounds] 929 | return *__P; | ^~~~ ../drivers/net/ena/ena_rss.c: In function =E2=80=98ena_rss_key_fill=E2=80= =99: ../drivers/net/ena/ena_rss.c:51:24: note: at offset [17, 32] into object = =E2=80=98default_key=E2=80=99 of size 40 51 | static uint8_t default_key[ENA_HASH_KEY_SIZE]; | ^~~~~~~~~~~