Re: [PATCH for-next 05/13] IB/core: Fix rkey invalidation from user space into the kernel

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

 



On Wed, Apr 04, 2018 at 08:02:07PM -0700, Dennis Dalessandro wrote:
> From: Ashutosh Dixit <ashutosh.dixit@xxxxxxxxx>
> 
> rkey invalidation from userspace into the kernel is broken for both
> IB_WR_LOCAL_INV and IB_WR_SEND_WITH_INV opcodes because of (a)
> mismatch in opcode values between 'enum ib_wr_opcode' in the kernel
> and 'enum ibv_wr_opcode' in rdma-core libibverbs (b) missing handling
> of IB_WR_LOCAL_INV in ib_uverbs_post_send().
> 
> This patch reorders the kernel enum to match user space, rather than
> the other way round, because if enum values were changed in rdma-core
> dynamically linked applications would need to be recompiled before
> they will work, whereas the kernel is monolithic and all kernel ULP's
> see the new kernel enum without issues. Also add handling of
> IB_WR_LOCAL_INV in ib_uverbs_post_send().
> 
> Reported-by: Prathap Kumar Valsan <prathap.kumar.valsan@xxxxxxxxx>
> Reviewed-by: Brian Welty <brian.welty@xxxxxxxxx>
> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@xxxxxxxxx>
> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxx>
>  drivers/infiniband/core/uverbs_cmd.c |    4 +++-
>  include/rdma/ib_verbs.h              |    5 +++--
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> index a148de3..44f3d9e 100644
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -2260,6 +2260,7 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
>  			next = &atomic->wr;
>  		} else if (user_wr->opcode == IB_WR_SEND ||
>  			   user_wr->opcode == IB_WR_SEND_WITH_IMM ||
> +			   user_wr->opcode == IB_WR_LOCAL_INV ||
>  			   user_wr->opcode == IB_WR_SEND_WITH_INV) {
>  			next_size = sizeof(*next);
>  			next = alloc_wr(next_size, user_wr->num_sge);
> @@ -2276,7 +2277,8 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
>  		    user_wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM) {
>  			next->ex.imm_data =
>  					(__be32 __force) user_wr->ex.imm_data;
> -		} else if (user_wr->opcode == IB_WR_SEND_WITH_INV) {
> +		} else if (user_wr->opcode == IB_WR_LOCAL_INV ||
> +			   user_wr->opcode == IB_WR_SEND_WITH_INV) {
>  			next->ex.invalidate_rkey = user_wr->ex.invalidate_rkey;
>  		}
>  
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index 73b2387..964497b 100644
> +++ b/include/rdma/ib_verbs.h
> @@ -1268,10 +1268,11 @@ enum ib_wr_opcode {
>  	IB_WR_RDMA_READ,
>  	IB_WR_ATOMIC_CMP_AND_SWP,
>  	IB_WR_ATOMIC_FETCH_AND_ADD,
> -	IB_WR_LSO,
> +	IB_WR_LOCAL_INV,
> +	IB_WR_RESERVED0,
>  	IB_WR_SEND_WITH_INV,
> +	IB_WR_LSO,
>  	IB_WR_RDMA_READ_WITH_INV,
> -	IB_WR_LOCAL_INV,
>  	IB_WR_REG_MR,
>  	IB_WR_MASKED_ATOMIC_CMP_AND_SWP,
>  	IB_WR_MASKED_ATOMIC_FETCH_AND_ADD,

If this has become UAPI then it needs to to move to a uapi/rdma/ include
file.

Jason

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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