From patchwork Wed Sep 20 10:01:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13392444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 471F2CE79B4 for ; Wed, 20 Sep 2023 10:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234220AbjITKCN (ORCPT ); Wed, 20 Sep 2023 06:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234128AbjITKCN (ORCPT ); Wed, 20 Sep 2023 06:02:13 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A579C8F for ; Wed, 20 Sep 2023 03:02:07 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C86CCC433C8; Wed, 20 Sep 2023 10:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695204127; bh=jgVQ93NpuWMwRx5GVnfG3qgPoHneMr9tOzhXZoR8NZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aNpB2EvdgTDA2oPP+cLxq69CUUEay0+NUTO/S+i5zJ3+qzXoL9RSL51xiPXS1kV2w sw7q/VBzCcsnlRhSKYZAQzFZGBaGeIvA5TELW4YA7umpcwQ+zbzHplAKy1ESSfkYfB m32cS07I6bcT1C39UnMchV1Tn1GH9lZ/WjtTNMU3KzIKyqLODDcyezMZKY42gqLUYu UWWJRlvoRNvd86bzIIwmWgYcjykv2pWyF9Sk46XLsXDuhu6TuWGftyEUyZsvaT16jP vAyzfCMh84jP7DGQ+m8weML4a7JSU6j6b0s8Je0RkufZJ1siUMiDnW3+ynvUO5y3FY 4BMymDWH8/Ohg== From: Leon Romanovsky To: Jason Gunthorpe Cc: Michael Guralnik , Edward Srouji , linux-rdma@vger.kernel.org, Maor Gottlieb , Mark Bloch , Shay Drory Subject: [PATCH rdma-rc 1/3] RDMA/mlx5: Fix assigning access flags to cache mkeys Date: Wed, 20 Sep 2023 13:01:54 +0300 Message-ID: <8a802700b82def3ace3f77cd7a9ad9d734af87e7.1695203958.git.leonro@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Michael Guralnik After the change to use dynamic cache structure, new cache entries can be added and the mkey allocation can no longer assume that all mkeys created for the cache have access_flags equal to zero. Example of a flow that exposes the issue: A user registers MR with RO on a HCA that cannot UMR RO and the mkey is created outside of the cache. When the user deregisters the MR, a new cache entry is created to store mkeys with RO. Later, the user registers 2 MRs with RO. The first MR is reused from the new cache entry. When we try to get the second mkey from the cache we see the entry is empty so we go to the MR cache mkey allocation flow which would have allocated a mkey with no access flags, resulting the user getting a MR without RO. Fixes: dd1b913fb0d0 ("RDMA/mlx5: Cache all user cacheable mkeys on dereg MR flow") Reviewed-by: Edward Srouji Signed-off-by: Michael Guralnik Signed-off-by: Leon Romanovsky --- drivers/infiniband/hw/mlx5/mr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index 5d3cc225be29..4a1e78e394e5 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -239,7 +239,8 @@ static int get_mkc_octo_size(unsigned int access_mode, unsigned int ndescs) static void set_cache_mkc(struct mlx5_cache_ent *ent, void *mkc) { - set_mkc_access_pd_addr_fields(mkc, 0, 0, ent->dev->umrc.pd); + set_mkc_access_pd_addr_fields(mkc, ent->rb_key.access_flags, 0, + ent->dev->umrc.pd); MLX5_SET(mkc, mkc, free, 1); MLX5_SET(mkc, mkc, umr_en, 1); MLX5_SET(mkc, mkc, access_mode_1_0, ent->rb_key.access_mode & 0x3); From patchwork Wed Sep 20 10:01:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13392445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B994CCE79B4 for ; Wed, 20 Sep 2023 10:02:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234247AbjITKCS (ORCPT ); Wed, 20 Sep 2023 06:02:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234253AbjITKCR (ORCPT ); Wed, 20 Sep 2023 06:02:17 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90F68AB for ; Wed, 20 Sep 2023 03:02:11 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B13F7C433C7; Wed, 20 Sep 2023 10:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695204131; bh=kdzITnPQosr+sXTvv79I2LWIDuZmV9izbT6R8EGKHrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ea0GF+/15tmWDDA+uonkU9yq0Ga+868pO8Z9v6TXhkCnUKlzgXe4O7I0ckjLijHDt BCqAsOJlqpQs2Gw2quRjF0T/k9fXAAzZrxlRLAJT41HLggYlMQpkHQ5gf02pq9z1vc f/RX9peRTvGva3scag0Cjl9F8mQkuCh3Yg4gAzg2h3xDStPlBFlWI59zIP5b+wCnTI adbcnVVYlhny3tPwvZ9dRabeue2FoCk3YbxWoRCMCoXrQQ0rwD7xyG60b2DLOoF50b bTklHODPodvR2W8nUWuh2APPPIiilOkKYoeZ95AEGJp4Xy3j9fAdmV62upMHKZ1SwQ +/LaJ2ovcboQA== From: Leon Romanovsky To: Jason Gunthorpe Cc: Hamdan Igbaria , Edward Srouji , linux-rdma@vger.kernel.org, Maor Gottlieb , Mark Bloch , Michael Guralnik , Shay Drory Subject: [PATCH rdma-rc 2/3] RDMA/mlx5: Fix mutex unlocking on error flow for steering anchor creation Date: Wed, 20 Sep 2023 13:01:55 +0300 Message-ID: <1244a69d783da997c0af0b827c622eb00495492e.1695203958.git.leonro@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Hamdan Igbaria The mutex was not unlocked on some of the error flows. Moved the unlock location to include all the error flow scenarios. Fixes: e1f4a52ac171 ("RDMA/mlx5: Create an indirect flow table for steering anchor") Reviewed-by: Mark Bloch Signed-off-by: Hamdan Igbaria Signed-off-by: Leon Romanovsky --- drivers/infiniband/hw/mlx5/fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/fs.c index 1e419e080b53..520034acf73a 100644 --- a/drivers/infiniband/hw/mlx5/fs.c +++ b/drivers/infiniband/hw/mlx5/fs.c @@ -2470,8 +2470,8 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_STEERING_ANCHOR_CREATE)( mlx5_steering_anchor_destroy_res(ft_prio); put_flow_table: put_flow_table(dev, ft_prio, true); - mutex_unlock(&dev->flow_db->lock); free_obj: + mutex_unlock(&dev->flow_db->lock); kfree(obj); return err; From patchwork Wed Sep 20 10:01:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13392446 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB92BCE79B4 for ; Wed, 20 Sep 2023 10:02:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234253AbjITKCW (ORCPT ); Wed, 20 Sep 2023 06:02:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234283AbjITKCV (ORCPT ); Wed, 20 Sep 2023 06:02:21 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C206BC2 for ; Wed, 20 Sep 2023 03:02:15 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC84CC433C9; Wed, 20 Sep 2023 10:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695204135; bh=9AB5Xrqd9JGHrc0Re4GbRE58CUZg3MP+CvlPQhDiwRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Di8ftGAb+DkcLq+ZCsvrQcym/rIItRJklzIXx96mejuOCJ1BHuv2/rj/orJu+2yjL z/Peh4vGdKKUSmuNBI56ImAxDdFhgRWckFepXvp28snxX1Jf8MnJ7HgnzIgAPEkStC v5Xsh/bUfx8scvzPw5UZPBm9TOFjlJy49Wr3xWh2KhqypqnEbFw+iinl5G1c/hY3fJ kL0kkeWBaJWbmAPap7apRd65XxDDc7HekjUviD85c1e5dqIBbMUk3anYgTLMYNog2l UsauS9bK9isXsHIUmMB5EUk+5Y8IMBZiqiioDTxigmOavz27JXWduYHiwn7+WB8XMm 5saI2KQZ2J8EQ== From: Leon Romanovsky To: Jason Gunthorpe Cc: Shay Drory , Edward Srouji , linux-rdma@vger.kernel.org, Maor Gottlieb , Mark Bloch , Michael Guralnik Subject: [PATCH rdma-rc 3/3] RDMA/mlx5: Fix NULL string error Date: Wed, 20 Sep 2023 13:01:56 +0300 Message-ID: <8638e5c14fadbde5fa9961874feae917073af920.1695203958.git.leonro@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Shay Drory checkpath is complaining about NULL string, change it to 'Unknown'. Fixes: 37aa5c36aa70 ("IB/mlx5: Add UARs write-combining and non-cached mapping") Signed-off-by: Shay Drory Signed-off-by: Leon Romanovsky --- drivers/infiniband/hw/mlx5/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index aed5cdea50e6..555629b798b9 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -2084,7 +2084,7 @@ static inline char *mmap_cmd2str(enum mlx5_ib_mmap_cmd cmd) case MLX5_IB_MMAP_DEVICE_MEM: return "Device Memory"; default: - return NULL; + return "Unknown"; } }