From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
Aharon Landau <aharonl@nvidia.com>,
Jakub Kicinski <kuba@kernel.org>,
Jason Wang <jasowang@redhat.com>,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>,
netdev@vger.kernel.org, Saeed Mahameed <saeedm@nvidia.com>,
Shay Drory <shayd@nvidia.com>,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH mlx5-next 1/5] RDMA/mlx5: Replace struct mlx5_core_mkey by u32 key
Date: Thu, 29 Jul 2021 15:08:55 -0300 [thread overview]
Message-ID: <20210729180855.GA2401905@nvidia.com> (raw)
In-Reply-To: <2e0feba18d8fe310b2ed38fbfbdd4af7a9b84bf1.1624362290.git.leonro@nvidia.com>
On Tue, Jun 22, 2021 at 03:08:19PM +0300, Leon Romanovsky wrote:
> diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> index 03dc6c22843f..ae0472d92801 100644
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -89,24 +89,39 @@ static void set_mkc_access_pd_addr_fields(void *mkc, int acc, u64 start_addr,
> MLX5_SET64(mkc, mkc, start_addr, start_addr);
> }
>
> -static void
> -assign_mkey_variant(struct mlx5_ib_dev *dev, struct mlx5_core_mkey *mkey,
> - u32 *in)
> +static void assign_mkey_variant(struct mlx5_ib_dev *dev, u32 *mkey, u32 *in)
> {
> u8 key = atomic_inc_return(&dev->mkey_var);
> void *mkc;
>
> mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);
> MLX5_SET(mkc, mkc, mkey_7_0, key);
> - mkey->key = key;
> + *mkey = key;
> +}
Can this be tidied please? We set both mkey_7_0 and mkey then pass
them into mlx5_core_create_mkey which then does
*mkey = (u32)mlx5_mkey_variant(*mkey) | mlx5_idx_to_mkey(mkey_index);
But isn't mlx5_mkey_variant(*mkey) just MLX5_GET(mkc, in, mkey_7_0)
and we can get rid of this confusing sequence?
> +
> +static void set_mkey_fields(void *mkc, struct mlx5_core_mkey *mkey)
> +{
> + mkey->iova = MLX5_GET64(mkc, mkc, start_addr);
> + mkey->size = MLX5_GET64(mkc, mkc, len);
> + mkey->pd = MLX5_GET(mkc, mkc, pd);
> + init_waitqueue_head(&mkey->wait);
> }
Why isn't this called through the create_mkey_callback() path? I think
evey mkey should always have a valid waitqueue
Jason
next prev parent reply other threads:[~2021-07-29 18:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1624362290.git.leonro@nvidia.com>
2021-06-22 12:08 ` [PATCH mlx5-next 1/5] RDMA/mlx5: Replace struct mlx5_core_mkey by u32 key Leon Romanovsky
2021-07-29 15:28 ` Jason Gunthorpe
2021-07-29 17:27 ` Leon Romanovsky
2021-07-29 18:08 ` Jason Gunthorpe [this message]
2021-06-22 12:08 ` [PATCH mlx5-next 2/5] RDMA/mlx5: Move struct mlx5_core_mkey to mlx5_ib Leon Romanovsky
2021-07-29 18:39 ` Jason Gunthorpe
2021-06-22 12:08 ` [PATCH mlx5-next 3/5] RDMA/mlx5: Change the cache to hold mkeys instead of MRs Leon Romanovsky
2021-07-29 19:08 ` Jason Gunthorpe
2021-06-22 12:08 ` [PATCH mlx5-next 4/5] RDMA/mlx5: Change the cache structure to an rbtree Leon Romanovsky
2021-07-29 19:45 ` Jason Gunthorpe
2021-06-22 12:08 ` [PATCH rdma-next 5/5] RDMA/mlx5: Delay the deregistration of a non-cache mkey Leon Romanovsky
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=20210729180855.GA2401905@nvidia.com \
--to=jgg@nvidia.com \
--cc=aharonl@nvidia.com \
--cc=dledford@redhat.com \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=shayd@nvidia.com \
--cc=virtualization@lists.linux-foundation.org \
/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).