[lkml]   [2019]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: Re: Re: [PATCH] rdma/siw: avoid smp_store_mb() on a u64
-----"Peter Zijlstra" <> wrote: -----

>To: "Bernard Metzler" <>
>From: "Peter Zijlstra" <>
>Date: 07/12/2019 03:19PM
>Cc: "Jason Gunthorpe" <>, "Arnd Bergmann"
><>, "Doug Ledford" <>,
>Subject: [EXTERNAL] Re: Re: [PATCH] rdma/siw: avoid smp_store_mb() on
>a u64
>On Fri, Jul 12, 2019 at 01:05:14PM +0000, Bernard Metzler wrote:
>> @@ -1131,6 +1131,10 @@ int siw_poll_cq(struct ib_cq *base_cq, int
>num_cqe, struct ib_wc *wc)
>> * number of not reaped CQE's regardless of its notification
>> * type and current or new CQ notification settings.
>> *
>> + * This function gets called only by kernel consumers.
>> + * Notification state must immediately become visible to all
>> + * associated kernel producers (QP's).
>No amount of memory barriers can achieve that goal.
Oh right, that is correct. And it is not needed. This statement
is to bold. We simply want it asap. Actually, per API semantics, there is
no ordering guarantee between creating a completion queue event and
concurrently arming/disarming the completion queue. Since it is
not possible.
I use the barrier to minimize the likelihood a CQ event is missed
since the CQ is not yet visible to be re-armed to all producers.
But it can happen. This is what this optional
IB_CQ_REPORT_MISSED_EVENTS right below the re-arming is for.

Would be OK if we just adapt the comment from 'must immediately become visible'
to 'shall become visible asap'. That would reflect the intention.

Thanks very much!

int siw_req_notify_cq(struct ib_cq *base_cq, enum ib_cq_notify_flags flags)
struct siw_cq *cq = to_siw_cq(base_cq);

siw_dbg_cq(cq, "flags: 0x%02x\n", flags);
* Enable CQ event for next solicited completion.
* and make it visible to all associated producers.
smp_store_mb(cq->notify->flags, SIW_NOTIFY_SOLICITED);
* Enable CQ event for any signalled completion.
* and make it visible to all associated producers.
smp_store_mb(cq->notify->flags, SIW_NOTIFY_ALL);
return cq->cq_put - cq->cq_get;
return 0;
 \ /
  Last update: 2019-07-12 15:36    [W:0.095 / U:28.808 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site