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 C9D0CA0553; Fri, 10 Jun 2022 12:12:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6DC844069C; Fri, 10 Jun 2022 12:12:40 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2058.outbound.protection.outlook.com [40.107.244.58]) by mails.dpdk.org (Postfix) with ESMTP id B5E1640689 for ; Fri, 10 Jun 2022 12:12:38 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eYFbNhOqxU104jXtPHYFXbN8Cnwe+WiqTh4QdpDmRbuv5+w1u+DwUod90VW1lNXrWTonII2wL85q6F8rMIk3uZImbWOuYGuwH0xh3vTxBOb46hSWgAsq50vzAe+OAolmfy4NUE5ompoudf63YOv6jEU2rXOTxmX2cB/5r5lEqI5me8hRgQVmdwI5pkT+TDY2gIASBd+RquxP8ZkfXfI0F0VoAEOCeY1ZQqjYx2pFMa5al5EfwXAwD34HDDCffG6c3b+ZeiGdEYpkzChJLIx06XHOow2byhRP8XEx2+D+o9b9M0OzpqC048fcokIROhRuJgRS7nnR2oSnnt9C5tardg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XOryZZmCwgM1nVzT/wxQhyeqVlbvO1P+kbYrvNFEIfM=; b=KFILU8lJEHfsaEKIPKU35IFgDJljnU548IW9WqoK/MHXKOwqzO+0HHVXJzz4VqE3D/IuQKInytggLitUEz4mfR8h32nqp2tJWAcShYYJmr4sXjey+ZKbJTO5/+Z0PvdmMFThAa9ZqUwuSD9dFvCGoaiHoZUv+S+4LC9/CDNlvkb/8peZq2Ebrr1QXyzF5ZLGZmD4ObU9kF8Vdhw/3Io0LXHZSN9+lQtp6MeQEW//7+84s1UePfA7N/VC4pMH0tWdYmvUIhDAQNHsjRKrOKhXxSHtfl5fWWZhZUykSqN8B80cENWcNfViicczNMEghmQ4kDzKbb4FHIHliQfDUx/60w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=networkplumber.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XOryZZmCwgM1nVzT/wxQhyeqVlbvO1P+kbYrvNFEIfM=; b=Fwd8LYt5z4zOuHnfqxApfRs9t/jusJvUzUASgB2ruPfimSritamVngEqQ4ohRIv9RmA0+5BB6sKdJD+KjwT2ZxDtB442dVHIidGvqbeihULQnJsJ69GQZV6APEnYEtNCx68FDC72VyahFy4qq3PRwEGFOjUGKO/Jn1bLigy0KXE= Received: from DS7PR03CA0096.namprd03.prod.outlook.com (2603:10b6:5:3b7::11) by CY4PR02MB3237.namprd02.prod.outlook.com (2603:10b6:910:7c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.18; Fri, 10 Jun 2022 10:12:36 +0000 Received: from DM3NAM02FT045.eop-nam02.prod.protection.outlook.com (2603:10b6:5:3b7:cafe::8b) by DS7PR03CA0096.outlook.office365.com (2603:10b6:5:3b7::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.17 via Frontend Transport; Fri, 10 Jun 2022 10:12:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.80.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.80.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.80.198; helo=xir-pvapexch01.xlnx.xilinx.com; pr=C Received: from xir-pvapexch01.xlnx.xilinx.com (149.199.80.198) by DM3NAM02FT045.mail.protection.outlook.com (10.13.4.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5332.12 via Frontend Transport; Fri, 10 Jun 2022 10:12:35 +0000 Received: from xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 10 Jun 2022 11:12:34 +0100 Received: from smtp.xilinx.com (172.21.105.197) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 10 Jun 2022 11:12:34 +0100 Envelope-to: stephen@networkplumber.org, dev@dpdk.org, konstantin.v.ananyev@yandex.ru, mb@smartsharesystems.com Received: from [10.71.117.247] (port=55741) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nzbd4-00032I-Cf; Fri, 10 Jun 2022 11:12:34 +0100 Message-ID: Date: Fri, 10 Jun 2022 11:12:34 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [RFC] eal/x86: disable array bounds checks in rte_memcpy_generic with gcc-12 Content-Language: en-US To: Stephen Hemminger References: <20220608224928.457440-1-stephen@networkplumber.org> From: Ferruh Yigit CC: , Konstantin Ananyev , =?UTF-8?Q?Morten_Br=c3=b8rup?= In-Reply-To: <20220608224928.457440-1-stephen@networkplumber.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6d2a02a7-ba82-450f-8b44-08da4ac9bde9 X-MS-TrafficTypeDiagnostic: CY4PR02MB3237:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H+h1ULHnlfKJD4Qny7KDcRXcfB+MSybbTArcxrXbOxf5lcXO/hLtJVGhyHUaZUXyS7pr1uNx8AliJL4AsjA1xSCcYhmVbTIur+7ax4m5EsKAfPT6+m1JaFuHQLVGzJ/MPHHKnwNdFoAdty0kke7V3ND0iQe0E3LVPayfdQphJfANpY1u2Z5XlH2dx/z/bdqXf1Vr4CGu+qIgG9Rp4Ad1rBDG3cSWqhR8UmM1zetwRSEnZtGBWSYLiNBE4kK8wlB2BtwPSJHNUtaiCpgYWkNutp/d8ilZyW40noPRt5ExGZGGBekFwodAZlnXhE7b5J9QRebjTKEWu/ypMJfYU3y7roDhD1sMWTTJwoXULyWrhVKDyWuSLNgeXZhQanvHHILjEUAL+5cSzclCVXh2WL3qbrYPnSiYm866JkNhzLq27YkkuR+QkXqBm/flFZAGyIIDucRxJ0ZVkKoi4Fqkvm2xm8BgzHDdall5VNcd1gZU3DM2ivnpPJ14xfQNuEsWcwzh3n28g/DCEYPYg/UfFPh1vnL9CTfnHIA3NemBoxkcempTFrlULQ4PZqwIjD0gIjAI+Ik0JnhFveyMvhZvFM9IgnLdhLrIkA4nUfcEbri27gsNRbAThimPxukbP0tgxmOzjvoHPu8GYe/OQgy46n3ltLQSN9DZjbxNiqtM/qiO/ZIzQSo8mPw9s41gnYhdxF6rhCTC1wtzcAkg0g4qIqi8iTqYhAuUm6YDCAzQDcbJCdRsmoYDws36wnloJVSAzi3FlnF+y/YtxTJGSpV91Gk0Ag== X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch01.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(8936002)(53546011)(5660300002)(47076005)(4326008)(8676002)(508600001)(186003)(82310400005)(44832011)(426003)(336012)(36756003)(316002)(9786002)(2616005)(7636003)(31686004)(356005)(2906002)(36860700001)(6916009)(31696002)(70206006)(54906003)(40460700003)(26005)(70586007)(83380400001)(41533002)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2022 10:12:35.9396 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6d2a02a7-ba82-450f-8b44-08da4ac9bde9 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT045.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB3237 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 6/8/2022 11:49 PM, Stephen Hemminger wrote: > Gcc 12 adds more array bounds checking (good); but it is not smart > enough to realize that for small fixed sizes, the bigger move options > are not used. > > An example is using rte_memcpy() on a RSS key of 40 bytes may trigger > rte_memcpy complaints from rte_mov128 reading past end of input. > > In order to keep some of the checks add special case for calls > to rte_memcpy() with fixed size arguments to use the compiler > builtin instead. Don't want to give all the checking for > code that uses rte_memcpy() everywhere. > > Signed-off-by: Stephen Hemminger > --- > lib/eal/x86/include/rte_memcpy.h | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > > diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h > index 18aa4e43a743..b90cdd8d7326 100644 > --- a/lib/eal/x86/include/rte_memcpy.h > +++ b/lib/eal/x86/include/rte_memcpy.h > @@ -27,6 +27,10 @@ extern "C" { > #pragma GCC diagnostic ignored "-Wstringop-overflow" > #endif > > +#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000) > +#pragma GCC diagnostic ignored "-Warray-bounds" > +#endif > + > /** > * Copy bytes from one location to another. The locations must not overlap. > * > @@ -842,19 +846,21 @@ rte_memcpy_aligned(void *dst, const void *src, size_t n) > return ret; > } > > +#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 100000) > +#pragma GCC diagnostic pop > +#endif > + > static __rte_always_inline void * > rte_memcpy(void *dst, const void *src, size_t n) > { > - if (!(((uintptr_t)dst | (uintptr_t)src) & ALIGNMENT_MASK)) > + if (__builtin_constant_p(n)) > + return __builtin_memcpy(dst, src, n); > + else if (!(((uintptr_t)dst | (uintptr_t)src) & ALIGNMENT_MASK)) This patch does two things, 1. Disable "-Warray-bounds" with above pragma to silence compiler warnings. 2. Use compiler builtin for some cases. Second can impact the performance and not really needed for the build error, what do you think to split the patch in two, since 1. is simple change but 2. may require more testing before accepting.