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 C8EA2A0554 for ; Mon, 27 Jun 2022 13:08:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4E7541148; Mon, 27 Jun 2022 13:08:38 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70071.outbound.protection.outlook.com [40.107.7.71]) by mails.dpdk.org (Postfix) with ESMTP id C92A9400D5; Mon, 27 Jun 2022 13:08:35 +0200 (CEST) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=iDEWp+dqoEmoLgX+5j/YKDDTc0VdjejSuyvdpaKwdv/snp0ElZrZwrqb3elEWayXCt86zUDc/Bu6h7Y2Ub/SnlxSaWc9/DywcSCPSaGlfdw2CrCu4rESzrESpTK1M6GnaZLmSKZBSCsh9AdR5HBKfjk2xZQ1iJN0mRx4tEZLc7/K8bFP7fVnEeC0jnH4h3vutQ4irt0aDjUlPQcRfChItAzcCxBFeDUglmOihLl/ZT3EvrYUjEXEw+UkbYrktR28B5mxhLw/EQHT/pfd7945WeJH1T1CfNoBcnveCT3wW+qtPM/fhQb1qKFXrdHh9twAfgL4FW469avd7p+Px9+tTA== ARC-Message-Signature: i=2; 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=jUVoYdHb6ta9VeiQC3+cvDoAD5X3dNxhewI2Qf1AI5M=; b=X+0ZjZPQ2V3h54A+qZbU8w0JFOvgwWo0ftqtnE7YcQfvYSjQuPjcsmt9AxqpdDx+nnu3nK6rwt1GquLmHJVAyPbvuSJ2Cftd6yMfI3NXxVCJCxifMH4Wsg/oPWWqqlPcYhm/qzAVDOrNxyZGQhwZflS1IlWR585EVKlxxKoTxk8MD4L65pb3C6PfvpgIUd+m6QsRJP8C+LNdM5QJeWoE2bnzGfD/2Mj0YU2CGzwr6GJSvDVD7Cq7LGuF5ioCVh6qHJnxbfpjsXEfSQq7d1lflqYC8LE5WJvTZ1sJ2n1yUrVjPyk3jQxB//PIsA5cJRJnd3tTHx7YNhUytlmzzPqfIw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=dpdk.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) 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=jUVoYdHb6ta9VeiQC3+cvDoAD5X3dNxhewI2Qf1AI5M=; b=ZKf6P0LBenZLI58dEflRO3JZ76AEq4oRq3yHe/SW/7hu9Cc2G12EL2LLsAMjPLN7FwEUzwuFJUpSZ7DdDh5kRcz3HZco5aWvUjESt+dViC3vfL1Lx4599tlgSudFuZY3UK678wwzajtAKX4/DccFKupWXajjiBXEc61qIvQdB+c= Received: from DB6PR0802CA0048.eurprd08.prod.outlook.com (2603:10a6:4:a3::34) by DBBPR08MB4758.eurprd08.prod.outlook.com (2603:10a6:10:da::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.16; Mon, 27 Jun 2022 11:08:33 +0000 Received: from DBAEUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:a3:cafe::29) by DB6PR0802CA0048.outlook.office365.com (2603:10a6:4:a3::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15 via Frontend Transport; Mon, 27 Jun 2022 11:08:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT033.mail.protection.outlook.com (100.127.142.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15 via Frontend Transport; Mon, 27 Jun 2022 11:08:33 +0000 Received: ("Tessian outbound 5b5a41c043d3:v120"); Mon, 27 Jun 2022 11:08:33 +0000 X-CR-MTA-TID: 64aa7808 Received: from 6459525c9726.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C606D4FE-0C10-40E1-B757-4583CEFEF4A2.1; Mon, 27 Jun 2022 11:08:23 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6459525c9726.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 27 Jun 2022 11:08:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mS7vlbWHYF9wewx8uk/RtoR8Oqa8Mk3zglSmzjrXrd3WX8yPLsl8Zvd4I0YV9fpQoHCMuRwh/FOxLWU5h4A8HUFvJPcHww1Yj2Q5rMY98+7ssHJaJOQLd/oZRf2RX0OGwPySQt5U0Avf6MuEbIS8UWZ1MgtZynoaM8DaJTqp5AoqL2Lesj1k8g0J6/YuOyuQNDVJw6bFN8W3+T3/5C6kyUGxk1xLa1Npz19KQ6v2lskqpuSqrhLH4wGVBdNJ2zX+oSOCP2nelZX6IWZuz6mHJSXAqjECJo//zMyaI9brYZImO3cuVWAHzZV5TIa3Gp+8kHRM/VO66b6fdcXDx43FEA== 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=jUVoYdHb6ta9VeiQC3+cvDoAD5X3dNxhewI2Qf1AI5M=; b=QmkmL1tIsZ/PNMbIRo/R906txx5k77P7w8uiikA4ZW+DkBxRmtG2gJDqkJf4PgpW+wTaVno3KhEgRYbwOHf2JENNnhxkSTHKe+4tWMj16VOdvaV8PPjCKwWSauxXCYKNKeNB+49VToy0wPCcWHAvmOZ679dTBS88I8GXQrXBmBTLIjapBo6gfqGrtzMPG14L897tUGo3hAo2pVkazdBsmD6JWKREljoe1fuUwgsl3MLOA/kHO6JEWX+rgRJbQ3k9lVbekRTWpKBksoOSrGqT2zdyIEE3iGR+tkBImEactpt1pDRsG8HxPXp9sQ0H88XOkgOFMyCJfXCnXBTVtegluQ== 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=jUVoYdHb6ta9VeiQC3+cvDoAD5X3dNxhewI2Qf1AI5M=; b=ZKf6P0LBenZLI58dEflRO3JZ76AEq4oRq3yHe/SW/7hu9Cc2G12EL2LLsAMjPLN7FwEUzwuFJUpSZ7DdDh5kRcz3HZco5aWvUjESt+dViC3vfL1Lx4599tlgSudFuZY3UK678wwzajtAKX4/DccFKupWXajjiBXEc61qIvQdB+c= Received: from AS8PR08MB7080.eurprd08.prod.outlook.com (2603:10a6:20b:401::19) by DB8PR08MB5436.eurprd08.prod.outlook.com (2603:10a6:10:111::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.18; Mon, 27 Jun 2022 11:08:21 +0000 Received: from AS8PR08MB7080.eurprd08.prod.outlook.com ([fe80::b018:574b:d86c:6dba]) by AS8PR08MB7080.eurprd08.prod.outlook.com ([fe80::b018:574b:d86c:6dba%5]) with mapi id 15.20.5373.018; Mon, 27 Jun 2022 11:08:21 +0000 From: Ruifeng Wang To: Slava Ovsiienko , Ali Alnubani , Matan Azrad CC: "dev@dpdk.org" , Honnappa Nagarahalli , "stable@dpdk.org" , nd , nd 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: AQHYARdiJ1WjU7kZ9EOdjp3QpWhpI60nHvMAgDGupQCAC1VTAA== Date: Mon, 27 Jun 2022 11:08:21 +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: x-ts-tracking-id: 5D329DE694E95F46B362F732199D2078.0 x-checkrecipientchecked: true Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-MS-Office365-Filtering-Correlation-Id: 425269ec-7bba-41b5-471f-08da582d6047 x-ms-traffictypediagnostic: DB8PR08MB5436:EE_|DBAEUR03FT033:EE_|DBBPR08MB4758:EE_ x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: FPwKCGz4kTVq72qZD7gXMJ4Tq41RQ5D114C+P22pN9lvPuI3K9T49/Ab9g5+Eb+KzUBzBr0mTv40K5uQ9rRPPsg787sJT/i1G5tcRd8BDY7XobHxOo042asafXDXbfjrvyRaX6FXJ8UThXr4e6WJ+UqIdMuL8OHaHVp395DN7anhDTUHlAeDb6UecPZoXipzrWAGNeXtbLupS99Uh9mrcri0AVvsFC2tofYkqsYrhhcGMAmqBCuqQ6nRBVfGCvB+bK6TntoDRhiNyy5CsBFaURwVGDaylxj+ykvLxCDy6XtdB8SGC+LUgsTYVS4zCMfxo+UtbaOg9m9zGfFvGmbUI5XnoWlJfsI4Jijcg/a5e0ETyfbgZZQD3+FLd+VUoZzf4XF7fHzfG44CfnqWqr8UqX95PlWrlXcf3DPCyORro7zwUfFrqxwQu30anqqoP57ui0OhGg74KUEBjGQNJYzIo2GEh8dauw7hjW9+iUsoUF6cW1s/9OPwgk6mvTzh4jvdJxJVlTTI2hMcmycOyJTM4MM/OJp9G0diQKHH0pAzFJuk6JmLEX4fEqS/v1bqAafipV14i5tSMmhLtsqarqPUqj5tyCaupTyUOjiYLeZ1ENHOaEA1gLfpeWbrwNSfrRMAjKPZhZogsKIKTH7s6yyMFA6LWjJV8PsH/MO6KSIEHPAomXHvqrx1+97HRwmGuVzWKM+MY5M48AtSQCH/gyXF2J+Acia1fHG815tGa8USG5aMbPeXISL2vUBhnbKAkwoMC3s8PM5z64z3Qdm7L89rmARhJlAxlwR3AaoOBN/qPKI= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7080.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(136003)(39860400002)(346002)(366004)(376002)(396003)(53546011)(64756008)(41300700001)(122000001)(26005)(33656002)(5660300002)(38070700005)(71200400001)(76116006)(9686003)(54906003)(8676002)(4326008)(478600001)(110136005)(7696005)(6506007)(186003)(86362001)(2906002)(8936002)(52536014)(38100700002)(83380400001)(316002)(66946007)(55016003)(66556008)(66476007)(66446008); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5436 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 5ff11f78-3a9a-40db-332a-08da582d58cb X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h7dyEtmbUITqGlhmKSI8dEKzTUTbUysyXD4y46CqSgmjKbwNQHLC01fO99eMCUchCGPr8UTFYUJWwf6hsqTmmZbnbk/Dzu4ygBaSD7D6CScmh1tjFpj60Xs3rWJKMYisokfseDT7zrPcZhVLp9oabBDF1BbKtk50SFH0wPDr4El5sgSvwNlDZ4ka5nAv8QWgZx/N/f4AZmucq93TSxtKFymMO+L+l0un1/CA0dfhSmyrD3vSwYYijjM1RWOmNDQwWFEMoGoVoQKY4SPjUnTbLVg3XBNHiQbtSCr2U+92p+Tk8cAZOHld0PlxqM2Gc/lnNfGX6Igy2mtr/7UuIxEv8MWbDhGxzQtois4zY4NijK8RAPx+Ph1OLGs4KkQT/c3/ed8CNZ5ak3C0ovJ01V43QY9FTsuvBBmu0MeW62gouXz6mRldgSGdVhsC5fbTZRNzP97ct00JVysiSAEqbXuMDFJ3FPxwwDfJ87gXL1i9G61vCfoo13cFRjpzKpn8DUEYUtUn1ei1vrcjgloX5ZK+AtY1dsqIFmQ151q6r2p9pEyJVWh9TDQ9m4etGCLbCx4ZuxtG6cZHykXDQeey7sWu28+JNzZPKPweHVuVMWd5FzplMt29ONWreypRqjclSPKMM1s5x7nDXY+UjMqMqpzTm0KbjVRvqWHxkKdhVJIpSEw/V0ma+nvEtHqLKZD/WAvDblE3WNI+qsoePDFpPvW35aqG2vyJVEbOvdblkiNL3W4gB2ADqkYOh+H7nB9HbiqgG7C3Fd+iR3r4tSW8pRAUaGqHomdu401C8CPacC5XZ6I= 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:(13230016)(4636009)(39860400002)(136003)(376002)(346002)(396003)(40470700004)(46966006)(36840700001)(52536014)(186003)(8936002)(5660300002)(86362001)(336012)(26005)(47076005)(40460700003)(478600001)(110136005)(55016003)(450100002)(81166007)(70586007)(40480700001)(356005)(53546011)(82740400003)(70206006)(54906003)(36860700001)(316002)(83380400001)(8676002)(2906002)(4326008)(82310400005)(41300700001)(33656002)(9686003)(6506007)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2022 11:08:33.8246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 425269ec-7bba-41b5-471f-08da582d6047 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: DBAEUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4758 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 > -----Original Message----- > From: Slava Ovsiienko > Sent: Monday, June 20, 2022 1:38 PM > To: Ali Alnubani ; Ruifeng Wang > ; Matan Azrad > Cc: dev@dpdk.org; Honnappa Nagarahalli > ; stable@dpdk.org; nd > Subject: RE: [PATCH] net/mlx5: fix risk in Rx descriptor read in NEON vec= tor > path >=20 > Hi, Ruifeng Hi Slava, Thanks for your review. >=20 > My apologies for review delay. Apologies too. I was on something else. > 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 > - core reads the first 8B of CQE (new CQE values) Yes, This is the problem. >=20 > How the re-reading of CQEs can resolve the issue? > This wrong scenario might happen on the second read and we would run into > the same issue. Here we are trying to ordering reading of a 16B vector (8B with op_own - hi= gh, and 8B without op_own - low). The first read will load 16B. The second read will load and update low 8B (= no op_own). There are 2 possible status indicated by op_own: valid, invalid. If CQE status is invalid, no problem, it will be ignored this time. If CQE status is valid, the second read ensures the rest of CQE is no older= than high 8B (with op_own).=20 Assuming NIC updates op_own no earlier than the rest part of CQE, I think t= he second read ensures CQE content retrieved is correct. >=20 > In my opinion, the right solution to cover potential reordering should be= : > - read CQE > - check CQE status (first 8B) We don't need to check CQE status at the moment. See explanation above. > - read memory barrier > - read the rest of CQE >=20 > With best regards, > Slava >=20 > > -----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 > > vector path > > > > > -----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 > > > --- > > > > Tested with BlueField-2 and didn't see a performance impact. > > > > Tested-by: Ali Alnubani > > > > Thanks, > > Ali