linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jes Sorensen <Jes.Sorensen@cern.ch>
To: Paul.Mackerras@cs.anu.edu.au
Cc: Geert.Uytterhoeven@cs.kuleuven.ac.be,
	linuxppc-dev@lists.linuxppc.org, linux-fbdev@vuser.vu.union.edu,
	rth@cygnus.com
Subject: Re: [linux-fbdev] Re: readl() and friends and eieio on PPC
Date: 11 Aug 1999 09:23:29 +0200	[thread overview]
Message-ID: <d34si6kcge.fsf@lxp03.cern.ch> (raw)
In-Reply-To: Paul Mackerras's message of "Wed, 11 Aug 1999 10:23:46 +1000"


>>>>> "Paul" == Paul Mackerras <paulus@cs.anu.edu.au> writes:

Paul> Jes Sorensen <Jes.Sorensen@cern.ch> wrote:
>> This is quite easily solved by putting in mb()'s in the right
>> places. This is how it is done for other drivers that are supposed
>> to work on the Alpha.

Paul> No, this is not an acceptable solution.

Paul> On ultrasparc at least, there is a "side-effect" bit in each
Paul> PTE.  If that bit is set, it tells the cpu not to reorder
Paul> accesses to that page.  I don't know whether alpha has the same
Paul> facility, do you?

No idea but I bet Richard Henderson can answer that question. I also
checked with him after posting this message yesterday and the answer
was readl/writel are not supposed to guarantee strict ordering.

Paul> Anyway, it's hard enough educating device driver writers about
Paul> the need for byte-swapping on data in memory that is accessed by
Paul> DMA.  Trying to get people to scatter mb()'s around their
Paul> drivers would be a herculean task (a bit like cleaning out the
Paul> Augean stables, actually :-).

There are quite a few issues device driver authors needs to deal with,
this is just one of them. I actually made quite an effort to explain
the problem in my tutorial at Linux Expo. Besides people still have to
deal with it when writing drivers for devices that are not mapped in
PCI space but directly mapped. Having readl/writel guarantee ordering
is inconsistant.

Paul> Finally, mb() is actually a much stronger constraint than we
Paul> need in a device driver, and will slow things down
Paul> unnecessarily.  mb() implies a strong ordering on all loads and
Paul> stores to all memory.  On the PPC, mb() translates into the sync
Paul> instruction, which is much slower than eieio.  For a sync, the
Paul> cpu actually has to stop and wait for all bus activity to
Paul> complete, whereas for an eieio, it just puts a special kind of
Paul> entry in the stream of accesses going out to the memory bus.

I don't know enough about the PPC architecture to comment on this,
however I can see that wmb() translates into an eieio. wmb() is more
fine grained and it would make sense to promote it over plain mb() in
the places where it makes sense.

>> Having mb()'s explicitly put into the driver in the right places
>> also makes sure that a driver will work on other
>> architectures. Right now a driver that is written for the PPC is
>> likely not to work on the Alpha if the author expects readl/writel
>> to guarantee write ordering.

Paul> Well, if alpha is actually like that, then IMO it is broken.

I will have to disagree with you on this one, I consider the PPC
implementation to be very broken in this regard.

Paul> So, unless and until you can show me some numbers that show an
Paul> actual performance degradation from having the eieio in
Paul> readl/writel, the eieio stays.

So will the education of people telling them to use mb() after
writel() if they want to be sure of the result.

Jes

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

  reply	other threads:[~1999-08-11  7:23 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-09  8:17 readl() and friends and eieio on PPC Geert Uytterhoeven
1999-08-09 17:19 ` David A. Gatwood
1999-08-10  1:00 ` Paul Mackerras
1999-08-10  7:18   ` [linux-fbdev] " Jes Sorensen
1999-08-11  0:23     ` Paul Mackerras
1999-08-11  7:23       ` Jes Sorensen [this message]
1999-08-11  7:38         ` Richard Henderson
1999-08-12  0:13           ` Paul Mackerras
1999-08-12  1:39             ` Peter Chang
1999-08-12  4:52               ` Paul Mackerras
1999-08-12  6:17                 ` Peter Chang
1999-08-12  0:17           ` Paul Mackerras
1999-08-12  4:40             ` Richard Henderson
1999-08-12  5:00               ` Paul Mackerras
1999-08-12  5:43                 ` Richard Henderson
1999-08-12  7:07                   ` Paul Mackerras
1999-08-12  7:33                     ` Richard Henderson
1999-08-12  9:58                       ` Paul Mackerras
1999-08-12 12:31                     ` Geert Uytterhoeven
1999-08-13 12:18                       ` Paul Mackerras
1999-08-18 11:02                       ` Gabriel Paubert
1999-08-13 18:33                     ` Richard Henderson
1999-08-12  5:16               ` David Edelsohn
1999-08-12  5:27                 ` Paul Mackerras
1999-08-12  5:52                 ` Richard Henderson
1999-08-12  7:11                   ` Paul Mackerras
1999-08-12  7:32                 ` Jes Sorensen
1999-08-11 23:52         ` Paul Mackerras
1999-08-12  7:38           ` Jes Sorensen
1999-08-12 19:00           ` David A. Gatwood
1999-08-13  1:51             ` Paul Mackerras
     [not found] <Pine.LNX.3.96.990813143741.27557B-100000@mvista.com>
     [not found] ` <d3so5mdyta.fsf@lxp03.cern.ch>
1999-08-14 18:34   ` Geert Uytterhoeven
1999-08-14 18:36   ` David A. Gatwood
1999-08-14 19:48     ` Jes Sorensen
1999-08-15  1:28       ` David A. Gatwood
1999-08-14 21:39   ` Richard Henderson
1999-08-15 23:16   ` Paul Mackerras
1999-08-16  0:29     ` Richard Henderson
1999-08-16  7:11     ` Jes Sorensen
     [not found] <m3672hkxri.fsf@soma.andreas.org>
1999-08-15 13:39 ` James Simmons
     [not found] <d3pv0p72yr.fsf@lxp03.cern.ch>
1999-08-15 19:43 ` David A. Gatwood

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=d34si6kcge.fsf@lxp03.cern.ch \
    --to=jes.sorensen@cern.ch \
    --cc=Geert.Uytterhoeven@cs.kuleuven.ac.be \
    --cc=Paul.Mackerras@cs.anu.edu.au \
    --cc=linux-fbdev@vuser.vu.union.edu \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=rth@cygnus.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).