From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alexander Duyck <alexander.duyck@gmail.com>
Cc: Sinan Kaya <okaya@codeaurora.org>, Arnd Bergmann <arnd@arndb.de>,
Jason Gunthorpe <jgg@ziepe.ca>,
David Laight <David.Laight@aculab.com>, Oliver <oohall@gmail.com>,
"open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)"
<linuxppc-dev@lists.ozlabs.org>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
Will Deacon <will.deacon@arm.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: RFC on writel and writel_relaxed
Date: Wed, 28 Mar 2018 10:43:49 +1100 [thread overview]
Message-ID: <1522194229.7364.73.camel@kernel.crashing.org> (raw)
In-Reply-To: <CAKgT0UfZKBTYPCqWtBF=N5TPFrbsv0ZU+2GHMqF3J4BM9Hw4yw@mail.gmail.com>
On Tue, 2018-03-27 at 14:54 -0700, Alexander Duyck wrote:
> On Tue, Mar 27, 2018 at 2:35 PM, Benjamin Herrenschmidt
> <benh@kernel.crashing.org> wrote:
> > On Tue, 2018-03-27 at 10:46 -0400, Sinan Kaya wrote:
> > > combined buffers.
> > >
> > > Alex:
> > > "Don't bother. I can tell you right now that for x86 you have to have a
> > > wmb() before the writel().
> >
> > No, this isn't the semantics of writel. You shouldn't need it unless
> > something changed and we need to revisit our complete understanding of
> > *all* MMIO accessor semantics.
>
> The issue seems to be that there have been two different ways of
> dealing with this. There has historically been a number of different
> drivers that have been carrying this wmb() workaround since something
> like 2002. I get that the semantics for writel might have changed
> since then, but those of us who already have the wmb() in our drivers
> will be very wary of anyone wanting to go through and remove them
> since writel is supposed to be "good enough". I would much rather err
> on the side of caution here.
>
> I view the wmb() + writel_relaxed() as more of a driver owning and
> handling this itself. Besides in the Intel Ethernet driver case it is
> better performance as our wmb() placement for us also provides a
> secondary barrier so we don't need to add a separate smp_wmb() to deal
> with a potential race we have with the Tx cleanup.
>
> > At least for UC space, it has always been accepted (and enforced) that
> > writel would not require any other barrier to order vs. previous stores
> > to memory.
>
> So the one thing I would question here is if this is UC vs UC or if
> this extends to other types as well? So for x86 we could find
> references to Write Combining being flushed by a write to UC memory,
> however I have yet to find a clear explanation of what a write to UC
> does to WB.
Well, this is the standard write memory + trigger DMA case, the one
specific case for which Linus was adamant we don't need another barrier
back then ...
> My personal inclination would be to err on the side of
> caution.
Which means writel_relaxed is now pointless ?
We need clear semantics here. In this case the "side of caution" means
we are randomly doing things not understanding what really happens and
that makes me *more* nervous.
> I just don't want us going through and removing the wmb()
> calls because it "should" work. I would want to know for certain it
> will work.
We need to know for certain anyway. Otherwise, all the drivers that do
not have wmb's are potentially broken.
So I dont agree with the status quo.
We need to establish precisely what x86 does, decide what we want the
semantic of writel to be, and implement things accordingly.
Ben.
next prev parent reply other threads:[~2018-03-27 23:44 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 21:54 RFC on writel and writel_relaxed Alexander Duyck
2018-03-27 22:35 ` Sinan Kaya
2018-03-27 23:43 ` Benjamin Herrenschmidt [this message]
[not found] <1521692689.16434.293.camel@kernel.crashing.org>
[not found] ` <CAOSf1CFv1HHCL3YOVhRn2U=grdNjaQ=A4m3xwxN2Rek1-_TySg@mail.gmail.com>
[not found] ` <1521726722.16434.312.camel@kernel.crashing.org>
[not found] ` <20180323163510.GC13033@ziepe.ca>
[not found] ` <1521854626.16434.359.camel@kernel.crashing.org>
[not found] ` <58ce5b83f40f4775bec1be8db66adb0d@AcuMS.aculab.com>
[not found] ` <20180326165425.GA15554@ziepe.ca>
[not found] ` <CAK8P3a1zeMyj+Z-y4ER4moY6Zip9EWNOinf+VnboGOrgiwbBZA@mail.gmail.com>
[not found] ` <20180326202545.GB15554@ziepe.ca>
[not found] ` <CAK8P3a3fc43ZcW626hmsd3DVcLw7hGkdUMxp7s4Rn3mdkziwMQ@mail.gmail.com>
[not found] ` <20180326210951.GD15554@ziepe.ca>
[not found] ` <CAK8P3a2UU1xAM0NLo7Q4-Xgo1SzY3De1uqpFudr+2ZW7nHEPmA@mail.gmail.com>
[not found] ` <1522101616.7364.13.camel@kernel.crashing.org>
2018-03-27 14:46 ` Sinan Kaya
2018-03-27 15:01 ` Jose Abreu
2018-03-27 15:10 ` Will Deacon
2018-03-27 18:54 ` Alexander Duyck
2018-03-27 19:54 ` Arnd Bergmann
2018-03-27 20:46 ` Arnd Bergmann
2018-03-27 21:33 ` Benjamin Herrenschmidt
2018-03-28 0:39 ` Linus Torvalds
2018-03-28 1:03 ` Benjamin Herrenschmidt
2018-03-28 2:51 ` Linus Torvalds
2018-03-28 3:24 ` Sinan Kaya
2018-03-28 4:41 ` Benjamin Herrenschmidt
2018-03-28 6:14 ` Linus Torvalds
2018-03-28 11:41 ` okaya
2018-03-28 15:13 ` Benjamin Herrenschmidt
2018-03-28 15:55 ` David Miller
2018-03-28 16:23 ` Nicholas Piggin
2018-03-28 21:31 ` Benjamin Herrenschmidt
2018-03-28 22:09 ` Nicholas Piggin
2018-03-29 9:20 ` Will Deacon
2018-03-29 13:56 ` Sinan Kaya
2018-03-29 14:04 ` David Miller
2018-03-29 16:29 ` Arnd Bergmann
2018-03-29 16:59 ` Sinan Kaya
2018-03-30 1:40 ` Benjamin Herrenschmidt
2018-04-02 13:01 ` Sinan Kaya
2018-03-28 4:33 ` Benjamin Herrenschmidt
2018-03-28 6:26 ` Linus Torvalds
2018-03-28 6:42 ` Benjamin Herrenschmidt
2018-03-28 6:53 ` Linus Torvalds
2018-03-28 6:56 ` Benjamin Herrenschmidt
2018-03-28 7:11 ` Arnd Bergmann
2018-03-28 7:42 ` Benjamin Herrenschmidt
2018-03-28 9:07 ` Will Deacon
2018-03-28 9:56 ` Benjamin Herrenschmidt
2018-03-28 11:30 ` David Laight
2018-03-28 15:12 ` Benjamin Herrenschmidt
2018-03-28 16:16 ` David Laight
2018-03-28 1:21 ` Benjamin Herrenschmidt
2018-03-27 21:35 ` Benjamin Herrenschmidt
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=1522194229.7364.73.camel@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=David.Laight@aculab.com \
--cc=alexander.duyck@gmail.com \
--cc=arnd@arndb.de \
--cc=jgg@ziepe.ca \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=okaya@codeaurora.org \
--cc=oohall@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=will.deacon@arm.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).