From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>,
RDMA mailing list <linux-rdma@vger.kernel.org>,
Alex Vainman <alexv@mellanox.com>,
Artemy Kovalyov <artemyko@mellanox.com>,
Daniel Jurgens <danielj@mellanox.com>,
Eli Cohen <eli@mellanox.com>, Haggai Eran <haggaie@mellanox.com>,
Mark Zhang <markz@mellanox.com>, Moni Shoua <monis@mellanox.com>,
Parav Pandit <parav@mellanox.com>,
Sagi Grimberg <sagig@mellanox.com>,
Yishai Hadas <yishaih@mellanox.com>
Subject: [PATCH rdma-rc 02/10] IB/mlx5: Fix unreg_umr to ignore the mkey state
Date: Tue, 23 Jul 2019 09:57:25 +0300 [thread overview]
Message-ID: <20190723065733.4899-3-leon@kernel.org> (raw)
In-Reply-To: <20190723065733.4899-1-leon@kernel.org>
From: Yishai Hadas <yishaih@mellanox.com>
Fix unreg_umr to ignore the mkey state and do not fail if was freed.
This prevents a case that a user space application already changed the
mkey state to free and then the UMR operation will fail leaving the mkey
in an un-applicable state.
Cc: <stable@vger.kernel.org> # 3.19
Fixes: 968e78dd9644 ("IB/mlx5: Enhance UMR support to allow partial page table update")
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Reviewed-by: Artemy Kovalyov <artemyko@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/mlx5_ib.h | 1 +
drivers/infiniband/hw/mlx5/mr.c | 4 ++--
drivers/infiniband/hw/mlx5/qp.c | 12 ++++++++----
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index c482f19958b3..f6a53455bf8b 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -481,6 +481,7 @@ struct mlx5_umr_wr {
u64 length;
int access_flags;
u32 mkey;
+ u8 ignore_free_state:1;
};
static inline const struct mlx5_umr_wr *umr_wr(const struct ib_send_wr *wr)
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 20ece6e0b2fc..266edaf8029d 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1372,10 +1372,10 @@ static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr)
if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
return 0;
- umrwr.wr.send_flags = MLX5_IB_SEND_UMR_DISABLE_MR |
- MLX5_IB_SEND_UMR_FAIL_IF_FREE;
+ umrwr.wr.send_flags = MLX5_IB_SEND_UMR_DISABLE_MR;
umrwr.wr.opcode = MLX5_IB_WR_UMR;
umrwr.mkey = mr->mmkey.key;
+ umrwr.ignore_free_state = 1;
return mlx5_ib_post_send_wait(dev, &umrwr);
}
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 2a97619ed603..615cc6771516 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -4295,10 +4295,14 @@ static int set_reg_umr_segment(struct mlx5_ib_dev *dev,
memset(umr, 0, sizeof(*umr));
- if (wr->send_flags & MLX5_IB_SEND_UMR_FAIL_IF_FREE)
- umr->flags = MLX5_UMR_CHECK_FREE; /* fail if free */
- else
- umr->flags = MLX5_UMR_CHECK_NOT_FREE; /* fail if not free */
+ if (!umrwr->ignore_free_state) {
+ if (wr->send_flags & MLX5_IB_SEND_UMR_FAIL_IF_FREE)
+ /* fail if free */
+ umr->flags = MLX5_UMR_CHECK_FREE;
+ else
+ /* fail if not free */
+ umr->flags = MLX5_UMR_CHECK_NOT_FREE;
+ }
umr->xlt_octowords = cpu_to_be16(get_xlt_octo(umrwr->xlt_size));
if (wr->send_flags & MLX5_IB_SEND_UMR_UPDATE_XLT) {
--
2.20.1
next prev parent reply other threads:[~2019-07-23 6:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-23 6:57 [PATCH rdma-rc 00/10] Collection of fixes for 5.3 Leon Romanovsky
2019-07-23 6:57 ` [PATCH rdma-rc 01/10] RDMA/core: Annotate destroy of mutex to ensure that it is released as unlocked Leon Romanovsky
2019-07-23 6:57 ` Leon Romanovsky [this message]
2019-07-23 6:57 ` [PATCH rdma-rc 03/10] IB/mlx5: Use direct mkey destroy command upon UMR unreg failure Leon Romanovsky
2019-07-23 6:57 ` [PATCH rdma-rc 04/10] IB/mlx5: Fix unreg_umr to set a device PD Leon Romanovsky
2019-07-23 6:57 ` [PATCH rdma-rc 05/10] IB/mlx5: Fix clean_mr() to work in the expected order Leon Romanovsky
2019-07-23 6:57 ` [PATCH rdma-rc 06/10] IB/mlx5: Fix RSS Toeplitz function to be specification aligned Leon Romanovsky
2019-07-23 6:57 ` [PATCH rdma-rc 07/10] IB/mlx5: Prevent concurrent MR updates during invalidation Leon Romanovsky
2019-07-23 6:57 ` [PATCH rdma-rc 08/10] IB/mlx5: Avoid unnecessary typecast Leon Romanovsky
2019-07-23 6:57 ` [PATCH rdma-rc 09/10] IB/core: Fix querying total rdma stats Leon Romanovsky
2019-07-23 6:57 ` [PATCH rdma-rc 10/10] IB/counters: Initialize port counter and annotate mutex_destroy Leon Romanovsky
2019-07-25 14:32 ` Jason Gunthorpe
2019-07-25 15:13 ` [PATCH rdma-rc 00/10] Collection of fixes for 5.3 Jason Gunthorpe
2019-07-25 16:05 ` Parav Pandit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190723065733.4899-3-leon@kernel.org \
--to=leon@kernel.org \
--cc=alexv@mellanox.com \
--cc=artemyko@mellanox.com \
--cc=danielj@mellanox.com \
--cc=dledford@redhat.com \
--cc=eli@mellanox.com \
--cc=haggaie@mellanox.com \
--cc=jgg@mellanox.com \
--cc=leonro@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=markz@mellanox.com \
--cc=monis@mellanox.com \
--cc=parav@mellanox.com \
--cc=sagig@mellanox.com \
--cc=yishaih@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).