Re: [PATCH 01/15] RDMA/mlx5: Use SRCU properly in ODP prefetch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 09, 2019 at 01:09:21PM -0300, Jason Gunthorpe wrote:
> -static void mlx5_ib_prefetch_mr_work(struct work_struct *work)
> +static int mlx5_ib_prefetch_sg_list(struct ib_pd *pd,
> +				    enum ib_uverbs_advise_mr_advice advice,
> +				    u32 pf_flags, struct ib_sge *sg_list,
> +				    u32 num_sge)
>  {
> -	struct prefetch_mr_work *w =
> -		container_of(work, struct prefetch_mr_work, work);
> +	struct mlx5_ib_dev *dev = to_mdev(pd->device);
> +	u32 bytes_mapped = 0;
> +	int srcu_key;
> +	int ret = 0;
> +	u32 i;
>  
> -	if (ib_device_try_get(w->pd->device)) {
> -		mlx5_ib_prefetch_sg_list(w->pd, w->pf_flags, w->sg_list,
> -					 w->num_sge);
> -		ib_device_put(w->pd->device);
> +	srcu_key = srcu_read_lock(&dev->mr_srcu);
> +	for (i = 0; i < num_sge; ++i) {
> +		struct mlx5_ib_mr *mr;
> +
> +		mr = get_prefetchable_mr(pd, advice, sg_list[i].lkey);
> +		if (!mr) {
> +			ret = -ENOENT;
> +			goto out;
> +		}
> +		ret = pagefault_mr(mr, sg_list[i].addr, sg_list[i].length,
> +				   &bytes_mapped, pf_flags);
> +		if (ret < 0)
> +			goto out;
>  	}

There is a mistake here, 'ret' has to be 0 when this function succeeds
but pagefault_mr returns >0 on success. Needs a 'ret = 0' at this
point

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux