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 E5777A0553; Fri, 10 Jun 2022 14:06:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D2B3E4069C; Fri, 10 Jun 2022 14:06:32 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2058.outbound.protection.outlook.com [40.107.223.58]) by mails.dpdk.org (Postfix) with ESMTP id 64F0F40689 for ; Fri, 10 Jun 2022 14:06:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CrlcCOoEpfZchRDdE9NbkufRbVUkpnhNE84f6cc7+vZr/xY4CW7vjrJKq0vN4rAg7wcq9QO2aT7bXb05Ef5qMWg0UFJZjAwoD2KLCSKVIWSRfFqYCctQvOZ4cMNrKF5wFbBjDlytiOmS478bR8PNcc2vQjNkBJ5avPGIrZTlybg6xuKxBOMc1R5tRt59w/sP1OuQhnAjS8JpVsBKlSAO9Zu4ydYW45N/nPHdqawDgHXrI4VpXwu8ntK+2jGoFNkQXwRqcQOWMGzfBNf84dkkdLKl8DrMcfKxOyI04g+1b5felux8MitLE3jjKCAvfe6spluvXULkJeBgWPrA5cUGzg== 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=HEJkHyAEL+XQloosahOroHWUjDFwdNAwR1TJCNxNFys=; b=CkbW+XjML4LnHkcVaFMUc5gABTlBMe9GY4o4/0kxr3xp8zEp+b1h8FgCUeQl3teSC/jNofBJZR4lI8l2xzNPfPnxx5CcEHIgs2oP+Aw3jR54kU+KUxPyzVEIYBexYv4AmpMuA3KelZW8YP42Blg6CFyLJhQCVQvHZV/VVxSjQnkHkvfeasDz8roSDZgBiUsV444bfTdy0xMJK1CsOxjw5DvcaSfhFVd1WiiqTnPTdwGJUxPq3nvbkTUu+2rul0GbFtdUOhDOI0taxe7hHYGRjkW6B9ITT4GRz6I9R04tOW1TE57tzCRK2byGou33FhQBfovWQacTju6kTFDsAf9nyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=smartsharesystems.com 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=HEJkHyAEL+XQloosahOroHWUjDFwdNAwR1TJCNxNFys=; b=IDODo9JuyO2Uj2SPJ3HojUqy2JYZDmWyH9qVjJV9s9mj8A/zY6xtRBKyz6YmrQKn4LTAm9KXS9BoT1mIPvBs2vhPp/v/RRtsad6MaYSUSmp4AOxdkgZaxSMcqqMJXVgbDED50X+8ngA7qG7JfSIJISqKYynU5ljg/G34QNaJaQI= Received: from BN6PR17CA0057.namprd17.prod.outlook.com (2603:10b6:405:75::46) by BY5PR02MB6193.namprd02.prod.outlook.com (2603:10b6:a03:1fd::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Fri, 10 Jun 2022 12:06:28 +0000 Received: from BN1NAM02FT059.eop-nam02.prod.protection.outlook.com (2603:10b6:405:75:cafe::b) by BN6PR17CA0057.outlook.office365.com (2603:10b6:405:75::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.19 via Frontend Transport; Fri, 10 Jun 2022 12:06:28 +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 BN1NAM02FT059.mail.protection.outlook.com (10.13.2.167) 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 12:06:27 +0000 Received: from xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) 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 13:06:26 +0100 Received: from smtp.xilinx.com (172.21.105.198) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 10 Jun 2022 13:06:26 +0100 Envelope-to: mb@smartsharesystems.com, stephen@networkplumber.org, dev@dpdk.org, konstantin.v.ananyev@yandex.ru Received: from [10.71.117.247] (port=57048) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nzdPF-0004uc-Tu; Fri, 10 Jun 2022 13:06:26 +0100 Message-ID: <005540f3-71a4-d45d-01fb-46a682c70d94@xilinx.com> Date: Fri, 10 Jun 2022 13:06:25 +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: =?UTF-8?Q?Morten_Br=c3=b8rup?= , Stephen Hemminger CC: , Konstantin Ananyev References: <20220608224928.457440-1-stephen@networkplumber.org> <98CBD80474FA8B44BF855DF32C47DC35D8710F@smartserver.smartshare.dk> From: Ferruh Yigit In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D8710F@smartserver.smartshare.dk> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eac10034-1482-4217-07e7-08da4ad9a5b5 X-MS-TrafficTypeDiagnostic: BY5PR02MB6193: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: /+Jse7FhtnUpgk9MDKXulbWb2ifvCclZMP6kwvbewd9eaOK3p6iocc8XbqnqTloiOhS6Bt3QRWM94eIzRDCO24ZBxtcGI2kZ1dW4zAoDBPLfR4nGRrxgKUS98Kb5kQW5I6zBIJaXseKHKDJC4c+7BKn031HrDO1s7heE7Phhio2XzVwAxxXpPzMMUoVD7KPacArrTtYgHojI2LcusUZWhpR5KTDA73Q69m+2RMqgZ1LocAv3YGeYm2tPMIAmMDfn8z6vMlrN9u8cl/82rGw+K24YQ6ezGKBg++SGoqQILyV0qT9HBJVBNDgAn9XVFlMoitezjQUomJqvkFHKN9QEh00qJDir33ZWADUctiywNNcVo2kiC9yNvmCyJt3qCVusSrjH9Fr75cbUZfRJTKFXaieOi+xciZsZXG3SrPyWPr//Cd1vDuoTsg/GoNXBHIMtbTjizIePTS1C/soK9NGhqEaZohjUjiKKIq58zei5KKLKUbcGadNBK0RW/lcu5KkI+aTxYP3gZwO7OD0QWJIkK8rlISgMaHLrYRc2TtKRHl+ujdviWMQ1pZIfPo62dxODe7dSyrcRQyg/2khHmSC7SMCrf8o2ckQDckkfc1V1SBgfJgokCBt1YCGWorHUZLzYxNxE7GZFKO6pWhpXfQRINyAtJPjzcMcTHFagjlmEYeeCkYBA/6sMK+13IgvIm/6409GnLVW4mON8vWVn/mNEGbl+NRf1yJNnuvqQq7dWCW4XzHKGzW2/SeDDawJ9HDBACERBaFp0Btf2Gp+vYxmwQw== 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)(47076005)(110136005)(316002)(9786002)(5660300002)(36860700001)(66574015)(36756003)(4326008)(70586007)(70206006)(54906003)(508600001)(8936002)(31686004)(8676002)(336012)(53546011)(83380400001)(2616005)(2906002)(82310400005)(40460700003)(356005)(7636003)(426003)(26005)(31696002)(186003)(44832011)(50156003)(41533002)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2022 12:06:27.3091 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eac10034-1482-4217-07e7-08da4ad9a5b5 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: BN1NAM02FT059.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6193 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/10/2022 11:39 AM, Morten Brørup wrote: > CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email. > > >> From: Ferruh Yigit [mailto:ferruh.yigit@xilinx.com] >> Sent: Friday, 10 June 2022 12.13 >> >> 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. > > Any such testing will be highly compiler dependent. > > Do you have any specific compilers in mind, where you see a risk for lower performance? > Hi Morten, My point is possible performance impact, not about any possible risk or specific compiler version. The possible performance impact part can be separated to its own patch and these can be discussed there, independent from gcc12 build error.