From: Dominic Sweetman <dom@algor.co.uk>
To: Jason Gunthorpe <jgg@debian.org>
Cc: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>,
linux-mips@fnet.fr, linux-mips@oss.sgi.com
Subject: Re: [patch] linux 2.4.17: An mb() rework
Date: Fri, 1 Feb 2002 08:55:10 GMT [thread overview]
Message-ID: <200202010855.IAA00394@mudchute.algor.co.uk> (raw)
In-Reply-To: <Pine.LNX.3.96.1020131180511.14195A-100000@wakko.deltatee.com>
> > > No, a sync will still empty the write buffer. It may halt the
> > >pipeline for many (~80 perhaps) cycles while posted write data is
> > >dumped to the system controller.
> >
> > Then it's an implementation bug. For a CPU in the UP mode "sync"
> > is only defined to prevent write and read reordering -- there is
> > nothing about flushing.
>
> Did some more research + phoning.. RM7K is definately documented to dump
> the write buffer on 'sync'.
The RM7000 sync does more than is required by the ISA. However, since
the write-buffer is not part of the architecture, this is not a bug.
Though it might well be held to be undesirable.
And there has to be *some* way to force the write buffer to empty, and
this is cheaper than the standard alternative of an uncached read.
I believe the RM7000 write buffer can hold one pending cache-line
writeback or up to four uncached writes. Emptying the write buffer
can only occupy more than a handful of cycles when the system
controller is already backed-up with pending writes; under those
circumstances the system was probably about to stall anyway, so I
wouldn't be too worried about the performance implications of a
'sync'.
> The RM7K guide even has an example (7.8.5)
> where it implies that sync also forces a write back of any dirty cache
> lines - gah! (Hard to belive though..)
There's not a word of truth in that (there just aren't the right wires
in the hardware to make that possible). But I think what it means is
that it stops the CPU until a pending cache line write back is
complete. It's hard to see why that would be useful, but since it
uses the same write buffer hardware it's easy to see why it would happen.
Of course (as everyone has been piling in and pointing out) the real
problems are:
1. The MIPS people who invented 'sync' had a much more sophisticated
understanding of read/write behaviour than is common in those
who support, document and program uniprocessor "embedded" CPUs; so
there's lots of scope for misunderstanding 'sync'.
2. When write-posting bites you, it's usually not in the CPU but
somewhere further down the system. You should never believe a write
has actually arrived at the device you sent it to, until you see
the device itself change state...
And a plea: the word "flush" in Linux is already abused for caches
(where it means invalidate, write back, or possibly both). That's
enough trouble: if you also "flush" write buffers, your confusion will
be complete. Maybe we should leave "flush" to plumbers and use more
precise terminology for computers...
--
Dominic Sweetman,
Algorithmics Ltd
The Fruit Farm, Ely Road, Chittering, CAMBS CB5 9PH, ENGLAND
phone: +44 1223 706200 / fax: +44 1223 706250 / direct: +44 1223 706205
http://www.algor.co.uk
next prev parent reply other threads:[~2002-02-01 9:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-30 14:56 [patch] linux 2.4.17: An mb() rework Maciej W. Rozycki
2002-01-30 20:02 ` Jason Gunthorpe
2002-01-31 12:17 ` Maciej W. Rozycki
2002-01-31 20:35 ` Jason Gunthorpe
2002-01-31 21:50 ` Maciej W. Rozycki
2002-02-01 6:44 ` Jason Gunthorpe
2002-02-01 8:55 ` Dominic Sweetman [this message]
2002-02-01 12:04 ` Maciej W. Rozycki
2002-02-01 9:52 ` Hartvig Ekner
2002-02-01 9:52 ` Hartvig Ekner
2002-02-01 12:01 ` Maciej W. Rozycki
2002-01-31 23:38 ` Alan Cox
2002-01-31 23:38 ` Alan Cox
2002-02-01 12:27 ` Maciej W. Rozycki
2002-02-02 12:09 ` Maciej W. Rozycki
2002-02-04 17:02 ` Ralf Baechle
2002-02-05 10:33 ` Maciej W. Rozycki
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=200202010855.IAA00394@mudchute.algor.co.uk \
--to=dom@algor.co.uk \
--cc=jgg@debian.org \
--cc=linux-mips@fnet.fr \
--cc=linux-mips@oss.sgi.com \
--cc=macro@ds2.pg.gda.pl \
/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