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 E24B6A0093 for ; Fri, 22 May 2020 11:41:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D9C0A1D967; Fri, 22 May 2020 11:41:49 +0200 (CEST) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by dpdk.org (Postfix) with ESMTP id A2D0F1D945 for ; Fri, 22 May 2020 11:41:48 +0200 (CEST) Received: by mail-wr1-f42.google.com with SMTP id w7so9471993wre.13 for ; Fri, 22 May 2020 02:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8NBNI3qxW+3S4V45nKDrdUGXHh2FkhE+y65n13o7wnA=; b=kTJjr73lcxPoZb0WmIAkmN71Ru8qGv1E5dQbizzMy+4ezIWkzmgEx5DcjcN88QbKgx +SfYdDexgylLfLeNRA7diKvko7EmKRh1d0tbpAU1F6ERpAmwmcfujyk+bvfm9lAcAAvt euh6Rud8mFC0Y2fkmHIN8iuAASzSpUqIZhktMBcO2+fQoo+3vxcdMVge67PAlICEACaU De1pDxMLfVqwthMi0mpG0fxCUHRqhF46iy2gnBQYOuXOvulljMFTGW7dEnsl2ZeY18ub /95NT82/4CaKhBktWfGW2yunoq1YXaGUi0kVCBKtgdhrquwpAAXFzxujGrRA8UIl5JU+ 6lag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8NBNI3qxW+3S4V45nKDrdUGXHh2FkhE+y65n13o7wnA=; b=UPSn0VmbZDZljn2pbI5nGQr78i2j+RR6QgPAWFv3E+wwGbXu6WZqjyAZMux5IFeYiU YN7+JW6q2pXhwiXL0xhq2j+4FhD4SjYoCo0FJ8QaxziTdc5Koj1T8Wa9KQQs+GI2HV1v ZGy9qc7uihTwnZsKJTzDnSUhMsqCcfrdT4pD2kOnHza37RT4OwV2umr+hnYGntyv/1ge NbuJsLsOHIgiAW2Pe2Jgq0YyXPojLpDaSEuLT+8PLjkCFuqLwucMKp/cR8WkoFMsjSmt wrRCd9FClLLr9baKp2CBPJJvoeKTUHXKnqGQ9Kpe70QYRNzWqwBrQUzZS9Bj1Ujy84U6 Y2Uw== X-Gm-Message-State: AOAM531MlLN6IkefCv49sYpUIj2/tc1fvJo9w8hdYI0bHsmFQgTAxOuC DkP5Y4JziTeXNI/yL53rKS4= X-Google-Smtp-Source: ABdhPJyxqJ0YO6HNIYXhg0hVWD3cNErF/6T+Cz3MhemVfArM3YesFmkF5O1daEH7GE1+7oG+JrV//g== X-Received: by 2002:a5d:4388:: with SMTP id i8mr2630735wrq.299.1590140508318; Fri, 22 May 2020 02:41:48 -0700 (PDT) Received: from localhost ([2a01:4b00:f419:6f00:7a8e:ed70:5c52:ea3]) by smtp.gmail.com with ESMTPSA id s8sm8666720wrt.69.2020.05.22.02.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 02:41:47 -0700 (PDT) From: luca.boccassi@gmail.com To: Bing Zhao Cc: Viacheslav Ovsiienko , Matan Azrad , dpdk stable Date: Fri, 22 May 2020 10:40:05 +0100 Message-Id: <20200522094022.1025696-26-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200522094022.1025696-1-luca.boccassi@gmail.com> References: <20200519130549.112823-214-luca.boccassi@gmail.com> <20200522094022.1025696-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix doorbell bitmap management offsets' has been queued to stable release 19.11.3 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" Hi, FYI, your patch has been queued to stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/24/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 8fecf8ad1da951c1283202840763f884a49ceddb Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Fri, 15 May 2020 16:13:58 +0800 Subject: [PATCH] net/mlx5: fix doorbell bitmap management offsets [ upstream commit 25a59a3076461b269b0f489a9f6865042092d1ee ] 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 reaches 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") Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko Acked-by: Matan Azrad --- 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 9ecf31da7c..2349a62674 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1948,7 +1948,7 @@ mlx5_get_dbr(struct rte_eth_dev *dev, struct mlx5_devx_dbr_page **dbr_page) /* Find the first clear bit. */ assert(i < MLX5_DBR_BITMAP_SIZE); j = rte_bsf64(~page->dbr_bitmap[i]); - page->dbr_bitmap[i] |= (1 << j); + page->dbr_bitmap[i] |= (UINT64_C(1) << j); page->dbr_count++; *dbr_page = page; return (((i * 64) + j) * sizeof(uint64_t)); @@ -1993,7 +1993,7 @@ mlx5_release_dbr(struct rte_eth_dev *dev, uint32_t umem_id, uint64_t offset) int i = offset / 64; int j = offset % 64; - page->dbr_bitmap[i] &= ~(1 << j); + page->dbr_bitmap[i] &= ~(UINT64_C(1) << j); } return ret; } -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-22 10:37:40.226057429 +0100 +++ 0026-net-mlx5-fix-doorbell-bitmap-management-offsets.patch 2020-05-22 10:37:39.144413000 +0100 @@ -1,8 +1,10 @@ -From 25a59a3076461b269b0f489a9f6865042092d1ee Mon Sep 17 00:00:00 2001 +From 8fecf8ad1da951c1283202840763f884a49ceddb Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Fri, 15 May 2020 16:13:58 +0800 Subject: [PATCH] net/mlx5: fix doorbell bitmap management offsets +[ upstream commit 25a59a3076461b269b0f489a9f6865042092d1ee ] + 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 @@ -23,7 +25,6 @@ The immediate value 1 needs to be used as 64 bits width explicitly. Fixes: 21cae8580fd0 ("net/mlx5: allocate door-bells via DevX") -Cc: stable@dpdk.org Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko @@ -33,19 +34,19 @@ 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c -index 14458098ec..ab4adecdc3 100644 +index 9ecf31da7c..2349a62674 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c -@@ -2174,7 +2174,7 @@ mlx5_get_dbr(struct rte_eth_dev *dev, struct mlx5_devx_dbr_page **dbr_page) +@@ -1948,7 +1948,7 @@ mlx5_get_dbr(struct rte_eth_dev *dev, struct mlx5_devx_dbr_page **dbr_page) /* Find the first clear bit. */ - MLX5_ASSERT(i < MLX5_DBR_BITMAP_SIZE); + assert(i < MLX5_DBR_BITMAP_SIZE); j = rte_bsf64(~page->dbr_bitmap[i]); - page->dbr_bitmap[i] |= (1 << j); + page->dbr_bitmap[i] |= (UINT64_C(1) << j); page->dbr_count++; *dbr_page = page; return (((i * 64) + j) * sizeof(uint64_t)); -@@ -2219,7 +2219,7 @@ mlx5_release_dbr(struct rte_eth_dev *dev, uint32_t umem_id, uint64_t offset) +@@ -1993,7 +1993,7 @@ mlx5_release_dbr(struct rte_eth_dev *dev, uint32_t umem_id, uint64_t offset) int i = offset / 64; int j = offset % 64;