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 7B24945610; Fri, 12 Jul 2024 13:40:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65DD3406A2; Fri, 12 Jul 2024 13:40:00 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 006D8402E5 for ; Fri, 12 Jul 2024 13:39:58 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46C8iZuo009507; Fri, 12 Jul 2024 04:39:52 -0700 Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2045.outbound.protection.outlook.com [104.47.70.45]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 40aukj9f1x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 04:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lwQh1VSnmoE8JFSytBT+v4x55O2n/JitVcH5CCabkonwban/PDiW4E7ZjaNx0P1fRjlLwrB4Q5mbnAOyJ8IsV9VLpLej19ySpL66YrebiKu1gfch8Esf3uXep1K00h/rJ1x7Id+WUFUFO9vgKot7cSTVa5qeDfOgMY83gVCu9pCIF9H+rpmzHzlfD+RBDeT0omZcjUL1hPMOF3DaeRmEhiE2JobsAvLN17dRVmtRq6l3oaF0rB0BFrMhMpWeBcDixvkOK5qhoSYZ+7b1t+VRp6yi5Ga3z/umOQAVfL8dl1FE8voWd39+Rmt7yRYPN8pjRKJvJb1n1Bnn7bbd3dn8lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=WNlnNk/9GI52aH2wEWhc36Vc80hG3BagiCaMKkESGQk=; b=Oe7NqE/hDA5M91z0wL2PbTPY39ytdkWNf3KzrQ1v5yeGLrLgyAPOENxV8CyYx03Y8SnhNb/S81Zf97V534/09R0nFBJ3459mpwAe3jG7lxVRlmzROVxCoBKYwLaHtY0qmI41qDeLSgA4Biv+aiRylXWwstq81DRnwKkkLb0bevKW0E53dCFiXuYhR7hlyCHMSdwIWOajhW78aj6clhw8h77Jv41rAAOPWW1RvbEoDn9u4azt7zr7oyiWAe13gsYbX+LZ8jiVucMlj9tJ7QB8X1gkFy/9lKYJc/ZHjo4Dpw4sOGVfVuw3+TKdDnn/gLcnVAetPevuMazezvEDvKFmng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WNlnNk/9GI52aH2wEWhc36Vc80hG3BagiCaMKkESGQk=; b=nNYWDyE/bsKF1XL1rDS12tipscI1fKBpUHOV7sAA+a1CIJj/PbWmKgspwdVdu7ku/BZ6Ktmjko38cp8+jk887r+yLC60+LBKxRQcsEwA7cdkSBUDBhc7STK3H9qnCAPtC+Zt8F7AHmuzfga+GzmyMtiDoyf0R09pJSyMEpbQUDE= Received: from PH0PR18MB5071.namprd18.prod.outlook.com (2603:10b6:510:16b::15) by PH0PR18MB4639.namprd18.prod.outlook.com (2603:10b6:510:c6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Fri, 12 Jul 2024 11:39:49 +0000 Received: from PH0PR18MB5071.namprd18.prod.outlook.com ([fe80::25e:7:91b:8f1c]) by PH0PR18MB5071.namprd18.prod.outlook.com ([fe80::25e:7:91b:8f1c%5]) with mapi id 15.20.7762.016; Fri, 12 Jul 2024 11:39:49 +0000 From: Kiran Kumar Kokkilagadda To: Robin Jarry , "dev@dpdk.org" , Jerin Jacob , Nithin Kumar Dabilpuram , Zhirun Yan Subject: RE: [EXTERNAL] [PATCH v6] graph: expose node context as pointers Thread-Topic: [EXTERNAL] [PATCH v6] graph: expose node context as pointers Thread-Index: AQHazusgSbS3xG4oE0uymJzN2rvDlLHzAhfA Date: Fri, 12 Jul 2024 11:39:49 +0000 Message-ID: References: <20240705145254.558221-3-rjarry@redhat.com> In-Reply-To: <20240705145254.558221-3-rjarry@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR18MB5071:EE_|PH0PR18MB4639:EE_ x-ms-office365-filtering-correlation-id: d10c457d-1a2e-40ce-758a-08dca267566f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?oFN1MGtrQSXsE7dQ25PfAT9MtiZ0L56+BdAF8ULsynCchHui9xuN02GH6S3O?= =?us-ascii?Q?js67ClboNJlavQt7J5b5eJszCfD6bDqKv3b50RghaszLlP04uA1Q5c0iHsh3?= =?us-ascii?Q?xn9FMsVEKW0MpFOu14T6DXpxWDvPTGYGGW+oGXAHfWj5UH/S7gsnAClyYb+Q?= =?us-ascii?Q?mYqEFSZa31j/14EsCbT1zOd7BCETCXWYa07C2FcllrIb3d2mSL45QiLIgohi?= =?us-ascii?Q?M8RFK0CRwIbRZcnNH0FGY2pGWroj7maD0XSTAN3rt8R4TdHZoFr0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tYo5BVfaQrFk2Z07dBTxuY+A6F9gk5Y1MM5jZ6ueo+HMOB?= =?us-ascii?Q?UH69zptJyDyB6b35DYfVSOOiAdFV9TkK0IMvOx+5NthDT+rzzylkgOi3weag?= =?us-ascii?Q?1250NfAFsjFHuBryf3paV3FxMmGPyG/oPFKqjciaioypDj117ROmp+5301r9?= =?us-ascii?Q?VmkKeRuoYCFOzsUZ8JnhGoq6Cqe83QVYnS2bpwezM/Cy7FHkSSq5wL3/RUdf?= =?us-ascii?Q?BLdsA9c=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR18MB5071.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016)(38070700018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Tq1ZK0t6+U8Gz4/GReUKoFxHvYFvuP9Te73+zYT4y51u4r7MkG/8GVdYAz1O?= =?us-ascii?Q?4zQdu/WYmKxhNjOFHucBBVi7fz40771V2vGyQo9B6U7YNcDYgiOZ99i30PKP?= =?us-ascii?Q?pijcAG+upv1JnxSqmNiGuJ3JhcyZavdk31OIkludTiZ04MpLOhevAB7u3qJV?= =?us-ascii?Q?f534NsXYfDyI87NuzZhuLBYQ9mep6UhDUhIL1oTU1OgmbFUaPEPpA5qHTHg9?= =?us-ascii?Q?J3wLL+leRy/sI3rykrXOw5o2qMZ8wDorQ3vqweKDnmA6BX1WfvCxm0Gl1jeu?= =?us-ascii?Q?i0KhKLnL+sSI7wpkXjVwp/hRnHILjNqizkNjZGB65Dmnh1Q+mQqw/urYtK3E?= =?us-ascii?Q?0NGzC+K4JxIL+unw0qUeTUh9tmj2P3oKHESDNaGVvBUOuUB6iSS+tgap57QI?= =?us-ascii?Q?5+jHDacX1UQYt1mlv9e75P/cBvpIG7D/dCDn/9dOLm/8meNBMN0jef6TY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iNhWm7VRMzuNMYrlXQehy3ohzpMHPtA?= =?us-ascii?Q?wIFy3okHYYZTXWWzhFOIZ2amv0Vyxxv6fJA3VuRUVRqVpLZhPWNmNABSY01B?= =?us-ascii?Q?W+qEh89VgDzcfWe0W52c9bbxCWbQOiNJ1hjhbJ2R1UyHJbWhQZtITs5YfuwB?= =?us-ascii?Q?G3uAbe7ESD98a7ZMFtRBcipVE25R9RtgtirYuOCHAw+Lp+mTlTlLMxEgCiQn?= =?us-ascii?Q?XapyNm9y+zrKd2FCVvzihpr4TBWYHOJNslyIExmw?= MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR18MB5071.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d10c457d-1a2e-40ce-758a-08dca267566f X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jul 2024 11:39:49.4692 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WWDFGKUfRGLJVv1Lqlw23oQGrZUEg9im6srudWGsx1KOMIBm4zU8s3fE0FFgBeROx8xuFyY9zbNxhisTQkiZqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR18MB4639 X-Proofpoint-GUID: t_rL2d60Q3TWWKKDePRLw7L9inb6-_EG X-Proofpoint-ORIG-GUID: t_rL2d60Q3TWWKKDePRLw7L9inb6-_EG Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-12_08,2024-07-11_01,2024-05-17_01 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: Robin Jarry > Sent: Friday, July 5, 2024 8:23 PM > To: dev@dpdk.org; Jerin Jacob ; Kiran Kumar > Kokkilagadda ; Nithin Kumar Dabilpuram > ; Zhirun Yan > Subject: [EXTERNAL] [PATCH v6] graph: expose node context as pointers >=20 > In some cases, the node context data is used to store two pointers because > the data is larger than the reserved 16 bytes. Having to define intermedi= ate > structures just to be able to cast is tedious. And without intermediate > structures, casting=20 > In some cases, the node context data is used to store two pointers because > the data is larger than the reserved 16 bytes. Having to define intermedi= ate > structures just to be able to cast is tedious. And without intermediate > structures, casting to opaque pointers is hard without violating strict a= liasing > rules. >=20 > Add an unnamed union to allow storing opaque pointers in the node > context. Unfortunately, aligning an unnamed union that contains an array > produces inconsistent results between C and C++. To preserve ABI/API > compatibility in both C and C++, move all fast-path area fields into an > unnamed struct which is itself cache aligned. Use __rte_cache_aligned to > preserve existing alignment on architectures where cache lines are 128 by= tes. >=20 > Add a static assert to ensure that the fast path area does not grow beyon= d a > 64 bytes cache line. >=20 > Signed-off-by: Robin Jarry > --- Acked-by: Kiran Kumar Kokkilagadda >=20 > Notes: > v6: >=20 > * Fix ABI breakage on arm64 (and all platforms that have > RTE_CACHE_LINE_SIZE=3D128). > * This patch will cause CI failures without libabigail 2.5. See this = commit > https://urldefense.proofpoint.com/v2/url?u=3Dhttps- > 3A__sourceware.org_git_-3Fp-3Dlibabigail.git-3Ba-3Dcommitdiff-3Bh- > 3Df821c2be3fff2047ef8fc436f6f02301812d166f&d=3DDwIDAg&c=3DnKjWec2b6R0m > OyPaz7xtfQ&r=3DowEKckYY4FTmil1Z6oBURwkTThyuRbLAY9LdfiaT6HA&m=3Dp2InA > hlxVf3SXbWbwMoGbsA2ylexBEm_WKDY6mf88Lgp6hbAD5UNuKGkFiO0F8vV& > s=3DmtRUGLkylM_33OiTJTBoxFQNDQh6p7xIyNwmDu9GgTk&e=3D > for more details. >=20 > v5: >=20 > * Helper functions to hide casting proved to be harder than expected. > Naive casting may even be impossible without breaking strict aliasi= ng > rules. The only other option would be to use explicit memcpy calls. > * Unnamed union tentative again. As suggested by Tyler (thank you!), > using an intermediate unnamed struct to carry the alignment produces > consistent ABI in C and C++. > * Also, Tyler (thank you!) suggested that the fast path area alignment > size may be incorrect for architectures where the cache line is not= 64 > bytes. There will be a 64 bytes hole in the structure at the end of > the unnamed struct before the zero length next nodes array. Use > __rte_cache_min_aligned to preserve existing alignment. >=20 > v4: >=20 > * Replaced the unnamed union with helper inline functions. >=20 > v3: >=20 > * Added __extension__ to the unnamed struct inside the union. > * Fixed C++ header checks. > * Replaced alignas() with an explicit static_assert. >=20 > lib/graph/rte_graph_worker_common.h | 29 +++++++++++++++++++++-------- > 1 file changed, 21 insertions(+), 8 deletions(-) >=20 > diff --git a/lib/graph/rte_graph_worker_common.h > b/lib/graph/rte_graph_worker_common.h > index 36d864e2c14e..8d8956fdddda 100644 > --- a/lib/graph/rte_graph_worker_common.h > +++ b/lib/graph/rte_graph_worker_common.h > @@ -12,7 +12,9 @@ > * process, enqueue and move streams of objects to the next nodes. > */ >=20 > +#include > #include > +#include >=20 > #include > #include > @@ -111,14 +113,21 @@ struct __rte_cache_aligned rte_node { > } dispatch; > }; > /* Fast path area */ > + __extension__ struct __rte_cache_aligned { > #define RTE_NODE_CTX_SZ 16 > - alignas(RTE_CACHE_LINE_SIZE) uint8_t ctx[RTE_NODE_CTX_SZ]; /**< > Node Context. */ > - uint16_t size; /**< Total number of objects available. */ > - uint16_t idx; /**< Number of objects used. */ > - rte_graph_off_t off; /**< Offset of node in the graph reel. */ > - uint64_t total_cycles; /**< Cycles spent in this node. */ > - uint64_t total_calls; /**< Calls done to this node. */ > - uint64_t total_objs; /**< Objects processed by this node. */ > + union { > + uint8_t ctx[RTE_NODE_CTX_SZ]; > + __extension__ struct { > + void *ctx_ptr; > + void *ctx_ptr2; > + }; > + }; /**< Node Context. */ > + uint16_t size; /**< Total number of objects > available. */ > + uint16_t idx; /**< Number of objects used. */ > + rte_graph_off_t off; /**< Offset of node in the graph reel. > */ > + uint64_t total_cycles; /**< Cycles spent in this node. */ > + uint64_t total_calls; /**< Calls done to this node. */ > + uint64_t total_objs; /**< Objects processed by this node. > */ > union { > void **objs; /**< Array of object pointers. */ > uint64_t objs_u64; > @@ -127,9 +136,13 @@ struct __rte_cache_aligned rte_node { > rte_node_process_t process; /**< Process function. > */ > uint64_t process_u64; > }; > - alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node *nodes[]; /**< > Next nodes. */ > + alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node > *nodes[]; /**< Next nodes. */ > + }; > }; >=20 > +static_assert(offsetof(struct rte_node, nodes) - offsetof(struct rte_nod= e, ctx) > + =3D=3D RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in > 64 > +bytes"); > + > /** > * @internal > * > -- > 2.45.2