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 19598A0C4B; Thu, 21 Oct 2021 08:20:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D8B33410E2; Thu, 21 Oct 2021 08:20:03 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2043.outbound.protection.outlook.com [40.107.22.43]) by mails.dpdk.org (Postfix) with ESMTP id 8102840142 for ; Thu, 21 Oct 2021 08:20:02 +0200 (CEST) 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=AqZ2GA2f9eX5KJ+XhbVgEs/nZq6RRw5qC3iKxGCDjJ0=; b=PGt0W3uy+606ic+ebff5N4BENfcWZv9SA0L/x8hasPCn6xeDDE/uB4EY7Gyf78LAU9qZAlWQth3EDc6r9V5tO52SSjX3fkuShnG520yIurZdlEPCKaMFyaWJpx4v8kYtxX80vs4rwuKl7/KYkWZdwKSM2+tHcZeG6rh07hqWrhc= Received: from DB6PR0301CA0098.eurprd03.prod.outlook.com (2603:10a6:6:30::45) by AM0PR08MB4388.eurprd08.prod.outlook.com (2603:10a6:208:13e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Thu, 21 Oct 2021 06:20:00 +0000 Received: from DB5EUR03FT017.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:30:cafe::bc) by DB6PR0301CA0098.outlook.office365.com (2603:10a6:6:30::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 06:20:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; 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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT017.mail.protection.outlook.com (10.152.20.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18 via Frontend Transport; Thu, 21 Oct 2021 06:20:00 +0000 Received: ("Tessian outbound d5def7722ff7:v103"); Thu, 21 Oct 2021 06:20:00 +0000 X-CR-MTA-TID: 64aa7808 Received: from fda4c659d3f7.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7AFF48E6-8D58-4E63-BAD1-82FD9CC28F24.1; Thu, 21 Oct 2021 06:19:50 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fda4c659d3f7.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 Oct 2021 06:19:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l+uz19+56klvYJXwwYEwE2nSWfdKpfk7ge8HiwTWygC/KIrbWfHF3ILfefj4QjcGJZi95DmpdSUdno5aq7b94by68VOIwA6q4u0wp8VC+p+uJIQ1R8zaL+4xYoDSsTNdHAq0Wg8Cz3fvUIcYrRppfJTU7j9L8NwatM/uMDVfwAKJCcceJPdLJ20HAqtCfyWqR5aTt8NZ6b7/C0vY3esm0XfwUg5zMfZspE6hlLYgj0MyNYNDtfcoiYOXIuR5NqApW8sdVzuDBRBAxquI/EfXNDcfMDJXtpFTnAZLUCXBsWtsnfnFFKvh/rCGw6fRxSIw+32l1/ua2VNhpK53bUCMAw== 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=AqZ2GA2f9eX5KJ+XhbVgEs/nZq6RRw5qC3iKxGCDjJ0=; b=lOA+gKQSYp5Llq6swGlNHiOHP1AikxWU2KbrZzGCCEeqru2PG/2qxSSW+JRMXfWYhupiNKx6S5Kkca8hDoeyAkDyeQB5k/rOMfJfErb/jjCxnFakvHjohUAGXOu7ZxSiOrvT2FggYe59HJXfZzMR54y2Bw+oipXmj4iuZrMVvedZ22jyMFVEEUJsdpEp/FtC3+AhSjzdpGdCrMbdPliIuVooAcCjZO/uH5XDGboglV2p2Za2ujo7GdwoTxg3gHJKL41Nw5qCh2V6aD+KtNJsVSWsdZNhD9rNcZIslKV8hMvSB3q3hnKMd+uuGrJtyKbeN/j2EMw+0oghysG2YPh/AQ== 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=AqZ2GA2f9eX5KJ+XhbVgEs/nZq6RRw5qC3iKxGCDjJ0=; b=PGt0W3uy+606ic+ebff5N4BENfcWZv9SA0L/x8hasPCn6xeDDE/uB4EY7Gyf78LAU9qZAlWQth3EDc6r9V5tO52SSjX3fkuShnG520yIurZdlEPCKaMFyaWJpx4v8kYtxX80vs4rwuKl7/KYkWZdwKSM2+tHcZeG6rh07hqWrhc= Received: from AM9PR08MB7292.eurprd08.prod.outlook.com (2603:10a6:20b:437::20) by AM9PR08MB7275.eurprd08.prod.outlook.com (2603:10a6:20b:436::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Thu, 21 Oct 2021 06:19:37 +0000 Received: from AM9PR08MB7292.eurprd08.prod.outlook.com ([fe80::bd9c:5dc0:ca0:cd6a]) by AM9PR08MB7292.eurprd08.prod.outlook.com ([fe80::bd9c:5dc0:ca0:cd6a%3]) with mapi id 15.20.4608.018; Thu, 21 Oct 2021 06:19:36 +0000 From: Joyce Kong To: "ferruh.yigit@intel.com" , "thomas@monjalon.net" , Honnappa Nagarahalli , Ruifeng Wang CC: "dev@dpdk.org" , nd Thread-Topic: [dpdk-dev] [PATCH] kni: remove non-C11 path from FIFO sync Thread-Index: AQHXlMAxsxk5hftkEUqTo4Js2cgnf6vdWbrg Date: Thu, 21 Oct 2021 06:19:35 +0000 Message-ID: References: <20210819060442.19014-1-joyce.kong@arm.com> In-Reply-To: <20210819060442.19014-1-joyce.kong@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: B2A10BD3C6B569468CCD42B7F5F9B26D.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-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 3cb43246-7bb3-4669-3818-08d9945acfb8 x-ms-traffictypediagnostic: AM9PR08MB7275:|AM0PR08MB4388: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: OXFsiylsRx3RCSBf5fMmHvP3v4N65sIR7QV7MpA7oh9hz+OPsbaV7ZeKLF51nc8ALX70WVlqwetxQtTbP4dmfey0C9HkMvbiR4+BFNZ5tRtpmR/SR/xWrY8syv0FjXg12RICe0JaYBgcPgDsBFahkS4k6LESKEaT4ub4JzAxyMk0/AvpWt/ow1/FGl2DE+JqP66XBXMQRUj8c8wcONjuIl5HajGSLMlDVgeN1F7uOjzmvqKtmNqV4CCuFu1+OEXjmeIZ0sQ1AzT/YruUiP2qVUBYjnL9Ct8f+qdOWw62xx0R3pSvhI4ASi9mUmXYqs9YnukfgRbJrug6Lp4BzGBNR7GfCz7bkSvYu/KwZKRvgCTxEepr02DOfTZ8NW3zmRboy9K/MjMNGsh9g9yKovLiuoCi+xcK72MH00ngP/DfQ7kPHM/hjfzZGScYjJ9Eky9V6hgKsLbBeONoxPmBmfE28owYKoovfZPPuV/YcGthS2oB2bMYe7QTAdhfSnntxnHL+u6NJorVwPzZkaXdgY/BoRP+jCPSrL6DuIHoxgiECkMGCFNMrUxaQCpLfVBDISyiYFZYXTTIIGloancwL56HJYpIZrhm94rDLmWZSf4Na0Kkuyc21uD6qD0ZwVVPpDliD7y67cfvVAVeX9DwFTCiAOXpZZ45xIpFeDbt+3j9/fK/S80gGSSqVrcy1bdOXWEA8scudPqTFlplsldh0l3wmg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB7292.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(33656002)(52536014)(66446008)(508600001)(122000001)(5660300002)(4326008)(55016002)(38070700005)(8936002)(26005)(9686003)(83380400001)(8676002)(186003)(7696005)(53546011)(6506007)(66946007)(64756008)(66556008)(86362001)(2906002)(38100700002)(76116006)(71200400001)(110136005)(6636002)(66476007)(316002)(54906003); 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: AM9PR08MB7275 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: DB5EUR03FT017.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 678755d4-37be-4532-1db9-08d9945ac175 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5SCYJRpcNDOWwnBk+6CsabMKFtdHZy7CCYqUfxN1ui01Kai1vWxcuAShvvroneDVQgTtOP3qQUuRmsinb6ogeYBqyrt9cGWauJL4gWTZ//FqGx2D8psBF3YCffeKLIdDiUM4iEbLcTVEABLTSdE0TE0sp4uEmwq9UipGoY57IJcPP7SwUiUinHEA6hYj0MUySd+1mWEQcX3dvvSoo+lZDwLqugoVptR5jYQZO8ncxNsD9ikLAODNQckzp+8Fp0zWE16uEOI7XB9vXl/xaKokvd4b+k5hTn9qxBl8N/mCeSZW11YPLfqoseq61fwxt1Jwh2KOaeaKKUkEw8z7tz6zEyFK6zCnsb/y0LlajBSWY45MI4J35n4JsAD7x9iWoaMXT/Cpbzf0r/BeIhdtxMkYt/SF8FwESq5dKD9nnOO2do2KuQhtVwFBtV2QpcwXOkApix8KSLcYP0OejjOtbOi3/y0zIL0DX0f0ihH0I0DE6UMyJk/2ddB0/9bJeCGDi6Agiln6yygsOOx5rvqOtVt1NJnTPHHjcNLlLuxM5v1DsNDeULjHWDXMZSvx38UeFa1ZHcyXx4RxOTpLMC5gL0m785bYj6es8p/pe3VDW1wRT95gwqglJonoIaxDyIz9FE/GU+2NvbwV+QSLzX5qmqM3s2DO4PzCOtn7pN9Z0taMAfhLfWYcp4e/vKEb/zXMD6xg 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:(4636009)(36840700001)(46966006)(6506007)(5660300002)(7696005)(82310400003)(81166007)(86362001)(508600001)(70586007)(53546011)(26005)(2906002)(8936002)(186003)(110136005)(70206006)(47076005)(8676002)(316002)(54906003)(52536014)(9686003)(55016002)(36860700001)(4326008)(83380400001)(33656002)(336012)(356005)(6636002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 06:20:00.2500 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3cb43246-7bb3-4669-3818-08d9945acfb8 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: DB5EUR03FT017.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4388 Subject: Re: [dpdk-dev] [PATCH] kni: remove non-C11 path from FIFO sync 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 Sender: "dev" Hi, I'm seeing the CI failure with Arm-gigabyte due to automic_autotest and mal= loc_autotest failures.=20 While this patch is not related to these unit tests since it only modified = kni part, this may be a common CI issue. Also, would you please have a review about this patch? Thanks, Joyce > -----Original Message----- > From: dev On Behalf Of Joyce Kong > Sent: Thursday, August 19, 2021 2:05 PM > To: ferruh.yigit@intel.com; Honnappa Nagarahalli > ; Ruifeng Wang > > Cc: dev@dpdk.org; nd > Subject: [dpdk-dev] [PATCH] kni: remove non-C11 path from FIFO sync >=20 > Non-C11 path was meant to not break build with GCC version < 4.7(when > C11 atomics were introduced), while now minimum GCC version supported > by DPDK has been 4.9, C11 atomics support in compiler is no longer a > problem. So non-C11 path can be removed. >=20 > Signed-off-by: Joyce Kong > Reviewed-by: Ruifeng Wang > --- > lib/kni/rte_kni_common.h | 9 ++------ > lib/kni/rte_kni_fifo.h | 48 +++++++--------------------------------- > 2 files changed, 10 insertions(+), 47 deletions(-) >=20 > diff --git a/lib/kni/rte_kni_common.h b/lib/kni/rte_kni_common.h index > b547ea5501..20d94eaa9b 100644 > --- a/lib/kni/rte_kni_common.h > +++ b/lib/kni/rte_kni_common.h > @@ -58,13 +58,8 @@ struct rte_kni_request { > * Writing should never overwrite the read position > */ > struct rte_kni_fifo { > -#ifdef RTE_USE_C11_MEM_MODEL > - unsigned write; /**< Next position to be written*/ > - unsigned read; /**< Next position to be read */ > -#else > - volatile unsigned write; /**< Next position to be written*/ > - volatile unsigned read; /**< Next position to be read */ > -#endif > + unsigned write; /**< Next position to be written*/ > + unsigned read; /**< Next position to be read */ > unsigned len; /**< Circular buffer length */ > unsigned elem_size; /**< Pointer size - for 32/64 bit OS */ > void *volatile buffer[]; /**< The buffer contains mbuf pointers */ > diff --git a/lib/kni/rte_kni_fifo.h b/lib/kni/rte_kni_fifo.h index > d2ec82fe87..057f6b3ded 100644 > --- a/lib/kni/rte_kni_fifo.h > +++ b/lib/kni/rte_kni_fifo.h > @@ -2,38 +2,6 @@ > * Copyright(c) 2010-2014 Intel Corporation > */ >=20 > - > - > -/** > - * @internal when c11 memory model enabled use c11 atomic memory > barrier. > - * when under non c11 memory model use rte_smp_* memory barrier. > - * > - * @param src > - * Pointer to the source data. > - * @param dst > - * Pointer to the destination data. > - * @param value > - * Data value. > - */ > -#ifdef RTE_USE_C11_MEM_MODEL > -#define __KNI_LOAD_ACQUIRE(src) ({ \ > - __atomic_load_n((src), __ATOMIC_ACQUIRE); \ > - }) > -#define __KNI_STORE_RELEASE(dst, value) do { \ > - __atomic_store_n((dst), value, __ATOMIC_RELEASE); \ > - } while(0) > -#else > -#define __KNI_LOAD_ACQUIRE(src) ({ \ > - typeof (*(src)) val =3D *(src); \ > - rte_smp_rmb(); \ > - val; \ > - }) > -#define __KNI_STORE_RELEASE(dst, value) do { \ > - *(dst) =3D value; \ > - rte_smp_wmb(); \ > - } while(0) > -#endif > - > /** > * Initializes the kni fifo structure > */ > @@ -59,7 +27,7 @@ kni_fifo_put(struct rte_kni_fifo *fifo, void **data, > unsigned num) > unsigned i =3D 0; > unsigned fifo_write =3D fifo->write; > unsigned new_write =3D fifo_write; > - unsigned fifo_read =3D __KNI_LOAD_ACQUIRE(&fifo->read); > + unsigned fifo_read =3D __atomic_load_n(&fifo->read, > __ATOMIC_ACQUIRE); >=20 > for (i =3D 0; i < num; i++) { > new_write =3D (new_write + 1) & (fifo->len - 1); @@ -69,7 > +37,7 @@ kni_fifo_put(struct rte_kni_fifo *fifo, void **data, unsigned nu= m) > fifo->buffer[fifo_write] =3D data[i]; > fifo_write =3D new_write; > } > - __KNI_STORE_RELEASE(&fifo->write, fifo_write); > + __atomic_store_n(&fifo->write, fifo_write, __ATOMIC_RELEASE); > return i; > } >=20 > @@ -81,7 +49,7 @@ kni_fifo_get(struct rte_kni_fifo *fifo, void **data, > unsigned num) { > unsigned i =3D 0; > unsigned new_read =3D fifo->read; > - unsigned fifo_write =3D __KNI_LOAD_ACQUIRE(&fifo->write); > + unsigned fifo_write =3D __atomic_load_n(&fifo->write, > __ATOMIC_ACQUIRE); >=20 > for (i =3D 0; i < num; i++) { > if (new_read =3D=3D fifo_write) > @@ -90,7 +58,7 @@ kni_fifo_get(struct rte_kni_fifo *fifo, void **data, > unsigned num) > data[i] =3D fifo->buffer[new_read]; > new_read =3D (new_read + 1) & (fifo->len - 1); > } > - __KNI_STORE_RELEASE(&fifo->read, new_read); > + __atomic_store_n(&fifo->read, new_read, __ATOMIC_RELEASE); > return i; > } >=20 > @@ -100,8 +68,8 @@ kni_fifo_get(struct rte_kni_fifo *fifo, void **data, > unsigned num) static inline uint32_t kni_fifo_count(struct rte_kni_fifo= *fifo) > { > - unsigned fifo_write =3D __KNI_LOAD_ACQUIRE(&fifo->write); > - unsigned fifo_read =3D __KNI_LOAD_ACQUIRE(&fifo->read); > + unsigned fifo_write =3D __atomic_load_n(&fifo->write, > __ATOMIC_ACQUIRE); > + unsigned fifo_read =3D __atomic_load_n(&fifo->read, > __ATOMIC_ACQUIRE); > return (fifo->len + fifo_write - fifo_read) & (fifo->len - 1); } >=20 > @@ -111,7 +79,7 @@ kni_fifo_count(struct rte_kni_fifo *fifo) static inli= ne > uint32_t kni_fifo_free_count(struct rte_kni_fifo *fifo) { > - uint32_t fifo_write =3D __KNI_LOAD_ACQUIRE(&fifo->write); > - uint32_t fifo_read =3D __KNI_LOAD_ACQUIRE(&fifo->read); > + uint32_t fifo_write =3D __atomic_load_n(&fifo->write, > __ATOMIC_ACQUIRE); > + uint32_t fifo_read =3D __atomic_load_n(&fifo->read, > __ATOMIC_ACQUIRE); > return (fifo_read - fifo_write - 1) & (fifo->len - 1); } > -- > 2.17.1