[ofa-general] Re: [PATCH]: mlx4: move table_find from fmr_alloc to fmr_enable

Jack Morgenstein jackm at dev.mellanox.co.il
Mon Feb 18 00:10:53 PST 2008


On Thursday 14 February 2008 20:48, Roland Dreier wrote:
> by the way, it seems we never release ICM table entries when freeing
> MPTs.  Does the patch below make sense to you?
> 
> diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c
> index 679dfdb..3ffce7a 100644
> --- a/drivers/net/mlx4/mr.c
> +++ b/drivers/net/mlx4/mr.c
> @@ -287,6 +287,8 @@ void mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr)
>  				     (dev->caps.num_mpts - 1));
>  		if (err)
>  			mlx4_warn(dev, "HW2SW_MPT failed (%d)\n", err);
> +
> +		mlx4_table_put(dev, &mr_table->dmpt_table, key_to_hw_index(mr->key));
>  	}
>  
>  	mlx4_mtt_cleanup(dev, &mr->mtt);
> 

I'm nervous about freeing ICM table entries when HW2SW fails (hw may still access the
memory.

How about the patch below ?
(P.S., please note the priv-> in the patch).

- Jack

---

Index: ofed_kernel/drivers/net/mlx4/mr.c
===================================================================
--- ofed_kernel.orig/drivers/net/mlx4/mr.c	2008-02-18 09:49:28.000000000 +0200
+++ ofed_kernel/drivers/net/mlx4/mr.c	2008-02-18 10:10:21.956745000 +0200
@@ -287,6 +287,9 @@ void mlx4_mr_free(struct mlx4_dev *dev, 
 				     (dev->caps.num_mpts - 1));
 		if (err)
 			mlx4_warn(dev, "HW2SW_MPT failed (%d)\n", err);
+		else
+			mlx4_table_put(dev, &priv->mr_table.dmpt_table,
+				       key_to_hw_index(mr->key);
 	}
 
 	mlx4_mtt_cleanup(dev, &mr->mtt);



More information about the general mailing list