From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C8EAAA034F for ; Sun, 17 May 2020 11:54:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E69A1D64E; Sun, 17 May 2020 11:54:20 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50070.outbound.protection.outlook.com [40.107.5.70]) by dpdk.org (Postfix) with ESMTP id 2C1FA1D646; Sun, 17 May 2020 11:54:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W8kAF0oHqzEzUvB7Hy13yKjJUSZR8L/Te5HFHfmQWCBhaWEjS2YjFcjJJbZNmnmhlu8o+igokeENOQLR7xSazerPz0xTvkJl92gWOO2xJM4fLslZ3USFebyQVOBUz1rWVSoVEJ4q7ETah0h2wUXxrG3IDiGXpf93t4hw1DKnOvXp7JPG1DQmwBZRJMPsWx16yMJlqOBx0KRBEK9qEm2lhUulBXIbySsefFs51N8sy0z6p++6JSETkTHgYA9Jq80cqKVayMwlQak8sEpwFtOZ8KEWrDI26mcn9KVvFKa0SVJeQj2RiikHHnXbbwQRtln5zXm1Ps+vBRI5s8Pk39KVTw== 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-SenderADCheck; bh=uGHGSqWKfPKpaEqwOensVRPLNSd8SzQGKN56Q7U7GDE=; b=WSgZFM8/Yx9QZ7SwNN/sHpFn8q8vKdF1V8qUXmR/GGZRqjxAj4Da916xO9gmAnw8M2ifDZVZqDiLeKQApvxMxpmIzvt3t6e/Z0/X6P7DCqnXtmUcnGMs05IdSVd7KWTXlmPD4L52rpYKRoxg4EbrqidgsjlXAQXqxRg4UtfC+nIq4/YwfTzHKZm7cr5y/h8R4truurnirmLt3oB4n/tRUw+a6jU4Nzvvxix6ICIwaAV9VpNGnCNuWlNeOcGYcfSMXRiQlrb9KFLvRQIMhiZWY/eD5vCitJvfzfBiyYARjCXufsSM3oHOMenfFIUYB+KMfU8D4v/82zjECWPyAuv5CQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uGHGSqWKfPKpaEqwOensVRPLNSd8SzQGKN56Q7U7GDE=; b=SuSX0kqzxXevUqnGwRxQ1gH2pMUkxqk1msQhGCNq3gxu0JTRpDedL9eGSGJZE1fdSZYNYcWA2XrAU02PGNFuhVM4yicVDgh+Cutmh/MiMxHGzgXc2bO9ewl59a4Tz+6pceom4wzEFSP9wnO0ULFwaRjSa5QSRxadL+iBy4m2FJ8= Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (2603:10a6:20b:15b::17) by AM0PR05MB5762.eurprd05.prod.outlook.com (2603:10a6:208:11d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.27; Sun, 17 May 2020 09:54:15 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::508:747b:cc12:5f6e]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::508:747b:cc12:5f6e%6]) with mapi id 15.20.3000.022; Sun, 17 May 2020 09:54:15 +0000 From: Raslan Darawsheh To: Bing Zhao , Slava Ovsiienko CC: Ori Kam , Matan Azrad , "dev@dpdk.org" , "stable@dpdk.org" , Dekel Peled Thread-Topic: [PATCH] net/mlx5: fix left shift extension of doorbell bitmap Thread-Index: AQHWKpDQ4BAxSLmgn0epGm9waWzf8aisAwEggAAJkqA= Date: Sun, 17 May 2020 09:54:15 +0000 Message-ID: References: <1589530438-437604-1-git-send-email-bingz@mellanox.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [188.161.229.217] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 727d71ea-6e2f-43af-6461-08d7fa4842a7 x-ms-traffictypediagnostic: AM0PR05MB5762: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3044; x-forefront-prvs: 040655413E x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Vwn1luCLhN7puPa8XmfgpFLo9DGk5fMJPRzBP8ula2zbdAH6PWw+vV4BLYXCeRYfrtUFZw+zuNeBrTSpgMR/Mmo853EYFL3kuTEh/9quSheil2kV26AkAQm6hlo3U0a69uvERw5JtKtDOkvRzjuIJUtC8YTwN1LACcqjZciU81+nTYUrQDeONHTXsA7Wghvh2+VVGCHxZ60+xZmlq5jD1JQ9tQ1ftmHBrbUN4TH3qPLJx3EFXLcdXDrqSsxBumOjuZrJbVg2IE3+GCgdPqw8fJll1UXRPfxY413q61Gr9Dtbhz2kMSDvppYxL9h+98ng71SLiDQtYW1YR8J0w6eJ5LuY65fCx9RqoywrhL45ASsDeb9+5fS1xfwLo+qGvefNaLB2H4KFGh3xo3n8P78a3O5pwZWL4kSOgrmza5LOuzD7iHbpBgQNIRKzOXF376jH x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6707.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(136003)(396003)(366004)(376002)(346002)(71200400001)(4326008)(5660300002)(478600001)(8936002)(86362001)(52536014)(53546011)(55016002)(6636002)(2906002)(450100002)(186003)(26005)(76116006)(316002)(54906003)(110136005)(66946007)(2940100002)(7696005)(33656002)(107886003)(8676002)(9686003)(64756008)(66446008)(66556008)(66476007)(6506007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: b8OZlA9Agndppk+3Ac/vDDIHUdEfyHG6rBc9S1eBx0LTvXFtQM2EJ3tJla07/+1/rXXh+bTAwwXHhEtyiglelgQ1vgrranJ0pb8Pjl2qtrBv6EsCV/CsspPQuMFFpA7qRCJYSNGAEI42BWH0+kXV7+k/cWtEJy9PzeArFq/+kOKgh5YPEZpgOveWBRObgtFEsOoPxo6RF6QCAbf9e0OUgqROHiSJaCDVKp5Bn929ATFX+NxMGsvA7xAyzVImFVTp+ELNb2MCM/t0hPpQtTS5wAZplTQdEWbQj3/DXZCvCRlKkq3wz65XKD6zOoftsqUKffzQCohNsvR0JDEQHN1QofVwwHdJwHya/0qiFzBviCIJx9NS1zvDgF/7bT8MpjcFgkdduywhyNZ0iIKstYlULJ83gViWcjA4w6TCFJLHvm0329adbM0sUd4lX5tciOTVnP0M++lUWofUxWb4R8i4LF7srzts/5OVLXMir5VnsRlSJFs5LdONxHnzoRhrBHKQ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 727d71ea-6e2f-43af-6461-08d7fa4842a7 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 May 2020 09:54:15.7756 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: quBENzKtzFTwRbgbAa7KzMIlMIfjzcmOxOMj96u7iKBqEJwNEeyoWMVkJAhZLqSRRkMMeZVwW8r6SKwOgqb7rA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5762 Subject: Re: [dpdk-stable] [PATCH] net/mlx5: fix left shift extension of doorbell bitmap X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" > -----Original Message----- > From: Raslan Darawsheh > Sent: Sunday, May 17, 2020 12:19 PM > To: Bing Zhao ; Slava Ovsiienko > > Cc: Ori Kam ; Matan Azrad ; > dev@dpdk.org; stable@dpdk.org; Dekel Peled > Subject: RE: [PATCH] net/mlx5: fix left shift extension of doorbell bitma= p >=20 > Hi, >=20 > > -----Original Message----- > > From: Bing Zhao > > Sent: Friday, May 15, 2020 11:14 AM > > To: Slava Ovsiienko ; Raslan Darawsheh > > > > Cc: Ori Kam ; Matan Azrad > ; > > dev@dpdk.org; stable@dpdk.org; Dekel Peled > > Subject: [PATCH] net/mlx5: fix left shift extension of doorbell bitmap > > > > The doorbell record is organized with page and bitmap. When some new > > doorbell needs to be associated with a queue, the bit will be set > > in the bitmap to indicate the corresponding doorbell occupied. A > > counter is used to record the number of doorbell occupied to speed > > up the searching. > > If the number reachs the maximal value of a pre-defined number of a > > page, a new page will be allocated. If not, then the bitmap will be > > checked to find a free one. > > The LSHIFT and OR (AND NOT) operations are used to update the bitmap > > of a page. But 1 will be treated as a signed integer when compiling. > > When the shift number is 31, the shifted value will be considered as > > negative. Then a wrong extension will be done when setting it to a > > 64-bits variable. All the upper 32-bits will be set to 1 by such > > extension. > > Then a wrong offset value will be calculated because of this. The > > next 64 bits will be also treated as the bitmap and get corrupted > > through the bit set operation. > > The immediate value 1 needs to be used as 64 bits width explicitly. > > > > Fixes: 21cae8580fd0 ("net/mlx5: allocate door-bells via DevX") > > Cc: dekelp@mellanox.com > > Cc: stable@dpdk.org > > > > Signed-off-by: Bing Zhao > > Acked-by: Viacheslav Ovsiienko > > --- > > drivers/net/mlx5/mlx5.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > > index 1445809..ab4adec 100644 > > --- a/drivers/net/mlx5/mlx5.c > > +++ b/drivers/net/mlx5/mlx5.c > > @@ -2174,7 +2174,7 @@ struct mlx5_flow_id_pool * > > /* Find the first clear bit. */ > > MLX5_ASSERT(i < MLX5_DBR_BITMAP_SIZE); > > j =3D rte_bsf64(~page->dbr_bitmap[i]); > > - page->dbr_bitmap[i] |=3D (1 << j); > > + page->dbr_bitmap[i] |=3D (UINT64_C(1) << j); > > page->dbr_count++; > > *dbr_page =3D page; > > return (((i * 64) + j) * sizeof(uint64_t)); > > @@ -2219,7 +2219,7 @@ struct mlx5_flow_id_pool * > > int i =3D offset / 64; > > int j =3D offset % 64; > > > > - page->dbr_bitmap[i] &=3D ~(1 << j); > > + page->dbr_bitmap[i] &=3D ~(UINT64_C(1) << j); > > } > > return ret; > > } > > -- > > 1.8.3.1 >=20 > Commit title changed to: > net/mlx5: fix left shift extension of doorbell bitmap Commit title sent incorrectly, the fix title is: net/mlx5: fix doorbell bitmap management offsets >=20 > Patch applied to next-net-mlx, >=20 > Kindest regards > Raslan Darawsheh Kindest regards Raslan Darawsheh