From: Jason Gunthorpe <jgg@ziepe.ca>
To: Bernard Metzler <BMT@zurich.ibm.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Doug Ledford <dledford@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Re: Re: Re: [PATCH] rdma/siw: avoid smp_store_mb() on a u64
Date: Fri, 12 Jul 2019 12:32:43 -0300 [thread overview]
Message-ID: <20190712153243.GI27512@ziepe.ca> (raw)
In-Reply-To: <OF9F46C3F6.DC3E03FF-ON00258435.00521546-00258435.00549C01@notes.na.collabserv.com>
On Fri, Jul 12, 2019 at 03:24:09PM +0000, Bernard Metzler wrote:
>
> >To: "Bernard Metzler" <BMT@zurich.ibm.com>
> >From: "Jason Gunthorpe" <jgg@ziepe.ca>
> >Date: 07/12/2019 04:43PM
> >Cc: "Arnd Bergmann" <arnd@arndb.de>, "Doug Ledford"
> ><dledford@redhat.com>, "Peter Zijlstra" <peterz@infradead.org>,
> >linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
> >Subject: [EXTERNAL] Re: Re: Re: [PATCH] rdma/siw: avoid
> >smp_store_mb() on a u64
> >
> >On Fri, Jul 12, 2019 at 02:35:50PM +0000, Bernard Metzler wrote:
> >
> >> >This looks wrong to me.. a userspace notification re-arm cannot be
> >> >lost, so have a split READ/TEST/WRITE sequence can't possibly
> >work?
> >> >
> >> >I'd expect an atomic test and clear here?
> >>
> >> We cannot avoid the case that the application re-arms the
> >> CQ only after a CQE got placed. That is why folks are polling the
> >> CQ once after re-arming it - to make sure they do not miss the
> >> very last and single CQE which would have produced a CQ event.
> >
> >That is different, that is re-arm happing after a CQE placement and
> >this can't be fixed.
> >
> >What I said is that a re-arm from userspace cannot be lost. So you
> >can't blindly clear the arm flag with the WRITE_ONCE. It might be OK
> >beacuse of the if, but...
> >
> >It is just goofy to write it without a 'test and clear' atomic. If
> >the
> >writer side consumes the notify it should always be done atomically.
> >
> Hmmm, I don't yet get why we should test and clear atomically, if we
> clear anyway - is it because we want to avoid clearing a re-arm which
> happens just after testing and before clearing?
It is just clearer as to the intent..
Are you trying to optimize away an atomic or something? That might
work better as a dual counter scheme.
> Another complication -- test_and_set_bit() operates on a single
> bit, but we have to test two bits, and reset both, if one is
> set.
Why are two bits needed to represent armed and !armed?
Jason
next prev parent reply other threads:[~2019-07-12 15:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-12 8:51 [PATCH] rdma/siw: avoid smp_store_mb() on a u64 Arnd Bergmann
2019-07-12 11:33 ` Bernard Metzler
2019-07-12 11:47 ` Peter Zijlstra
2019-07-12 12:03 ` Jason Gunthorpe
2019-07-12 12:27 ` Bernard Metzler
2019-07-12 13:05 ` Bernard Metzler
2019-07-12 13:19 ` Peter Zijlstra
2019-07-12 13:35 ` Bernard Metzler
2019-07-12 13:22 ` Arnd Bergmann
2019-07-12 15:14 ` Jason Gunthorpe
2019-07-12 20:24 ` Arnd Bergmann
2019-07-12 13:53 ` Jason Gunthorpe
2019-07-12 14:35 ` Bernard Metzler
2019-07-12 14:42 ` Jason Gunthorpe
2019-07-12 15:24 ` Bernard Metzler
2019-07-12 15:32 ` Jason Gunthorpe [this message]
2019-07-12 17:40 ` Bernard Metzler
2019-07-12 17:45 ` Jason Gunthorpe
2019-07-12 18:06 ` Bernard Metzler
2019-07-12 16:12 ` Peter Zijlstra
2019-07-25 17:23 ` 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=20190712153243.GI27512@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=BMT@zurich.ibm.com \
--cc=arnd@arndb.de \
--cc=dledford@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=peterz@infradead.org \
/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