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 A5531A0C43; Thu, 21 Oct 2021 22:49:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 421E740040; Thu, 21 Oct 2021 22:49:28 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2083.outbound.protection.outlook.com [40.107.20.83]) by mails.dpdk.org (Postfix) with ESMTP id 287CC4003F for ; Thu, 21 Oct 2021 22:49:27 +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=H36k+sMyw4NYPl61lCUxHRJneiQwLNrmNe56NtxGoo8=; b=aTHd/xANuTMAgKNPicgPopqgCQAhAYzM09RpSmIVXDw32of2ZA8dOrM+Sy2GcwKJ2wajeIsXyNbazmGlkc+8RxrrFIQYqNLLajy9gWKVUk2Y9yYZnC03g6CgKl05vkLLxx55W0XdDmy0pnP5kbf3yB7JGlILMO6VZjK32Ios/P4= Received: from DB6PR1001CA0039.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::25) by PAXPR08MB6751.eurprd08.prod.outlook.com (2603:10a6:102:136::22) 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 20:49:19 +0000 Received: from DB5EUR03FT040.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:55:cafe::51) by DB6PR1001CA0039.outlook.office365.com (2603:10a6:4:55::25) 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 20:49:19 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT040.mail.protection.outlook.com (10.152.20.243) 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 20:49:19 +0000 Received: ("Tessian outbound 2e7020cc8961:v103"); Thu, 21 Oct 2021 20:49:19 +0000 X-CR-MTA-TID: 64aa7808 Received: from 98e7c947f4e2.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6CC15667-5F90-4F0D-BBB3-B02F95DDA99C.1; Thu, 21 Oct 2021 20:49:19 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 98e7c947f4e2.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 Oct 2021 20:49:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GozofX8uvK/u4ZgOI21EfkTnc3G6jA110olPUkct9ppmCPABrPOqZUJGGtK/ndU9YUH4LI0wwTzrLQNv3qHXp+KXLlh4SCj8BRJ9riPaTBcV81YPcyRS27qZOpvv9eWVv+phZsgIsU8L9/mkJQP2rBmk2FRZICZx17AWM5KcP/8RwXm55SkyLnixmm02dzwnm/swB+/pI7+1OORVmw2Z2jSSyxoT6UtBcNfd909oNW3UqU+QJdFKYJ8C6qg5wSrm4TMf12Ngpbarowg4tSeLg0r8MHB7CSGH7TdMX3ZHup+4Jd2ARWV2WwBRGG3zpSvK73XsYySBfBwACGa89kJjIg== 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=H36k+sMyw4NYPl61lCUxHRJneiQwLNrmNe56NtxGoo8=; b=Q5goQ8pyLwkuOHBprGcDs1jUpVmlDysqZuSFV3OlE9qKKfEZ5bavc4DN+sbAHU15yTZS4fZKTq2rDzP1Z0CZ0Arnbgr2f/DIvMVYn/u5SegOxT4SozUnPqEe7k/WhUQ8r1hbScO+dLolh9NNfelyq6k+5Zzi4UvqZ34m9vj/LEhdBQOETkF3CYek5hzd4n+5wk1hizvEBSW/eMYtIXsryMgF0cSYGyiC1f6jNVUwmyHtujPQSs8n1mszicOD1ziD8FqHvI60rN6Yg3DA9sCuuRYSDhtXaOrIDyLmlYNzmzI0kWVW1TkJmN0oQjVPFkXlq03eNLHRoH7rUTrGTUYY0g== 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=H36k+sMyw4NYPl61lCUxHRJneiQwLNrmNe56NtxGoo8=; b=aTHd/xANuTMAgKNPicgPopqgCQAhAYzM09RpSmIVXDw32of2ZA8dOrM+Sy2GcwKJ2wajeIsXyNbazmGlkc+8RxrrFIQYqNLLajy9gWKVUk2Y9yYZnC03g6CgKl05vkLLxx55W0XdDmy0pnP5kbf3yB7JGlILMO6VZjK32Ios/P4= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DBBPR08MB4632.eurprd08.prod.outlook.com (2603:10a6:10:db::20) 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 20:49:06 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::8501:86ca:a393:17b7]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::8501:86ca:a393:17b7%9]) with mapi id 15.20.4608.018; Thu, 21 Oct 2021 20:49:06 +0000 From: Honnappa Nagarahalli To: Olivier Matz CC: "dev@dpdk.org" , "lucp.at.work@gmail.com" , "stephen@networkplumber.org" , "david.marchand@redhat.com" , "thomas@monjalon.net" , Ruifeng Wang , nd , nd Thread-Topic: [PATCH v4 1/2] eal: simplify the implementation of rte_ctrl_thread_create Thread-Index: AQHXxpLR1d5Vs9L7wEmlhRyYYxuwzavd6z3w Date: Thu, 21 Oct 2021 20:49:05 +0000 Message-ID: References: <20210730213709.19400-1-honnappa.nagarahalli@arm.com> <20211013201811.15247-1-honnappa.nagarahalli@arm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 0588DFA53A0A344A8D5019035CE06BBD.0 x-checkrecipientchecked: true Authentication-Results-Original: 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 78998ea3-c2dc-4383-696c-08d994d44123 x-ms-traffictypediagnostic: DBBPR08MB4632:|PAXPR08MB6751: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: TVybiGFEhMnxXg3MvzZtgQGNLS2SDqaopwzLRRHfdtV62t32D3sswv1Wc6fejIOQc5mz3UjA1oJiH70VUegjlmkHra88vErast/d7OiNpFbDjcUI2L9IatxT1rnghAfuyqHU4eIiZJ08ZCjcMWObhk/y/5+U7edDGZoKkiGB9kZ7EjAnyVkC/yF737A9l+gSNoMXAsoCAQarViVxGI846nBSp/zo4iuasJoZ2J+/7kO0zlcGvS7ykBHOC+1ShrZG2yk0+JflqW0gHK5ox7cAq802u/65dvanzfxGYmHABrD9IyJ5rfXGmUR1eOm4pHRKwz9OsV4Su/BumMhTcrjLuOJdbBEZWkgn/VkAoUH7ASfStdT7t6CEmuvmP9eT+1EqRR5eNrtxdaiYTemhORyFlYfa/atrFNWKQ6j1LFb0digGP9luz9dWJtfb0EexV+peBsuKjxQTQGCQLEr42smVga88kH/Qf7OO1kEZ+J+JZI6b5TISO80kATn7WWEjlejzVPEyhe6EkMDXyTnNEEYEm8y2VRJeTlkvYBMBpIdTDta09h3RZQZbqUUOFskRpGK5waBKO/gLe06FlCuuHEwmOSSH1cg/9WMZif43hoBLLJDO8O9Kgh3sDQnhGHnzXIeGs/V8QFlZr0ef+FzZ2tuDEgnIxsyVRXVSB3BN5AvHzRlYa9ypGs3fhSbBWncSY+W9FwYbw78h3XBLRlIwjP0wpA== 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:(4636009)(366004)(52536014)(122000001)(38100700002)(8676002)(66946007)(7696005)(66476007)(66556008)(66446008)(64756008)(76116006)(5660300002)(83380400001)(8936002)(9686003)(55016002)(508600001)(86362001)(33656002)(71200400001)(186003)(38070700005)(316002)(6916009)(4326008)(26005)(54906003)(2906002)(6506007); 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: DBBPR08MB4632 Original-Authentication-Results: 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT040.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 9d52b3d6-820e-49dc-c962-08d994d43904 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d9o/QU8sdmCHK4E10gcdmsRol3ZvSXkqHsDTOkVZm5PPfMdVgfTBThlu2OM2bT9yoSia3JQNxudYQd5YjTXEcbrVV/Y30z50kDXWkgnewLR/zcogSD2EV1NVni2dqTy8Vuyy9/+//7Gjvy6BglDMlGn7R2ymqupkmveYDrJgTRtZaSKiyTZ6B3cZnuglxwwwMQFdSr0HeoN0CS0Vd9vitMYZoIlSw9qrEJeuQoTgCFYlZz5+e3Rt5fal+hIcbcq61TslwlNBupT2a/zBZ4d/ygYr3hwHMIqvL5dooIUiee5Pow1eBBwfd5riu1OkNXAJsv89uK8EO2jDrEQ8FPbb1uhGKXmB4NLil9V91i2ZiEm0erK2W++4qJR1dgis+w0e8D2fdcUq96qFWCg0RAzoXWJ9vz2GPInmlGcvvMB0DlGAZy1tz+6PSGuylIJO4nSWooFw/s5QSR3uxJWVgm48JwmzRf5O6YYBbptojIpNz7xyx+v1ovYbzjssLNFEeEHeC7bo1yLWdWY7M3dF2a0SalvWlwQv+QcnPk2SQeLdMMUERmZ58WkxNJdRjm1SaLzKeRtTdEb/4oSBYabYbNXeNLTc5z11xZ0LH6MF/iCMBlpaj4OuDoW3snBq8bwi4bCPuAmgQn96P6BgiiETHc2ajGO1gULUqennVSTgDQREOF40BqYE/9irJPZYVJgp0OEETdNUtZ9ToY58IitJikmP2w== 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)(5660300002)(81166007)(186003)(36860700001)(26005)(54906003)(316002)(52536014)(6862004)(7696005)(6506007)(8936002)(336012)(4326008)(508600001)(8676002)(86362001)(82310400003)(2906002)(83380400001)(9686003)(55016002)(33656002)(70206006)(47076005)(70586007)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 20:49:19.6383 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78998ea3-c2dc-4383-696c-08d994d44123 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: DB5EUR03FT040.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6751 Subject: Re: [dpdk-dev] [PATCH v4 1/2] eal: simplify the implementation of rte_ctrl_thread_create 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" >=20 > Hi Honnappa, >=20 > On Wed, Oct 13, 2021 at 03:18:10PM -0500, Honnappa Nagarahalli wrote: > > Remove the usage of pthread barrier and replace it with > > synchronization using atomic variable. This also removes the use of > > reference count required to synchronize freeing the memory. > > > > Signed-off-by: Honnappa Nagarahalli >=20 > Reviewed-by: Olivier Matz >=20 > Few cosmetics comments below. >=20 > (...) >=20 > > +enum __rte_ctrl_thread_status { > > + __RTE_CTRL_THREAD_LAUNCHING, /* Yet to call pthread_create > function */ > > + __RTE_CTRL_THREAD_RUNNING, /* Control thread is running > successfully */ > > + __RTE_CTRL_THREAD_ERROR /* Control thread encountered an error > */ }; > > + >=20 > Are there double underscores needed? > I think even the rte_ prefix could be removed since this is not exposed. I am fine to change this, just want to be consistent with the rest of the c= ode. Looks like a lot of code does not use __RTE. >=20 > (...) >=20 > > @@ -236,24 +239,22 @@ rte_ctrl_thread_create(pthread_t *thread, const > char *name, > > "Cannot set name for ctrl thread\n"); > > } > > > > - ret =3D pthread_setaffinity_np(*thread, sizeof(*cpuset), cpuset); > > - if (ret !=3D 0) > > - params->start_routine =3D NULL; > > - > > - pthread_barrier_wait(¶ms->configured); > > - ctrl_params_free(params); > > - > > - if (ret !=3D 0) > > - /* start_routine has been set to NULL above; */ > > - /* ctrl thread will exit immediately */ > > + /* Wait for the control thread to initialize successfully */ > > + while ((ctrl_thread_status =3D > > + __atomic_load_n(¶ms->ctrl_thread_status, > __ATOMIC_ACQUIRE)) > > + =3D=3D __RTE_CTRL_THREAD_LAUNCHING) > > + /* Yield the CPU. Using sched_yield call requires maintaining > > + * another implementation for Windows as sched_yield is not > > + * supported on Windows. > > + */ > > + rte_delay_us_sleep(1); > > + > > + /* Check if the control thread encountered an error */ > > + if (ctrl_thread_status =3D=3D __RTE_CTRL_THREAD_ERROR) > > + /* ctrl thread is exiting */ > > pthread_join(*thread, NULL); >=20 > While not required, I suggest to use curly brackets when the number of li= nes in > the body of the loop or test (including comments). ok >=20 >=20 > Thanks > Olivier