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 EBB3EA0545 for ; Mon, 20 Jun 2022 07:37:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB541427EB; Mon, 20 Jun 2022 07:37:57 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2075.outbound.protection.outlook.com [40.107.95.75]) by mails.dpdk.org (Postfix) with ESMTP id AD94E40150; Mon, 20 Jun 2022 07:37:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Aro+QYfHhQaIxNevnt08nyJlinTNxw7Zg40Y4+8X+61dUs2RKosfAUoEhUAN4iQlrEtqlEW1XpG/mViQfthtgJZlrmxpFLvzzPl4Ax5McRqzXrkvte3Qs658KNhJ3tOzAtQSiAJHTLYlZhMr3AEZLFE8xXfs1ubG7lo10soPpMhjXPiL1LvjSdbOu532py79oZMfOebDeA0KkZn3WqvQIiAxL5fZYL12zrq09KH0XS98fn4FE/ZoAQvRDY/R5gtmkdSM7a/BxVoQ/rHvHkO9Qy18JyBRss/AenrYqg/nwx/eVdlD7jdLrJ38TTvwL0jmuCuXbewFeGqLdpDGyswHFw== 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=lcNNt0M5R9tc4cJ4A55PwO/AAWdUJHumcbsRGZEjdZM=; b=XU+srsF11P+K3tJ3W1QTbIpa/u/IuxUW3e6TPnocl3y9DnJcTSl5FijkzChc5PQQFyOgzBE1zjrFyItB+N8/SXHF3115RM4BejiKK0t+nqr7REt54f/GW2FKjsO2dMjxJrfRExS1HS1n7Yacg6lfshF8GV8veG2elTCM1kYKy0Qfz/ti4wUJzs8TbBHxmtriROnF/BGADoNFtxPzCcgfYFyWVRnzjAX2nyxPeMwxUb/huFEXK1Xvd0f/43o/xzdFc/YofxGwaOIun7+J5RExNuYV423Er1akB7I0rLrCXoE/ADke1BypNf1L8nYMjTkEGcOWVvDx7R8C16PIeQ+JkA== 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=lcNNt0M5R9tc4cJ4A55PwO/AAWdUJHumcbsRGZEjdZM=; b=iwcWD63QGTblRIza95+G6EAY+UGgJJzcfyalLrmj+xqMd+kDpN1Mp1WJk9n4JrEA5+VOkPDSKjkB1KZFsDJl7yI7SPr0V5F+yC2YKoYyUl7dvR3U8k/MnWJ1vstu/idrMuXtBWuWjXvKUHEIRXNjhc3L534EGLeIjR40uQtoGnFa8Xi91F7OWQZaAgM3cwqDQOyuZQ1omVMRljdzoU1rNCA4GpGjudD8YMpeU49EkO9srNSA+EtZ+w6yWb7+JCWY6ST/UJdPTDsejXzbPq7wEoN1/cYP8UcRFSaGxe/HCSBgjLwx67dMPGpT65SHrX0y+nBdmcjpIaSP9P/qfuk6zg== Received: from DM6PR12MB3753.namprd12.prod.outlook.com (2603:10b6:5:1c7::18) by CH2PR12MB3847.namprd12.prod.outlook.com (2603:10b6:610:2f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.18; Mon, 20 Jun 2022 05:37:54 +0000 Received: from DM6PR12MB3753.namprd12.prod.outlook.com ([fe80::8cc6:67d3:8b2e:ff64]) by DM6PR12MB3753.namprd12.prod.outlook.com ([fe80::8cc6:67d3:8b2e:ff64%6]) with mapi id 15.20.5353.020; Mon, 20 Jun 2022 05:37:54 +0000 From: Slava Ovsiienko To: Ali Alnubani , Ruifeng Wang , Matan Azrad CC: "dev@dpdk.org" , "honnappa.nagarahalli@arm.com" , "stable@dpdk.org" , "nd@arm.com" Subject: RE: [PATCH] net/mlx5: fix risk in Rx descriptor read in NEON vector path Thread-Topic: [PATCH] net/mlx5: fix risk in Rx descriptor read in NEON vector path Thread-Index: AQHYARdfa+I7kzN/pEut6P8zdK0cha0nHvMAgDGo9lA= Date: Mon, 20 Jun 2022 05:37:54 +0000 Message-ID: References: <20220104030056.268974-1-ruifeng.wang@arm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0fd856c3-f345-4d27-c50f-08da527f0610 x-ms-traffictypediagnostic: CH2PR12MB3847:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3xmSJh+1N5RF4yR/WKoLZ7CYsWaDXtZLk+bhy1JdbVzCdqVxqsR/35i7F5LMDOJ3oCyHPGPbCm1mcGZPNVTko6+Tqh3fhyiivjZR1Jj0ecUNkq5tODrjKda6r+3NCiI34vE1RvKCsJrEz6JC5r2Ck+2tmHodilbDA3HeDe1oBRT/8c9INmIpCzQin3NQTIelqofniG8a1zIdVJvFfSxCQcYbi0umKswCLtTTNRXufUULwz99CKMBAn4nyJzA9NFCf9paP7DPTj9E6NqS3tK92bv3fLeF5xi52MC9meMsCANeBat4EumvX9HHqs1u2hrDFRTus2Bry3sYJFUlpYgpDSk6lEZIYUbFVpUBfzFPpdW4ZMKdVPIpM7IafOH06qSryGy1TJICr1DoguIRILy/iZITHw9Klj4F8deHBwjwLnmoaEzV4Y3GBWyoUI+VN5SzmhTYvapzNz59s3NFEfw+jzrn1n4C2jJA6OtFKb+HTuYGxMEh1yzFnVwNnw87m3f8R8G53LRTlfLEZapOla7v+n5m7evQCQWqK/RBXLtUtBeTu04UKGE9ASo/2Z/DA5SydYGemslHhVYYoLh9S8/7C1AH3Ywv1y/gleaGPTN6rp/Q9IsX75CpESGE5tmE5A5gDmADu3xk+66bo+Y4UZabkUB3e4+XGJgksjKznOwX/VicAwHNEcPhjmEAhPixo6uO58jKy6r+zPTx9hNdONP67w== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3753.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(346002)(376002)(39860400002)(366004)(136003)(396003)(122000001)(54906003)(52536014)(5660300002)(66446008)(38100700002)(2906002)(38070700005)(66556008)(53546011)(6506007)(7696005)(110136005)(316002)(55016003)(9686003)(6636002)(41300700001)(71200400001)(186003)(478600001)(8936002)(83380400001)(26005)(76116006)(4326008)(66946007)(66476007)(64756008)(33656002)(8676002)(86362001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?LHPj/HSHmvR1+xr/hvyJuuUVyEx2UA0yJp3oyfKb1jzL3V4wy/W3k/u5nGpH?= =?us-ascii?Q?pI6zPhpLSGDv2T3jGb+24mb16dNC23LNtolXP9T7SzBxEo7jFOUowiH0/vzk?= =?us-ascii?Q?kKd+Qjhujt7edeBJSLuk7Jn+QlFT7ryx/EdwSy0pF7JpsvP/OQaJBBXKUl5w?= =?us-ascii?Q?UAKN5/pX7XYm+GoUmo/+upQMaz9IgGJSk2A39dd2hbjYlNEyUXsfLuP1H/TG?= =?us-ascii?Q?8CqKs79ha6lwX64LQbOLL8uiuuiyoFmUeGYe64qsfEakapS+mDONANUi3GRK?= =?us-ascii?Q?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4bD1SGzGId3RARUOlnR9tGi6a2Juu?= =?us-ascii?Q?414Fsxc0xYvfDSgn/LJeonlRUrz51h7qQGTtQcs/YJ8kNsga2QUdmKe0p+Tp?= =?us-ascii?Q?1wDIeWxZCD+pDcBY7sOACSFs92gDr20vFnWWs/2UTE73y3vDEzqhTvcAEMpX?= =?us-ascii?Q?K9qqQA45Trgy142rOvnbK7bq+xdRSiYdl4FvbtVFSNueXgXxZQhng7xvZ4fD?= =?us-ascii?Q?t5Ga+RpmOh7rSIyBj/ETkPH04udVoyBLMOplMw0uaJ2NGs8PGPGQB5RHp7iS?= =?us-ascii?Q?usv9c0Zrj5nknH4vDie52dg6H56osihGUYQk5Bo9uu6bGQEjcse2FMTx6i3Z?= =?us-ascii?Q?caYuxVsPmbXj3o/oVQFb2OVizEDcQju1IvLrY8AYjOqMMRVRglEmFQ2FtqY+?= =?us-ascii?Q?xO8TtgzCp7dyBhc49K1u886mpK1qb2LUNYO3Ttnmn4KqgMubVlD7of3DWfdo?= =?us-ascii?Q?QFMG2q74dERQB+g6BtuzeY4U/KWhcj8EeXyJuU2YA4uOWGoqDwJmDVBemeqM?= =?us-ascii?Q?aDG8elDR3PTV/TlLcekq6LiVO+ZvEK5T3kzUImgNUI1VjkJKsV+zQjYuNukb?= =?us-ascii?Q?Ip+9fa0/vQ=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3753.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0fd856c3-f345-4d27-c50f-08da527f0610 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jun 2022 05:37:54.1964 (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: 7274kHam8b3DQWK/JQCPluGSvsz8Y/hyS57V/47xCKXJaGpq9qxxVf3FjlD1V21Cc7ukzzUbBkdSWclsRKuufg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3847 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, Ruifeng My apologies for review delay. As far I understand the hypothetical problem scenario is: - CPU core reorders reading of qwords of 16B vector - core reads the second 8B of CQE (old CQE values) - CQE update=20 - core reads the first 8B of CQE (new CQE values) How the re-reading of CQEs can resolve the issue? This wrong scenario might happen on the second read=20 and we would run into the same issue. In my opinion, the right solution to cover potential reordering should be: - read CQE - check CQE status (first 8B) - read memory barrier - read the rest of CQE With best regards, Slava > -----Original Message----- > From: Ali Alnubani > Sent: Thursday, May 19, 2022 17:56 > To: Ruifeng Wang ; Matan Azrad > ; Slava Ovsiienko > Cc: dev@dpdk.org; honnappa.nagarahalli@arm.com; stable@dpdk.org; > nd@arm.com > Subject: RE: [PATCH] net/mlx5: fix risk in Rx descriptor read in NEON vec= tor > path >=20 > > -----Original Message----- > > From: Ruifeng Wang > > Sent: Tuesday, January 4, 2022 5:01 AM > > To: Matan Azrad ; Slava Ovsiienko > > > > Cc: dev@dpdk.org; honnappa.nagarahalli@arm.com; stable@dpdk.org; > > nd@arm.com; Ruifeng Wang > > Subject: [PATCH] net/mlx5: fix risk in Rx descriptor read in NEON > > vector path > > > > In NEON vector PMD, vector load loads two contiguous 8B of descriptor > > data into vector register. Given vector load ensures no 16B atomicity, > > read of the word that includes op_own field could be reordered after > > read of other words. In this case, some words could contain invalid > > data. > > > > Reloaded qword0 after read barrier to update vector register. This > > ensures that the fetched data is correct. > > > > Testpmd single core test on N1SDP/ThunderX2 showed no performance > > drop. > > > > Fixes: 1742c2d9fab0 ("net/mlx5: fix synchronization on polling Rx > > completions") > > Cc: stable@dpdk.org > > > > Signed-off-by: Ruifeng Wang > > --- >=20 > Tested with BlueField-2 and didn't see a performance impact. >=20 > Tested-by: Ali Alnubani >=20 > Thanks, > Ali