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 0D18D430CA; Tue, 22 Aug 2023 07:47:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8747E42B8B; Tue, 22 Aug 2023 07:47:25 +0200 (CEST) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2065.outbound.protection.outlook.com [40.107.249.65]) by mails.dpdk.org (Postfix) with ESMTP id 3BB2B4021D for ; Tue, 22 Aug 2023 07:47:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=feXxkhGiCawf0XKW0gBPipcoQKt3pAAiMVxoqhra+iqiA3ntaA2DuKd4FQUR2gFXH87AVDzJWVUmgrw3YcXzuPh+BX72i0SXIIppB7FLKA403N90q5xRGXX8i9lI5u7VSFYwPWMc7mLAreO1zXn/NDSlPuSICKZZNkY5CeCrqmdzdIg7jrJTgbmTydkSzF8uQm95bZKtNCr5+lkGivgHVVVsc/AQHqV/h8PYVT+uG3KqhBbvPTYDKXXdlR5TCb361aeSMMgjc8YUJODmTErkLiHEoFlneo8nIptWJtW+wBOVShoQ9Q8HhX8puFIsebgGV3FDkNFG8glTEn6RanKYTA== 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=ZxeE5xtMiit1ZkR2S8YEIEySKMMJ/j2iLi789Jixz6k=; b=Ms5lJeAjm3BEMqRDOhX/jtybPoiLBCX+lCNKmhL6I5muYQEh0YOk2uMUFutNlBct4D+gD9NhiHWzGQ0jgu5buNgj/FLGo3KAer3E5baGdtjPRxGSMoh1e80nHw25hwtdbVOeAaw0WFH6/dkoPQVL3tAJaO8SeYdmNA6us/Qco7hhdA4rZCso3Jyt0HASI34kCB3GOrfLPZEWtWCnbJLVTikS6Rue/fldH8vgEMi4geKDJYlGQ/AFlNxCuj9UgLGVZStz26KKD4tkq1/3pi5gk0hcvhwVa7m8GiwchrD/Evgl2GCd7LUgaHBlp17SkI83n/hQQuKSeK6RNnOoQHfjNg== 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=ZxeE5xtMiit1ZkR2S8YEIEySKMMJ/j2iLi789Jixz6k=; b=dSFIrsnStl5m3y3vmGN3bgajN5H75hL5E3Ympsx6dyvxNaHRUo+EBYyd5r98rYeZeVrq9sXf4JL3dHuMHXCdDgnuqda/J6FHDqG09Fp6qBPwpprYQlABwH6opfsMXbs1Y6BXD1Fh3QJ2yvOymrtEqjb9rGGKzYFLwr54gT3pSXA= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by PAXPR08MB7443.eurprd08.prod.outlook.com (2603:10a6:102:2b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Tue, 22 Aug 2023 05:47:21 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::b3a3:eb56:481f:99c2]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::b3a3:eb56:481f:99c2%4]) with mapi id 15.20.6699.022; Tue, 22 Aug 2023 05:47:21 +0000 From: Honnappa Nagarahalli To: =?iso-8859-1?Q?Morten_Br=F8rup?= , "jackmin@nvidia.com" , "konstantin.v.ananyev@yandex.ru" CC: "dev@dpdk.org" , Ruifeng Wang , Aditya Ambadipudi , Wathsala Wathawana Vithanage , nd , nd Subject: RE: [RFC] lib/st_ring: add single thread ring Thread-Topic: [RFC] lib/st_ring: add single thread ring Thread-Index: AQHZ1AJIj5UOZIDmtU+IXup+eth44a/1vMRw Date: Tue, 22 Aug 2023 05:47:21 +0000 Message-ID: References: <20230821060420.3509667-1-honnappa.nagarahalli@arm.com> <98CBD80474FA8B44BF855DF32C47DC35D87B22@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D87B22@smartserver.smartshare.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 6E33D143562A334BA381D6550D7C16CF.0 x-checkrecipientchecked: true authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DBAPR08MB5814:EE_|PAXPR08MB7443:EE_ x-ms-office365-filtering-correlation-id: 75d5249c-0695-4c15-aa68-08dba2d3410c nodisclaimer: true x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 39/sOPRMmgi0VY8AkP5OzlIfe82JjQFU5tqsWBIAACq2kRh21DqTsUvWjrTegCQdPU4oQs3BAsHLh1Drh3FdHTciQyST/DWgnU0WL1E/ntXi0b89ZhDt3tM91gJ2hnkMPYpIGhEs9+z4OXTv9pZv2rUg08//Y9SBnz22vPHtrf9wFMB5R+R6YsHtD/qdO7G9oXlUIDZ8Khh8dVWryYa0rFgCYcK9oLREcrGHi6y/cqUUF++UahKukm+Eb19JQmGzNHQpeZBlgQPrgBe5mLVz8fCIcQO/4L/UQKdeBloMMZrjirHHkxiS7/8AWrRTtKRKc+yxz4cL1blxHh347RqzVPS1esLf+u+3F6SgyNMuZ2Vcm3vPlLh7Rgou+pOe3V/OqJNtUTZkB4ztjrIfYrKaMgFenQFewKIED4duT0NUsYWoXD0q6lus1U17w1kWaNvUx2OMsvFh50mD7DKaY7SR289InLY0eF3daopJ0Aqxg4XVf5t0lWO/dQqshSLWU+3tVBtZFLmzORTQt0rAd4yWVSzjXCVK+6yYtpn1rIyYFYFHsXRef7auWZBMhy7oEFemJy36vH/YgzYqYfoO7awvW6jmsoQvpfbSbWrTiZPBzVlOo3i2HMTYxBeMb48cOaG6IymV/znor6Df/ImEEif91A== x-forefront-antispam-report: 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:(13230031)(376002)(366004)(39860400002)(346002)(136003)(396003)(451199024)(186009)(1800799009)(86362001)(76116006)(110136005)(5660300002)(64756008)(66556008)(41300700001)(33656002)(66476007)(2906002)(66946007)(316002)(66446008)(54906003)(52536014)(8676002)(478600001)(8936002)(4326008)(9686003)(71200400001)(53546011)(38070700005)(7696005)(38100700002)(6506007)(122000001)(66899024)(83380400001)(55016003)(23180200003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?Gn+k9rJG4XPzaw4xX3ji+nxoODj1FGXKIyr085QgRKh6FqlCdnvHmK/gR0?= =?iso-8859-1?Q?CxnUoGNCIDScOxClwa5yEL9TYbWCoJuBYW3bsuW7X9KnB1dzlQE4PrrsTF?= =?iso-8859-1?Q?NEsw2kvqx9w7CSMrUhIJ8ktHzzvtv+D8I7eYiBzc4Iuk+PkPnyN4Im449p?= =?iso-8859-1?Q?R0oDzwpZsM43x6LP8xJKqZ1lSZs0Hqsz4vne7+U2+sTLjHCUHnULUoBpMv?= =?iso-8859-1?Q?kk3a0IKrdNU954he7eevCyAN03XPpnbHPAoFxSc4zEkFP2Co9MHLEm+Jl7?= =?iso-8859-1?Q?nd7JTAV4Vr+pNRodb5W5oMQi0AL+OyY+8QOdcaJG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-8859-1?Q?XIhutLIz8i0VgzSx82kT4qr/BfzM2RWnY15j1Xe2xTAgGO7XLoOuavLwWX?= =?iso-8859-1?Q?fxTsvDwlbOZrM1p3Dx5YjW28A/WzAezgQ30eLWPEZ8bVyJNFJErrnFVAsC?= =?iso-8859-1?Q?qYhh5hFdIL21N1Zhu750DYc5HwsN4XMzxRb4WMdb9r7pDzXgCytK/ATsBF?= =?iso-8859-1?Q?qp/UoGnMoBcOJlflVqbwjRhE8ai9A4w2eSkXFntlvb0hGwjsp98byT6xJ8?= =?iso-8859-1?Q?Hyqe+xeoWJwJ4a3l3rbeP5ZClpVJlCIeXjQWqPtAlv5N61t/H2WhBG2bIp?= =?iso-8859-1?Q?JzONm3JFopAMDmL1wDBpNpPNuSkeMcoCtD9T6QuthGdcLzGk5N1874cM0p?= =?iso-8859-1?Q?n9Std15db47BlBKVo9SXH1sIqSpQXTcag0SM42nOB2l+GTAp8CGGq+AiJ5?= =?iso-8859-1?Q?bS9IB4Bd0K+314cWf9BirwmsD7JLmw2QCDEK0PodQAcnumAVOvd6T0hDdj?= =?iso-8859-1?Q?zl7LKxN9kswQkfAdr50=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DBAPR08MB5814.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75d5249c-0695-4c15-aa68-08dba2d3410c X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Aug 2023 05:47:21.5774 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: BJNjhMjpCCSuxXKLBXQ4ISTxN5vdFzPWoZaelEmsCtVTaPdEwVHSV6COXgu2JavIzhw5QVKzUEUoIN8meVYm6cb4jClzrqh0vwR+JC6rw38= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7443 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 > -----Original Message----- > From: Morten Br=F8rup > Sent: Monday, August 21, 2023 2:37 AM > To: Honnappa Nagarahalli ; > jackmin@nvidia.com; konstantin.v.ananyev@yandex.ru > Cc: dev@dpdk.org; Ruifeng Wang ; Aditya > Ambadipudi ; Wathsala Wathawana Vithanage > ; nd > Subject: RE: [RFC] lib/st_ring: add single thread ring >=20 > > From: Honnappa Nagarahalli [mailto:honnappa.nagarahalli@arm.com] > > Sent: Monday, 21 August 2023 08.04 > > > > Add a single thread safe and multi-thread unsafe ring data structure. > > This library provides an simple and efficient alternative to multi- > > thread safe ring when multi-thread safety is not required. > > > > Signed-off-by: Honnappa Nagarahalli > > --- >=20 > Good idea. >=20 > However, I prefer it to be implemented in the ring lib as one more ring t= ype. > That would also give us a lot of the infrastructure (management functions= , > documentation and tests) for free. IMO, the current code for rte_ring seems complex with C11 and generic imple= mentations, APIs for pointer objects vs APIs for flexible element size etc.= I did not want to introduce one more flavor and make it more complex. The requirements are different as well. For ex: single thread ring needs AP= Is for dequeuing and enqueuing at both ends of the ring which is not applic= able to existing RTE ring. But, I see how the existing infra can be reused easily. >=20 > The ring lib already has performance-optimized APIs for single-consumer a= nd > single-producer use, rte_ring_sc_dequeue_bulk() and > rte_ring_sp_enqueue_burst(). Similar performance-optimized APIs for singl= e- > thread use could be added: rte_ring_st_dequeue_bulk() and > rte_ring_st_enqueue_burst(). Yes, the names look fine. Looking through the code. We have the sync type enum: /** prod/cons sync types */ enum rte_ring_sync_type { RTE_RING_SYNC_MT, /**< multi-thread safe (default mode) */ RTE_RING_SYNC_ST, /**< single thread only */ RTE_RING_SYNC_MT_RTS, /**< multi-thread relaxed tail sync */ RTE_RING_SYNC_MT_HTS, /**< multi-thread head/tail sync */ }; The type RTE_RING_SYNC_ST needs better explanation (not a problem). But, th= is name would have been ideal to use for single thread ring. This enum does not need to be exposed to the users. However, there are rte_= ring_get_prod/cons_sync_type etc which seem to be exposed to the user. This all means, we need to have a sync type name RTE_RING_SYNC_MT_UNSAFE (a= ny other better name?) which then affects API naming. rte_ring_mt_unsafe_de= queue_bulk? >=20 > Regardless if added to the ring lib or as a separate lib, "reverse" APIs = (for single- > thread use only) and zero-copy APIs can be added at any time later.