Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Bob Pearson <rpearsonhpe@gmail.com>
To: Jason Gunthorpe <jgg@nvidia.com>,
	Bernard Metzler <bmt@zurich.ibm.com>,
	linux-rdma@vger.kernel.org, Zhu Yanjun <yanjunz@nvidia.com>
Subject: Re: [PATCH] RDMA/rxe,siw: Restore uverbs_cmd_mask IB_USER_VERBS_CMD_POST_SEND
Date: Fri, 30 Oct 2020 11:18:15 -0500	[thread overview]
Message-ID: <77c24a90-0df2-e0b4-02a7-6f88f2aa9b46@gmail.com> (raw)
In-Reply-To: <0-v1-4608c5610afa+fb-uverbs_cmd_post_send_fix_jgg@nvidia.com>

On 10/30/20 9:03 AM, Jason Gunthorpe wrote:
> These two drivers open code the call to POST_SEND and do not use the
> rdma-core wrapper to do it, thus their usages was missed during the audit.
> 
> Both drivers use this as a doorbell to signal the kernel to start DMA.
> 
> Fixes: 628c02bf38aa ("RDMA: Remove uverbs cmds from drivers that don't use them")
> Reported-by: Bob Pearson <rpearsonhpe@gmail.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_verbs.c | 3 ++-
>  drivers/infiniband/sw/siw/siw_main.c  | 2 ++
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
> index 7652d53af2c1d9..209c7b3fab97a2 100644
> --- a/drivers/infiniband/sw/rxe/rxe_verbs.c
> +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
> @@ -1142,7 +1142,8 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
>  	dma_set_max_seg_size(&dev->dev, UINT_MAX);
>  	dma_set_coherent_mask(&dev->dev, dma_get_required_mask(&dev->dev));
>  
> -	dev->uverbs_cmd_mask |= BIT_ULL(IB_USER_VERBS_CMD_REQ_NOTIFY_CQ);
> +	dev->uverbs_cmd_mask |= BIT_ULL(IB_USER_VERBS_CMD_POST_SEND) |
> +				BIT_ULL(IB_USER_VERBS_CMD_REQ_NOTIFY_CQ);
>  
>  	ib_set_device_ops(dev, &rxe_dev_ops);
>  	err = ib_device_set_netdev(&rxe->ib_dev, rxe->ndev, 1);
> diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c
> index e49faefdee923d..9cf596429dbf7d 100644
> --- a/drivers/infiniband/sw/siw/siw_main.c
> +++ b/drivers/infiniband/sw/siw/siw_main.c
> @@ -347,6 +347,8 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
>  				    addr);
>  	}
>  
> +	base_dev->uverbs_cmd_mask |= BIT_ULL(IB_USER_VERBS_CMD_POST_SEND);
> +
>  	base_dev->node_type = RDMA_NODE_RNIC;
>  	memcpy(base_dev->node_desc, SIW_NODE_DESC_COMMON,
>  	       sizeof(SIW_NODE_DESC_COMMON));
> 
This the right short term fix but seriously why not just completely kill off uverbs_cmd_mask? If a driver sets a non-NULL value in ib_device_ops assume it was done for a reason and allow commands through. Is there any example of a driver using uverbs_cmd_mask to dynamically enable/disable a verb? I thought this was your plan when you mentioned this change a while back.

Your comment about open coding the post send command is valid. I don't recall all the history that got us to where we are now but it looks like calling ibv_cmd_post_send could be made to work. Since wr_count will be zero a lot of extra work will not happen but there is still more work than needed. The only thing I would be worried about is that it assumes the wqes are struct ib_uverbs_send_wr's but at least for rxe they are expanded. Have to make sure there aren't any bad side effects now or in the future from e.g. sending the wrong wqe size to the kernel.

Bob

  reply	other threads:[~2020-10-30 16:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30 14:03 [PATCH] RDMA/rxe,siw: Restore uverbs_cmd_mask IB_USER_VERBS_CMD_POST_SEND Jason Gunthorpe
2020-10-30 16:18 ` Bob Pearson [this message]
2020-10-30 16:25   ` Jason Gunthorpe
2020-11-02 19:32 ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77c24a90-0df2-e0b4-02a7-6f88f2aa9b46@gmail.com \
    --to=rpearsonhpe@gmail.com \
    --cc=bmt@zurich.ibm.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=yanjunz@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox