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 EBC1C45CF7; Wed, 13 Nov 2024 14:39:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D31404025E; Wed, 13 Nov 2024 14:39:27 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2067.outbound.protection.outlook.com [40.107.93.67]) by mails.dpdk.org (Postfix) with ESMTP id B409B4021E for ; Wed, 13 Nov 2024 14:39:25 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LSLJdR2qQuifNfwvNh9sxQdOsYPeU0uzNWpwZtTlOw/VlniyXw4m4LQGiO4Ckxe4+J8HhMR0RRcf8ytv831IM0q5aSEPQWl2K6uwjLElw2azBBpG6MYrYeGgh2tYcyhnOrkioKQQL2byVCDrvqYJ6JDQBGVtvoVGYGKJlQgB+HJDS7U55glfCDVEVnAK3qqCVPIrRGDZt+4xwr284+avNWv6hew8J3fW2zIDTiQAFg1sVCNI+liTWPXCSRWEX/Fj2OimMdMzXVFhZg+EahFVnWsIGn6XWuM95dCuE38k079B0yX7By9c1y3XSFV2eHCF7bAwyrAyFMzdeAu2N2IKPA== 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=SYgLUqzld7P7Nq+2IqI4rV2rhjGR5dsS8carBBrVEEU=; b=cdomJKm+m/ZtHysBeENtOPQ1+A4/0g7t2eIfDS3FCrTlDvKoZX8ZbHZ7uy6aZXrtrx7uFEQ+ThXXRV0pRrMbUj+MpniwAg1x3vtgBqgqzuGBnCJrQwz85z0k6j/ODfRRQ2lvf+l7lCxZj2vy7NIo7PzCiV2mte7BWsH+QWgMLqLqNK6kKPJ9Q4zeiek+1aCN9JPsRohkQvSGbfXtiyaZ9ltgomfyZy+SOG+ijV+tkuHc3krYt5XjuxDOtPFRljF5GxjmoAm63FB+OHnL+0AuGsE4eVPSLoYRFZVzZltR9sO3bwwDfAo71Gx4cAcUbAc6f0KBpkM3NKC7VIdHG7KYfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SYgLUqzld7P7Nq+2IqI4rV2rhjGR5dsS8carBBrVEEU=; b=Wxq0AMbm5p3LHDm8B1wqMQongjBa4xPpGWNVQ1C+jNuPf/xTWYNkHdH9JoOORZqX29k8UYcSu580aL0GV3Ln9vhdfJxk3tjMG7tSc1Mq9IBc+EuaVD6//3CZhdaw41Ammv1SypdKTL5zLTX1ydYZ0RR1DcC676lk98moMN3rPP6ErSnzc4mK7f9l56cFjyiZuxum2sgHEUOAwEO3DVf06EeUI2pMyIo2lTT22V58h14HLFk61xKgnjKIP2vduOI13thfYKSE29siIB+d50iNED+9mnOS/o0FUEJmIyEmSporUNjcnkCb5edzFam/m7LT9MAxKf0taokXkt1r3hBN3A== Received: from DM4PR12MB8452.namprd12.prod.outlook.com (2603:10b6:8:184::18) by PH8PR12MB7376.namprd12.prod.outlook.com (2603:10b6:510:214::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.16; Wed, 13 Nov 2024 13:39:22 +0000 Received: from DM4PR12MB8452.namprd12.prod.outlook.com ([fe80::b341:6309:cb1f:5b6a]) by DM4PR12MB8452.namprd12.prod.outlook.com ([fe80::b341:6309:cb1f:5b6a%4]) with mapi id 15.20.8137.027; Wed, 13 Nov 2024 13:39:22 +0000 From: Raslan Darawsheh To: Shani Peretz , "dev@dpdk.org" CC: Maayan Kashani , Suanming Mou , Bing Zhao , Dariusz Sosnowski , Slava Ovsiienko , Ori Kam , Matan Azrad Subject: Re: [PATCH] common/mlx5: fix misalignment issue detected by ASan Thread-Topic: [PATCH] common/mlx5: fix misalignment issue detected by ASan Thread-Index: AQHbNNvwPAPPsKxK4EeLbv45MvgYtrK1OQI7 Date: Wed, 13 Nov 2024 13:39:22 +0000 Message-ID: References: <20241112082126.40349-1-shperetz@nvidia.com> In-Reply-To: <20241112082126.40349-1-shperetz@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR12MB8452:EE_|PH8PR12MB7376:EE_ x-ms-office365-filtering-correlation-id: 949c53d3-44e5-4f34-b6f4-08dd03e894f5 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: =?iso-8859-1?Q?eUHpqIm09fdqHpmo+cyoeTm9ubRoKJF7+ZM9D2teQdWn3+BlWVdAHgEmD5?= =?iso-8859-1?Q?Q9TxluOm7rm05R+Ko+1k5i7d1sujd3UVuSotGEijL953E3kF8DrAzdHH1Y?= =?iso-8859-1?Q?Sk2u6ZDd2WWZAdQJ8kTHQX25O0/qOc2JvctfAvo5bR9m9NqxbXWtRA9Tt6?= =?iso-8859-1?Q?q1AdAtiUw2/FARfbnReg1HRIyYwi25gcqnrhgpbupHVJ3kr9b2gJRloBS7?= =?iso-8859-1?Q?Et7iD6ZfCbqRaY00CnL3d7Cnid2Bric6jnXHNhJVZNTAN5lT9ROhGs6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kyJaLInmN8Te9uBBJO2Unr/6Ya6zPpwSYS4X?= =?iso-8859-1?Q?Xfm2KLngI2WvybHu+ISE1p56IWg0mmX0pxAHzW2juqPGdplmeZhbikI3Eu?= =?iso-8859-1?Q?uM6Rj/WXCiifhjfj/qkFhqnaNbfJXAaxLAFx90TGzK3iBu3dY79bdkdAxo?= =?iso-8859-1?Q?AUpQWPmhS1shkb2L4NxLhmc64dhu1Ryc9Zx1Drt9l9diqkSMP8MbPmtKrL?= =?iso-8859-1?Q?I3X4afk8VfG1fO0zNxBE0Hgd2zThWFFAYHRKIOFqST2R3sM5AwOp0=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB8452.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?D5XDpc3yx9LQmtCWHKm8NmK64cKD/mPufxxSoALnMwqMCy2Lddf9P/FG4H?= =?iso-8859-1?Q?NG/hxwY7qfuQWHB7D14T9ETIgHtv6nJMwYe+MepWYoIHCw/sIw3swQCpqq?= =?iso-8859-1?Q?4P80vJx7rztHkY4DTCUYpPztTnPj63Q13efhz7E7HjvXb0f55oTsC/RaCM?= =?iso-8859-1?Q?J7jhwPri8ZO6LnjjQZgsaoAL659ousidXgvxPihr+tkQLtVCFUyOEjMSVD?= =?iso-8859-1?Q?jjBurg5oa3jjWqzgfAs9r+GDLNRDFkB7I9wnVHECz8lf+VbE3RkCnSZLNO?= =?iso-8859-1?Q?tKgHKoM4QJzfeZOhXL5GxwJKQ7W4dZZJtuKI9/sXnLYMDc4AJwMFsQ/pip?= =?iso-8859-1?Q?7lWoiEOA4Y8yXLeE7h6ubQb0GbyF2ElkAZvSBu4G7iabjh4kOhbva4Fpwj?= =?iso-8859-1?Q?waBFk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vpYMViauxplX?= =?iso-8859-1?Q?0ky2Vmq3AIfqQSOwNCC6VDD7QtmYO0qbIZQtftK5Tifxo8Ya03P4SmcT7n?= =?iso-8859-1?Q?39r/I5ZpD9uETiFOMoadyhTt4fQkHv9ADCFEKuctWKSfIfvQi1sFrdzrr9?= =?iso-8859-1?Q?GSxYc2foaMmyMoiuKytwvd10EkToKWA3sRE+zQ6DxGvOXLEA++pFl8T488?= =?iso-8859-1?Q?FNqsyI1UDF48u8dV92Ud71RSDlbo0TXPdZsXa3VLy82qMt1besqsAJAKZ6?= =?iso-8859-1?Q?bhokiy8vAvN0HC79LcPAQcm30vl5dDV9zLOGbb7aeZ2zlDqhfILxduP10Q?= =?iso-8859-1?Q?KqgdL+pHpqbTO1c8nwJRZjFW3g5puOiWNp?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB8452.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 949c53d3-44e5-4f34-b6f4-08dd03e894f5 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Nov 2024 13:39:22.2497 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: MkwMO0oAtu/VTo904sqxOUcLDE5D6087e7gtWJESGh5kC6Lz9eASxTAcZZ/iyMF6M6qWodAzncZtNSgcuwChZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7376 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 Hi,=0A= =0A= From: Shani Peretz =0A= Sent: Tuesday, November 12, 2024 10:21 AM=0A= To: dev@dpdk.org=0A= Cc: Shani Peretz; Maayan Kashani; Raslan Darawsheh; Suanming Mou; Bing Zhao= ; Dariusz Sosnowski; Slava Ovsiienko; Ori Kam; Matan Azrad=0A= Subject: [PATCH] common/mlx5: fix misalignment issue detected by ASan=0A= =0A= ASan reported a runtime error due to misalignment=0A= involving three structures.=0A= =0A= The first issue arises when accessing=0A= l_inconst->cache[MLX5_LIST_GLOBAL]->h.=0A= If struct mlx5_list_cache is not properly aligned, the pointer gc,=0A= assigned to l_inconst->cache[MLX5_LIST_GLOBAL], could be misaligned.=0A= To address this, the __rte_aligned(16) attribute was added to=0A= struct mlx5_list_inconst in struct mlx5_list, which includes struct=0A= mlx5_list_cache, ensuring that the entire mlx5_list structure,=0A= including mlx5_list_cache, is aligned to 64 bytes.=0A= =0A= To resolve misalignment issues with struct mlx5_flow_handle,=0A= The initialization of resources for the ipool ensures that=0A= the ipool size is rounded up to the 8-byte boundary=0A= =0A= The error in assigning values to actions[i] was due to potential=0A= padding or misalignment in struct mlx5_modification_cmd.=0A= To prevent such issues, the __rte_packed attribute was added to=0A= struct mlx5_modification_cmd, ensuring that the structure is packed=0A= without extra padding which helps avoid misaligned memory accesses.=0A= =0A= Two performance degradation tests were conducted.=0A= Following are the results comparing this commit to the most recent=0A= commit in mlnx_dpdk_22.11 at that time (b69408ae453).=0A= =0A= Before asan misalignment fix (average kflows/sec) -=0A= Insertion - 4461.269, Deletion - 7799.9992=0A= After:=0A= Insertion - 4579.0642 , Deletion - 7913.0034=0A= =0A= Fixes: 9a4c36880704 ("common/mlx5: optimize cache list object memory")=0A= Cc: suanmingm@nvidia.com=0A= =0A= Signed-off-by: Shani Peretz =0A= Acked-by: Bing Zhao =0A= =0A= Patch applied to next-net-mlx,=0A= =0A= Kindest regards,=0A= Raslan Darawsheh=0A= =0A=