lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210729180855.GA2401905@nvidia.com>
Date:   Thu, 29 Jul 2021 15:08:55 -0300
From:   Jason Gunthorpe <jgg@...dia.com>
To:     Leon Romanovsky <leon@...nel.org>
Cc:     Doug Ledford <dledford@...hat.com>,
        Aharon Landau <aharonl@...dia.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Jason Wang <jasowang@...hat.com>, linux-kernel@...r.kernel.org,
        linux-rdma@...r.kernel.org, "Michael S. Tsirkin" <mst@...hat.com>,
        netdev@...r.kernel.org, Saeed Mahameed <saeedm@...dia.com>,
        Shay Drory <shayd@...dia.com>,
        virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH mlx5-next 1/5] RDMA/mlx5: Replace struct mlx5_core_mkey
 by u32 key

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ