Re: [PATCH rdma-next 2/3] IB/uverbs: Add support to advise_mr

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

 



On Tue, Dec 04, 2018 at 04:03:20PM +0200, Leon Romanovsky wrote:
> From: Moni Shoua <monis@xxxxxxxxxxxx>
> 
> Add new ioctl method for the MR object - ADVISE_MR.
> 
> This command can be used by users to give an advice or directions to the
> kernel about an address range that belongs to memory regions.
> 
> A new ib_device callback, advise_mr(), is introduced here to suupport
> the new command. This command takes the following arguments:
> 
> - pd:		The protection domain to which all memory regions belong
> - advice: 	The type of the advice
> 	  	* IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH - Pre-fetch a range of
> 		an on-demand paging MR
> 	  	* IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_WRITE - Pre-fetch a range
> 		of an on-demand paging MR with write permissions

'with write intention'

> diff --git a/drivers/infiniband/core/uverbs_std_types_mr.c b/drivers/infiniband/core/uverbs_std_types_mr.c
> index 70ea48cfc047..0057ac3b507d 100644
> +++ b/drivers/infiniband/core/uverbs_std_types_mr.c
> @@ -39,6 +39,43 @@ static int uverbs_free_mr(struct ib_uobject *uobject,
>  	return ib_dereg_mr((struct ib_mr *)uobject->object);
>  }
> 
> +static int UVERBS_HANDLER(UVERBS_METHOD_ADVISE_MR)(
> +	struct uverbs_attr_bundle *attrs)
> +{
> +	struct ib_pd *pd =
> +		uverbs_attr_get_obj(attrs, UVERBS_ATTR_ADVISE_MR_PD_HANDLE);
> +	enum ib_uverbs_advise_mr_advice advice;
> +	struct ib_device *ib_dev = pd->device;
> +	struct ib_sge *sg_list;
> +	u32 num_sge;
> +	u32 flags;
> +	int ret;
> +
> +	if (!ib_dev->advise_mr)
> +		return -EOPNOTSUPP;

Now that my series was merged this stuff should be done via the
UAPI_DEF_OBJ_NEEDS_FN stuff.. Except it only works on a fine grained
level for write() commands. Sigh.

Let's just add a FIXME comment here.

> diff --git a/include/uapi/rdma/ib_user_ioctl_verbs.h b/include/uapi/rdma/ib_user_ioctl_verbs.h
> index 6cdf192070a2..80d581422762 100644
> +++ b/include/uapi/rdma/ib_user_ioctl_verbs.h
> @@ -157,4 +157,13 @@ enum ib_uverbs_read_counters_flags {
>  	IB_UVERBS_READ_COUNTERS_PREFER_CACHED = 1 << 0,
>  };
> 
> +enum ib_uverbs_advise_mr_advice {
> +	IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH,
> +	IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_WRITE,
> +};
> +
> +enum ib_uverbs_advise_mr_flag {
> +	IB_UVERBS_ADVISE_MR_FLAG_FLUSH = (1 << 0),

Brackets are redundant..

I can make these changes, but since it was only posted 2 days ago and
is a new common uapi it has to wait..

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