linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Pearson <rpearsonhpe@gmail.com>
To: Shoaib Rao <rao.shoaib@oracle.com>, Jason Gunthorpe <jgg@ziepe.ca>
Cc: "Pearson, Robert B" <robert.pearson2@hpe.com>,
	Zhu Yanjun <zyjzyj2000@gmail.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH v3 0/1] RDMA/rxe: Bump up default maximum values used via uverbs
Date: Tue, 14 Sep 2021 11:14:46 -0500	[thread overview]
Message-ID: <af34b0c2-98bf-b8b5-3638-8b0fef1cd85a@gmail.com> (raw)
In-Reply-To: <f3849d06-f25b-5119-f2be-4974a72f9bad@oracle.com>

On 9/12/21 7:50 PM, Shoaib Rao wrote:
> 
> On 8/6/21 6:49 AM, Jason Gunthorpe wrote:
>> On Wed, Aug 04, 2021 at 11:11:15PM -0700, Shoaib Rao wrote:
>>> Bob,
>>>
>>> Your third patch has an issue.
>>>
>>> In rxe_cq_post()
>>>
>>>
>>> addr = producer_addr(cq->queue, QUEUE_TYPE_TO_CLIENT);
>>>
>>> It should be
>>>
>>> addr = producer_addr(cq->queue, QUEUE_TYPE_FROM_CLIENT);
>>>
>>> After making this change, I have tested my patch and rping works.
>>>
>>> Bob can you please point me to the discussion which lead to the current
>>> changes, particularly the need for user barrier.
>>>
>>> Zhu can you apply Bob's 3 patches + the change above + my patch and report
>>> back. In my testing it works.
>> I'll expect Bob to resend
>>
>>     [for-next,v2,3/3] RDMA/rxe: Add memory barriers to kernel queues
>>
>> Jason
> 
> I have not seen a reply to this email thread. Has the issue been resolved and I missed it?
> 
> Shoaib
> 

Shoaib,

Thanks for this. I think I figured out what was causing the problem you tried to fix by
changing _TO_CLIENT to _FROM_CLIENT. That change isn't the whole solution.

The inline functions in rxe_queue.h all take a type parameter to let the compiler remove the switch
statement since the case is known at compile time. The types currently refer to the direction
of data flow in the queues from the point of view of the internals of the rxe driver. I.e.
for WQs data flows from the CLIENT to the DRIVER and for CQs the data flows to the CLIENT from
the DRIVER. This lets the routines in rxe_queue.h selectively use smp_load_acquire or
smp_store_release to 'protect' the queue indices owned by the client and private q->index for the
indices owned by the internals of the driver which is then copied to q->buf->producer/consumer_index.
The reason for this it that the driver can't trust the client in user space to not touch its data.

In rxe_cq.c where you made the change data is flowing to the client and the original type is the correct one. I believe the problem lies in rxe_verbs.c where verbs code manipulates the 'client'
end of the queues. This occurs in post_one_recv(), post_one_send(), rxe_poll_cq(), and rxe_peek_cq().
This code was using the same APIs as the driver internals which had two problems. First it had
the direction wrong in terms of which indices needed protection and worse it used the private
copies of the indices that should not be visible to clients. You put memory barriers in rxe_cq
that had the same effect ias putting the correct barriers in rxe_verbs.c.

I have fixed this by adding two new types for these verbs routines to use that put the correct
memory barriers on the correct indices. It is going to be resent as v4 of the patch series shortly.
I would like you to try it on rping and see of it cleans up what you were seeing.

Bob

      parent reply	other threads:[~2021-09-14 16:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-18 22:59 [PATCH v3 0/1] RDMA/rxe: Bump up default maximum values used via uverbs Rao Shoaib
2021-07-18 22:59 ` [PATCH v3 1/1] " Rao Shoaib
2021-07-27 16:15 ` [PATCH v3 0/1] " Shoaib Rao
2021-07-27 17:41   ` Jason Gunthorpe
2021-07-29  6:42     ` Zhu Yanjun
2021-07-29  6:52       ` Shoaib Rao
2021-07-29  7:57         ` Zhu Yanjun
2021-07-29 19:33           ` Shoaib Rao
2021-07-29 19:50             ` Jason Gunthorpe
2021-07-29 20:33               ` Shoaib Rao
2021-07-29 23:08               ` Pearson, Robert B
2021-07-30  0:34                 ` Shoaib Rao
2021-08-03 23:53                   ` Shoaib Rao
2021-08-04  0:51                     ` Zhu Yanjun
2021-08-04  1:51                       ` Shoaib Rao
2021-08-04  2:21                         ` Zhu Yanjun
2021-08-05  4:10                           ` Shoaib Rao
2021-08-05  6:56                             ` Leon Romanovsky
2021-08-05  6:11                 ` Shoaib Rao
2021-08-06 13:49                   ` Jason Gunthorpe
2021-09-13  0:50                     ` Shoaib Rao
2021-09-13  3:34                       ` Pearson, Robert B
2021-09-14 16:14                       ` Bob Pearson [this message]

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=af34b0c2-98bf-b8b5-3638-8b0fef1cd85a@gmail.com \
    --to=rpearsonhpe@gmail.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rao.shoaib@oracle.com \
    --cc=robert.pearson2@hpe.com \
    --cc=zyjzyj2000@gmail.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;
as well as URLs for NNTP newsgroup(s).