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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <33b95e3f-ae37-4635-1810-c8e65d075e4d@cogentembedded.com>
Date:   Tue, 20 Sep 2016 15:47:49 +0300
From:   Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:     Tariq Toukan <tariqt@...lanox.com>,
        "David S. Miller" <davem@...emloft.net>
Cc:     netdev@...r.kernel.org, Eran Ben Elisha <eranbe@...lanox.com>,
        Leon Romanovsky <leonro@...lanox.com>
Subject: Re: [PATCH net-next V2 3/4] net/mlx4_core: Use RCU to perform radix
 tree lookup for SRQ

Hello.

On 9/20/2016 2:39 PM, Tariq Toukan wrote:

> From: Leon Romanovsky <leonro@...lanox.com>
>
> Radix tree lookup can be performed without locking.
>
> Fixes: 225c7b1feef1 ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters")
> Signed-off-by: Leon Romanovsky <leonro@...lanox.com>
> Suggested-by: Sagi Grimberg <sagi@...mberg.me>
> Signed-off-by: Tariq Toukan <tariqt@...lanox.com>
> ---
>  drivers/net/ethernet/mellanox/mlx4/srq.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c
> index 67146624eb58..f44d089e2ca6 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/srq.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/srq.c
> @@ -45,15 +45,12 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type)
>  	struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
>  	struct mlx4_srq *srq;
>
> -	spin_lock(&srq_table->lock);
> -
> +	rcu_read_lock();
>  	srq = radix_tree_lookup(&srq_table->tree, srqn & (dev->caps.num_srqs - 1));
> +	rcu_read_unlock();
>  	if (srq)
>  		atomic_inc(&srq->refcount);
> -
> -	spin_unlock(&srq_table->lock);
> -
> -	if (!srq) {
> +	else {
>  		mlx4_warn(dev, "Async event for bogus SRQ %08x\n", srqn);
>  		return;
>  	}

    CodingStyle: all branches of the *if* statement should have {} if at least 
one has.

[...]

MBR, Sergei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ