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 276CEA054F; Tue, 2 Mar 2021 04:13:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 95E854014E; Tue, 2 Mar 2021 04:13:39 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2077.outbound.protection.outlook.com [40.107.21.77]) by mails.dpdk.org (Postfix) with ESMTP id B952B40142 for ; Tue, 2 Mar 2021 04:13:37 +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=frsT0GjO0rwy5+Gm8YdE56X85Wl+JzvW0ZATjiLr5qQ=; b=DkSMAezTFdc7XBtOGiYBaKQ6UdwlRw5l49Fx4ohdrc3mC11zp5VfQi8uCvKN3kzy8wYC4vxoXZc+JeW9+zwTmTScWl41RRgq0XN10lNDUrrVnWdMvuGtK4m27g8nJ+WrwPIGzCJte04H1iBZbg4SCqUlI2MHy79fg0Vc794l+U0= Received: from DU2PR04CA0173.eurprd04.prod.outlook.com (2603:10a6:10:2b0::28) by AM5PR0801MB1634.eurprd08.prod.outlook.com (2603:10a6:203:39::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.23; Tue, 2 Mar 2021 03:13:35 +0000 Received: from DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b0:cafe::50) by DU2PR04CA0173.outlook.office365.com (2603:10a6:10:2b0::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Tue, 2 Mar 2021 03:13:35 +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 DB5EUR03FT047.mail.protection.outlook.com (10.152.21.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Tue, 2 Mar 2021 03:13:35 +0000 Received: ("Tessian outbound 662e50485350:v71"); Tue, 02 Mar 2021 03:13:34 +0000 X-CR-MTA-TID: 64aa7808 Received: from f58c6bdfc4d6.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9036B5B2-3EF2-465C-8EDC-AE507995208A.1; Tue, 02 Mar 2021 03:13:29 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f58c6bdfc4d6.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 02 Mar 2021 03:13:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fn4Ou61VNs5S8hUIIGYFLQs4np/BStX2318MuQ50FRSW99H2ZfXAnqnvRftTj99J3Orgei6Y7B7+Huv6K77dRFbRQ5EFoYceaxFjYCGlWq6TnZEWKFHWO3Of8DmqasVtyzTGVW6daDlx8ribe5QwVhQH1EidUditeLQFr6eB7/+1PeZ0Z/6cILlcXLVsMxVAB2iWG2cA4QWGCVMbGRyW7TPsB4Y7LrabkcDjFhdCGhzYKUjbuADnwxKkoiOH9pdrMKuFwCs5ES6jFOKcotWc3Y5lre82tLPtAurtSWHzijVLAQhYf4pplA/FQntPwuDFLuLHXQY1hw+fscPNpgc6pQ== 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-SenderADCheck; bh=frsT0GjO0rwy5+Gm8YdE56X85Wl+JzvW0ZATjiLr5qQ=; b=Vqxn4QePDLe5up0Vmqib8N+urlAd+6TpnKokv8IOLCrAfPUQxZWm8G/51MMagdHny6JhV35Urr2xP82VkHm4dmL+Zk2R+TbbuqFFGTn2kT1jXsS0HtmwrLu7gDqoFCSG+88QxDtPqwGHeWH8cPX6ElFfFqZMqhX+ulNnUwADk8L9ea8sl/51BWiWJW5q+D0/qfkIKkm1JWnw3cjWHAgR638hLlmFyVCpNRTqGpkTOugQRDgvAO98x6NvnR2YW0CaOj76irzHOzEATWegvAFbww5F7dmhUfbraiK2UIwav0wEH2E5Mzd/hFPJObFf3CQOtmBog3jrSpRcKYnmEiEYSA== 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=frsT0GjO0rwy5+Gm8YdE56X85Wl+JzvW0ZATjiLr5qQ=; b=DkSMAezTFdc7XBtOGiYBaKQ6UdwlRw5l49Fx4ohdrc3mC11zp5VfQi8uCvKN3kzy8wYC4vxoXZc+JeW9+zwTmTScWl41RRgq0XN10lNDUrrVnWdMvuGtK4m27g8nJ+WrwPIGzCJte04H1iBZbg4SCqUlI2MHy79fg0Vc794l+U0= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB6PR08MB2648.eurprd08.prod.outlook.com (2603:10a6:6:17::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.26; Tue, 2 Mar 2021 03:13:25 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::cbb:4373:1761:19b1]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::cbb:4373:1761:19b1%7]) with mapi id 15.20.3868.037; Tue, 2 Mar 2021 03:13:25 +0000 From: Honnappa Nagarahalli To: "thomas@monjalon.net" , Feifei Wang , "david.marchand@redhat.com" , "konstantin.ananyev@intel.com" CC: "hemant.agrawal@nxp.com" , "Nipun.gupta@nxp.com" , "jerinj@marvell.com" , "harry.van.haaren@intel.com" , "bruce.richardson@intel.com" , "dmitry.kozliuk@gmail.com" , "navasile@linux.microsoft.com" , "dmitrym@microsoft.com" , "pallavi.kadam@intel.com" , "dev@dpdk.org" , Ruifeng Wang , nd , nd Thread-Topic: [RFC 3/5] eal: lcore state FINISHED is not required Thread-Index: AQHXCvL6fsXhExvHBE+iVSlZJam1PKpofqqwgAAAyECAAGZ6YIABNlMAgAXsayA= Date: Tue, 2 Mar 2021 03:13:25 +0000 Message-ID: References: <20210224212018.17576-1-honnappa.nagarahalli@arm.com> <36690444.8nk3bCcZ7h@thomas> In-Reply-To: <36690444.8nk3bCcZ7h@thomas> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 4B97BA7FDA0AC944AD6BAD578B29F3BA.0 x-checkrecipientchecked: true Authentication-Results-Original: monjalon.net; dkim=none (message not signed) header.d=none; monjalon.net; dmarc=none action=none header.from=arm.com; x-originating-ip: [70.113.13.105] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d71cb98a-a00a-4e5a-6156-08d8dd292a98 x-ms-traffictypediagnostic: DB6PR08MB2648:|AM5PR0801MB1634: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 3MPc9o9ia9xrBJip+ua84HSm+MrArnsJ8IYQqArTmc3WY7UKl4TBlraqmOwPqt635pTt+7XTqEzCVhG70y93d1ZfxRlLh+tgGf/H9lckOQdzUgIzqMIaX1+o2S3dwZN3kS9I1kuSqFce7nlV67M9qrwp6d8ewo9rfERo4Hb0ebACtIs+uo0YLjrojJlbYTltWaTbY17wivH/+FFMHh9bocHDBWa7hHgR0DgZs6sbsR9HwNPv+lptGfZ5WsRct/ohNpJ2c/2H7eU5hwoKh7+RAkWZr60qJ5/lXCMztlRJtTKQyryRRINDIWFhBpdRlRLBj7t8mLBoaThvpFE4dY6IkUp4fc2KfriFyS1WX4RzuOugfKynXhPI9wphLqqxBVusFspjjwoQeIOsx0KLDy9/pUr249TbygJWKLJQtNfa/zYSJrgQCM2GomVXek5fQZdPI3X7FPNAr2Z+Hu0XOdh7Y13MXgsYFCzwdFW60el9sphYfsbpK9lKgf1yI+X7t5sRxsO6vIe15yPq/+sBunDzsA== 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)(136003)(376002)(396003)(39860400002)(366004)(346002)(66556008)(71200400001)(66446008)(64756008)(66476007)(4326008)(26005)(83380400001)(186003)(54906003)(33656002)(66946007)(52536014)(8936002)(7696005)(86362001)(6506007)(8676002)(9686003)(2906002)(316002)(55016002)(5660300002)(478600001)(110136005)(7416002)(76116006); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?fijGAAkqmzOHHWh3IrELgqGRJdkWbV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KNuxV2qcbpZy6LUqW4hk794exnUni8sLMraIHMog8VKUIXvksGViAh?= =?us-ascii?Q?ODqjRYtafz5g+butxYZLxomo00zGnw9SaukOcsYBF2y5LmXwCdNzRsb2ttUx?= =?us-ascii?Q?ePTCDqz1fO6WbE+yA0L6d9BEh5LIaulGE+FsS40pGCmTlIcEdBJDdclxnEFF?= =?us-ascii?Q?008eZE7sl4wVT/tsMXzK+fnfZg4x3vGMvdiCsja3ysTnQG5JqJirTNjPsYfZ?= =?us-ascii?Q?9okouivJVNblv5Vuq2VzgSboTQaxnjOUW+Yu4pPA1h5fxanDwtXnJWu8I+No?= =?us-ascii?Q?yLt/kilj+EGVVq0l2LJFRCEoFiAzXjBxRZdg7yspmzWUHNkmwiOqpU9/F+Sw?= =?us-ascii?Q?eqa7KvNPpWbl8kkx6be7t8bETjxUWdDSaNTLfC6pQ/RxDu1VWIcSxTHxQ635?= =?us-ascii?Q?e0/Rjz3aEC69Lzv7WWFNpQNT?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2648 Original-Authentication-Results: monjalon.net; dkim=none (message not signed) header.d=none; monjalon.net; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 101e8104-ba94-4ab3-3c66-08d8dd2924d6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3H5EmYXQKqEVY9ytbHfh7JokuRlDlS1J+94gMeAtg8x+XWXTQRnxUGT0JZH5MSDPSnTazK9Qhoipd6SKiaDDleRMTobkz+kBezMUSaMIfe5nOlN5kKub1uoqxYrokyfAeMizbiUPAbNkQT4fxOSW6ghgAQL43vkGa4oYoX/a5sNMLiuN9RIWEeNsqqIri5Hd7uFurzedxDtru5e9nyWxKa9SoJzTItxjmJcQ8YrlvBFC9Td69ROEDxWxhWlSVgOASCaQTiapTewUZqu+/oCcMHZZVTiUzWwmvqZzy6tGu5lPWn6Ij4NmkLAqRQj3uXMX53AyhDGrlD6KQDBF5bFUb5SM835toWurov90ut/zMIIVCY3ByINi7pBNOw/OBqOv0EQeE/H1dT7DokVKZJTpvlc93ZmxzAKVn9UhdNGMzi3GQbfEw/TmGDwd0hh/HcOgMIH90gn+Tr3XSwj808qiT4Bf2xYv9VzhgXlHrpnx6jpbUUqMr2fEfZ2H3AhxoeClediySmB4SSHsDNPhzlAOCYDF77KsoMjR01+IMlshG8sGvDfBhxXO4pTlHRX+J/1Ir/LaFsMXL0wdCs2gwD4mw/TB7gx9OsjY5bdHEexMEB8VwFFPouAS+/NwRwu3Er05fnuTgIP7LhW14S4nVj5vYQ6ezrDKKjAvmXu6RoHG8rE= 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)(396003)(136003)(39860400002)(346002)(376002)(36840700001)(46966006)(33656002)(356005)(8676002)(2906002)(86362001)(186003)(83380400001)(54906003)(26005)(47076005)(7696005)(336012)(110136005)(316002)(4326008)(8936002)(82310400003)(70586007)(478600001)(81166007)(36860700001)(9686003)(5660300002)(55016002)(6506007)(82740400003)(70206006)(52536014); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2021 03:13:35.0882 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d71cb98a-a00a-4e5a-6156-08d8dd292a98 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: DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1634 Subject: Re: [dpdk-dev] [RFC 3/5] eal: lcore state FINISHED is not required 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" > > > > > > Subject: [RFC 3/5] eal: lcore state FINISHED is not required > > > > > > > > FINISHED state seems to be used to indicate that the worker's > > > > update of the 'state' is not visible to other threads. There seems > > > > to be no requirement to have such a state. > > > > > > I am not sure "FINISHED" is necessary to be removed, and I propose > > > some of my profiles for discussion. > > > There are three states for lcore now: > > > "WAIT": indicate lcore can start working > > > "RUNNING": indicate lcore is working > > > "FINISHED": indicate lcore has finished its working and wait to be > > > reset > > If you look at the definitions of "WAIT" and "FINISHED" states, they lo= ok > similar, except for "wait to be reset" in "FINISHED" state . The code rea= lly does > not do anything to reset the lcore. It just changes the state to "WAIT". > > > > > > > > From the description above, we can find "FINISHED" is different from > > > "WAIT", it can shows that lcore has done the work and finished it. > > > Thus, if we remove "FINISHED", maybe we will not know whether the > > > lcore finishes its work or just doesn't start, because this two state= has the > same tag "WAIT". > > Looking at "eal_thread_loop", the worker thread sets the state to "RUNN= ING" > before sending the ack back to main core. After that it is guaranteed tha= t the > worker will run the assigned function. Only case where it will not run th= e > assigned function is when the 'write' syscall fails, in which case it res= ults in a > panic. >=20 > Quick note: it should not panic. > We must find a way to return an error > without crashing the whole application. The syscalls are being used to communicate the status back to the main thre= ad. If they fail, it is not possible to communicate the status. May be it i= s better to panic. We could change the implementation using shared variables, but it would req= uire polling the memory. May be the syscalls are being used to avoid pollin= g. However, this polling would happen during init time (or similar) for a s= hort duration. >=20 >=20 > > > Furthermore, consider such a scenario: > > > Core 1 need to monitor Core 2 state, if Core 2 finishes one task, > > > Core 1 can start its working. > > > However, if there is only one tag "WAIT", Core 1 maybe start its > > > work at the wrong time, when Core 2 still does not start its task at = state > "WAIT". > > > This is just my guess, and at present, there is no similar > > > application scenario in dpdk. > > To be able to do this effectively, core 1 needs to observe the state ch= ange > from WAIT->RUNNING->FINISHED. This requires that core 1 should be calling > rte_eal_remote_launch and rte_eal_wait_lcore functions. It is not possibl= e to > observe this state transition from a 3rd core (for ex: a worker might go = from > RUNNING->FINISHED->WAIT->RUNNING which a 3rd core might not be able to > observe). > > > > > > > > On the other hand, if we decide to remove "FINISHED", please > > > consider the following files: > > > 1. lib/librte_eal/linux/eal_thread.c: line 31 > > > lib/librte_eal/windows/eal_thread.c: line 22 > > > lib/librte_eal/freebsd/eal_thread.c: line 31 > > I have looked at these lines, they do not capture "why" FINISHED state = is > required. > > > > 2. > > > lib/librte_eal/include/rte_launch.h: line 24, 44, 121, 123, 131 3. > > > examples/l2fwd- > > > keepalive/main.c: line 510 > > > rte_eal_wait_lcore(id_core) can be removed. Because the core state > > > has been checked as "WAIT", this is a redundant operation >=20 >=20