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 01A7D41C8E for ; Mon, 13 Feb 2023 21:13:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E707142D3E; Mon, 13 Feb 2023 21:13:49 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2045.outbound.protection.outlook.com [40.107.15.45]) by mails.dpdk.org (Postfix) with ESMTP id 00E8640A81; Mon, 13 Feb 2023 21:13:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O8EcAul++Nx8C2+B7S3nTiWKSndGqItizE8GtSU6ZeM=; b=VG3mo90/qDzS06Kntt7Lhsif9X495n/BtPnL0IRtrNT8Q14NCCygr74gdI98C1HjbepXG96zb/pQcKsRwk/q27pSKle4n4xHDA8XGHCtbkpJjRcym9gYc3EDepIB4SQm8x1GSEnUpavou8HDOPlYMbNEsVJ2jq7F41CWGFlVwV4= Received: from AS9PR01CA0024.eurprd01.prod.exchangelabs.com (2603:10a6:20b:540::29) by PAXPR08MB6623.eurprd08.prod.outlook.com (2603:10a6:102:155::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.24; Mon, 13 Feb 2023 20:13:35 +0000 Received: from AM7EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:540:cafe::4f) by AS9PR01CA0024.outlook.office365.com (2603:10a6:20b:540::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.24 via Frontend Transport; Mon, 13 Feb 2023 20:13:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT035.mail.protection.outlook.com (100.127.141.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.24 via Frontend Transport; Mon, 13 Feb 2023 20:13:35 +0000 Received: ("Tessian outbound 333ca28169fa:v132"); Mon, 13 Feb 2023 20:13:35 +0000 X-CR-MTA-TID: 64aa7808 Received: from 1f5bf8f52d66.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 563BE875-E976-40EC-99ED-443F6702FA20.1; Mon, 13 Feb 2023 20:13:25 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1f5bf8f52d66.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 13 Feb 2023 20:13:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bse+O2wqovdXPbGMyb1aGzq5onN/Kol5TXwZc0Ef9rRLHTDEwg4CMqBqgSCk7NUxO3HaKfg72A9aabU4VcD8hUSZpbVGsgOcno9LKg1A0VC0fdded729HzOb0Lv5ygBpbvSsPm2Udc/O4gMeSHExP8zSpBK+R9h+759a9qmEUrcFM6b3LUlj1WhfzjAY2IFzPY2lx+c3x+JQCz7YaRARbd9yQSDiKPNzUEJwzjW1mOUoIJ3Eu32okVqZ2CsYdkTwJTAOkfuK8XLnP54arJ/0C/tR7IU8YWWB5dTHaypJSfo3d8t60yQt0V0uk2JS+ejUGryL/zK1lxCyTiJNvQ9iKw== 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=O8EcAul++Nx8C2+B7S3nTiWKSndGqItizE8GtSU6ZeM=; b=RyeE464Pg3sxPnGx/lY/D2hhpVvPezs8FABI9F9dsBr3HdhkOrqIt6uZ3ji8W56ybC6rKXQBc7B+5SoiZZ8eai6C+IjY5MKENz8iP/aOlIba3XMWK2GeOcvQT/MEpjbWMu5fVGoIhD6yk48fJNOx/fbm64EtxQXLUFeW7xmYW5RuHs6LoMX9qO1OnqiIixH6KoHNsCPLa0dD7oyD0Zm75rBCoi0kAYG0af2VXZcRyvysYccCtUy4JgYfzpmmhim9w1mb4VDy3Xb1DCEshg25XNmiypn6xULepUmY3sCvJjXEdLJYDjJ8Stlj/gd01sHtotWQUWAdv34f+MfzYj/TkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O8EcAul++Nx8C2+B7S3nTiWKSndGqItizE8GtSU6ZeM=; b=VG3mo90/qDzS06Kntt7Lhsif9X495n/BtPnL0IRtrNT8Q14NCCygr74gdI98C1HjbepXG96zb/pQcKsRwk/q27pSKle4n4xHDA8XGHCtbkpJjRcym9gYc3EDepIB4SQm8x1GSEnUpavou8HDOPlYMbNEsVJ2jq7F41CWGFlVwV4= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB8PR08MB5385.eurprd08.prod.outlook.com (2603:10a6:10:119::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.23; Mon, 13 Feb 2023 20:13:23 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::f8c8:b4b6:c041:ac9d]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::f8c8:b4b6:c041:ac9d%5]) with mapi id 15.20.6086.024; Mon, 13 Feb 2023 20:13:23 +0000 From: Honnappa Nagarahalli To: Tyler Retzlaff CC: "bruce.richardson@intel.com" , "mb@smartsharesystems.com" , "dev@dpdk.org" , Ruifeng Wang , "jerinj@marvell.com" , nd , "stable@dpdk.org" , "pbhagavatula@marvell.com" , Stephen Hemminger , nd Subject: RE: [RFC] eal: use same atomic intrinsics for gcc and clang Thread-Topic: [RFC] eal: use same atomic intrinsics for gcc and clang Thread-Index: AQHZPbwb5D+PRbVdS0iT2saw2Mh4VK7NUFeAgAACasA= Date: Mon, 13 Feb 2023 20:13:21 +0000 Message-ID: References: <20230211015622.408487-1-honnappa.nagarahalli@arm.com> <20230213200105.GA24482@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> In-Reply-To: <20230213200105.GA24482@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 09E0780F4D95584DA4011649C3EF1457.0 x-checkrecipientchecked: true Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: DBAPR08MB5814:EE_|DB8PR08MB5385:EE_|AM7EUR03FT035:EE_|PAXPR08MB6623:EE_ X-MS-Office365-Filtering-Correlation-Id: f8a5a8de-f899-4a55-3a0a-08db0dfec990 x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: PTR+xeblfVFaEM1/F7xM7BFDeSs/ks//TOxEPS4U7Cyd03zwhoXDZi6AJWxWUwN4AxrHSopX+UUtUYZH/506aCe9csjFsw9h+Yk4szuSqSIPNfNvVwMIK6YutKNRhl6HV+gzo8WcYqJOiAgAsDKoTWBfunN4l5SddHJrRDJuhRmYr7mRg6NP+1Q/qhMOItmK08wE04DO7fLh5DtnjD/JB0i0CW21SfwUBNquxaVUMHshMXm46jXupRzANIzEiQs/GCfX+IQA4eVn7H1cEuHZ+vP2acHu0RNeZRl7yk7pF71O4AsydisPgz9KI1K7/go41o/5ToFC47CLH0fvJY7xvhYcuJV82NUhSJz1UkEC7xgdcH+UjGDmVGKOKg4lTh8CsjKC5h25Y78oFQZl+V3OSXloLYJ7Kt15P0pkY7mV1VY/sqR9UrhapVsauJA5seGAzAfQTPXqo0Tnijq7EhGZM/5NzwQXgEomeS/Ky1RZZHMOz15SbyACBYQ5B5ZpRxVwBmSB69QFOfjl/CXQx0JTjGbGL1m7uQiyVQa9Bes4xi0po7Pb/liRKkekZeKSzdrFO7pcSGcSj74I9RTOU/GCdjrJDOxSsGstpUDdmPF99boz+Mup/kAuLwnm23LDkrHokcVGRINnIZXnjwfd2nV28m2WJ3gKzV8e65lefe16zp1mnRQVHqpK9teI4ZQTt8956s8FNnlqyLPmWyi9d+sJZw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5814.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(366004)(39860400002)(136003)(396003)(346002)(376002)(451199018)(478600001)(38100700002)(122000001)(54906003)(66946007)(66476007)(6916009)(66556008)(83380400001)(8676002)(66446008)(4326008)(76116006)(64756008)(316002)(6506007)(7696005)(186003)(9686003)(5660300002)(33656002)(41300700001)(8936002)(71200400001)(38070700005)(86362001)(55016003)(2906002)(52536014); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5385 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9764ad77-2540-4c45-0c9d-08db0dfec175 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FJsCsdeRtdRkKNP3trMBJVkgC/2ly65fmM1HAxAL4AgfwojCcJXntC/UdhI8hPgBGljido0U9LVD8WJOcEJeYlPz/y8at/hBXzpeo2DCwPuICAWPSWjswlINwqcnVDZqbrfjf4n9Qg/nVWThulVHhQwxD+XgIvlqRBpWRzRlNWJQ2Ko2jeGuqKhEGd/BqioB2gYJoBk5E8gbniRqOwqKx0Dzs0sfoDe2yzY24T/NqGRM436cxy47jQ6pFKVr0FxnZRvcQ08KPlN2O3TbMCy4Ps1x6XAxxEaSpMUtP+yLay9etnehKH3eNuFkgRATywrn1fK7aqpzcv+GCn7QAJ/eT+97y5v9TmyOnNFuREB1bcbLCN6Mue7RozigTqFYybTdLlWgt/58M3Ejba9OlPYVV0/40NKk+WkoQj+VBwOVEmbuMUwNrCosLMqXl0eCJLrZoO/Zo8NNMpvmAQxEahhm0K2F9G0NolQaUWedgZOkQkrQUtFekkI/CJehO/6U9YiW63ZBgjBNm0fTp4e8H0ASxF5TIACqDDS3FhzXqbCXH2w7YlilzIpQn0ao0jZyBd0jFVjdy09pLuCw21xKFqJ3r4FqTGFZfa8rGR15sGKW4Ink7x/RWySHKLgRGieFpy1FIWQ95qdjHvKNeWW5sUE05HDNFXf1euOYra6F2nPqqnTjja2huJ8WAgtjFlRLYCDcubu0sD6VcnTzB0ILETMYNA== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230025)(4636009)(39860400002)(376002)(136003)(346002)(396003)(451199018)(40470700004)(46966006)(36840700001)(8936002)(36860700001)(6506007)(4326008)(5660300002)(52536014)(41300700001)(33656002)(81166007)(6862004)(8676002)(86362001)(70206006)(450100002)(40460700003)(70586007)(55016003)(356005)(40480700001)(478600001)(336012)(2906002)(82740400003)(47076005)(54906003)(82310400005)(316002)(26005)(9686003)(7696005)(186003)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2023 20:13:35.6802 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f8a5a8de-f899-4a55-3a0a-08db0dfec990 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6623 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org >=20 > On Fri, Feb 10, 2023 at 07:56:22PM -0600, Honnappa Nagarahalli wrote: > > The size generic atomic intrinsics generate the same code as the size > > specific intrinsics for gcc. Use size generic intrinsics for both gcc > > and clang. > > > > Fixes: 7bdccb93078e ("eal: fix ARM build with clang") > > Cc: stable@dpdk.org > > Cc: pbhagavatula@marvell.com > > > > Signed-off-by: Honnappa Nagarahalli >=20 > Acked-by: Tyler Retzlaff >=20 > so first of all thanks for fixing this up. it was confusing me why it was= being > conditionally compiled (there was no documented rationale). >=20 > i do have a slight concern that perhaps the reason this was done was beca= use > __atomic_exchange_n on some gcc versions or for some specific target > processor was generating less than desirable code but if nobody else has = this > concern i won't get in the way since it simplifies things. Agree, I could not find a rationale from the commit logs. However, I did so= me tests on Godbolt and the latest compilers generated the same code for bo= th the variants for x86 and ARM. I think the initial author was Stephen, may be he has some comments. >=20 > thanks! >=20 > > --- > > lib/eal/include/generic/rte_atomic.h | 12 ------------ > > 1 file changed, 12 deletions(-) > > > > diff --git a/lib/eal/include/generic/rte_atomic.h > > b/lib/eal/include/generic/rte_atomic.h > > index f5c49a9870..234b268b91 100644 > > --- a/lib/eal/include/generic/rte_atomic.h > > +++ b/lib/eal/include/generic/rte_atomic.h > > @@ -176,11 +176,7 @@ rte_atomic16_exchange(volatile uint16_t *dst, > > uint16_t val); static inline uint16_t rte_atomic16_exchange(volatile > > uint16_t *dst, uint16_t val) { -#if defined(__clang__) > > return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST); -#else > > - return __atomic_exchange_2(dst, val, __ATOMIC_SEQ_CST); > > -#endif > > } > > #endif > > > > @@ -459,11 +455,7 @@ rte_atomic32_exchange(volatile uint32_t *dst, > > uint32_t val); static inline uint32_t rte_atomic32_exchange(volatile > > uint32_t *dst, uint32_t val) { -#if defined(__clang__) > > return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST); -#else > > - return __atomic_exchange_4(dst, val, __ATOMIC_SEQ_CST); > > -#endif > > } > > #endif > > > > @@ -741,11 +733,7 @@ rte_atomic64_exchange(volatile uint64_t *dst, > > uint64_t val); static inline uint64_t rte_atomic64_exchange(volatile > > uint64_t *dst, uint64_t val) { -#if defined(__clang__) > > return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST); -#else > > - return __atomic_exchange_8(dst, val, __ATOMIC_SEQ_CST); > > -#endif > > } > > #endif > > > > -- > > 2.25.1