From: Arjan van de Ven <arjan@infradead.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jeff Garzik <jeff@garzik.org>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel <linux-kernel@vger.kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>,
"David S. Miller" <davem@davemloft.net>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [patch] x86, voyager: fix ioremap_nocache()
Date: Mon, 28 Apr 2008 08:07:00 -0700 [thread overview]
Message-ID: <20080428080700.4190f5e6@laptopd505.fenrus.org> (raw)
In-Reply-To: <1209392948.3367.13.camel@localhost.localdomain>
On Mon, 28 Apr 2008 10:29:08 -0400
James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
> On Mon, 2008-04-28 at 07:10 -0700, Arjan van de Ven wrote:
> > On Sun, 27 Apr 2008 18:39:24 -0400
> > Jeff Garzik <jeff@garzik.org> wrote:
> >
> > > James Bottomley wrote:
> > > > Here's another piece of the x86 API that's designed to be
> > > > cached. The dma_declare_coherent_memory() usually represents
> > > > behind bridge memory that's fully participatory in the
> > > > coherence model.
> > > >
> > > > Making it uncached damages the utility of this memory because
> > > > doing cacheline sized burst cycles when needed to it is far
> > > > faster than individual byte/word/quad writes.
> > > >
> > > > Signed-off-by: James Bottomley
> > > > <James.Bottomley@HansenPartnership.com>
> > > >
> > > > ---
> > > >
> > > > diff --git a/arch/x86/kernel/pci-dma.c
> > > > b/arch/x86/kernel/pci-dma.c index 388b113..df83ffd 100644
> > > > --- a/arch/x86/kernel/pci-dma.c
> > > > +++ b/arch/x86/kernel/pci-dma.c
> > > > @@ -214,7 +214,7 @@ int dma_declare_coherent_memory(struct
> > > > device *dev, dma_addr_t bus_addr,
> > > > /* FIXME: this routine just ignores
> > > > DMA_MEMORY_INCLUDES_CHILDREN */
> > > > - mem_base = ioremap(bus_addr, size);
> > > > + mem_base = ioremap_cache(bus_addr, size);
> > > > if (!mem_base)
> > > > goto out;
> >
> > this patch patch is likely broken on x86; or rather, anyone who
> > uses it is... thinking you can find cache coherent memory on a PCI
> > or similar bus that is actually cachable... keep dreaming. (for
> > now; there's talk about extending PCI)
>
> No ... it works for me, and caching is a performance advantage for me
> too. The only current consumer of this API is the NCR_Q720 SCSI card
> which keeps a bunch of cacheable memory remote across the MCA bus.
>
> If you think about it logically, most busses are second citizens in
> the caching hierarchy: they really only get to force a flush and
> invalidate of the CPU cache line rather than being fully
> participatory in the coherence protocol.
Cached means that the cpu, at any time, can do a speculative read to the memory.
It also means that the cpu can then write the speculated cacheline back at any time later,
if some speculation was going to write to the cacheline but didn't actually happen.
(before you think this is bogus, at least AMD cpus do this and I can't vouch for Intel
cpus never doing this).
If the on-the-bus hardware *ever* writes to the memory without being part of the full
cache coherence protocol it's in trouble. Big time.
Even if it sends an invalidate first (which PCI and others just don't allow, not sure about MCA though),
it's not enough because the cpu can just read it right back... one needs a "take for ownership" not
an "invalidate" for this to work, and that means being part of the full protocol.
> However, even being second
> class is enough of a speed up on slow busses because it allows
> bursting of the cache line for the bus transfers.
that's write combining not cachability I suspect... at least for writes it is.
>
> The other consumers are SoC embedded ... so yes, perhaps I should ask
> about this on linux-arch.
x86 SoC ? (we're talking about an arch/x86 file here)
Esp in SoC people don't bother doing cache coherency if they can get away
with it.
--
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
next prev parent reply other threads:[~2008-04-28 15:07 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-27 20:51 Breakage caused by unreviewed patch in x86 tree James Bottomley
2008-04-27 20:53 ` David Miller
2008-04-27 21:48 ` [patch] x86, voyager: fix ioremap_nocache() Ingo Molnar
2008-04-27 22:05 ` James Bottomley
2008-04-27 22:36 ` Willy Tarreau
2008-04-27 22:41 ` Ingo Molnar
2008-04-27 23:18 ` Ingo Molnar
2008-04-27 23:31 ` David Miller
2008-04-28 0:31 ` Rik van Riel
2008-04-28 0:45 ` Al Viro
2008-04-28 0:52 ` H. Peter Anvin
2008-04-28 9:01 ` Alan Cox
2008-04-28 9:17 ` David Miller
2008-04-28 9:48 ` Adrian Bunk
2008-04-28 11:50 ` Ingo Molnar
2008-04-28 6:10 ` Christoph Hellwig
2008-04-28 16:55 ` H. Peter Anvin
2008-04-27 22:34 ` James Bottomley
2008-04-27 22:39 ` Jeff Garzik
2008-04-27 22:44 ` H. Peter Anvin
2008-04-27 22:46 ` David Miller
2008-04-27 22:52 ` H. Peter Anvin
2008-04-27 22:58 ` David Miller
2008-04-27 23:04 ` H. Peter Anvin
2008-04-30 20:35 ` Eric W. Biederman
2008-04-27 23:34 ` Jeff Garzik
2008-04-27 23:39 ` H. Peter Anvin
2008-04-27 22:53 ` Jeff Garzik
2008-04-27 22:56 ` H. Peter Anvin
2008-04-27 22:59 ` David Miller
2008-04-27 23:02 ` Jeff Garzik
2008-04-27 23:14 ` Arjan van de Ven
2008-04-27 23:01 ` Arjan van de Ven
2008-04-30 21:44 ` James Bottomley
2008-04-30 22:39 ` H. Peter Anvin
2008-04-27 23:01 ` Thomas Gleixner
2008-04-28 14:10 ` Arjan van de Ven
2008-04-28 14:29 ` James Bottomley
2008-04-28 15:07 ` Arjan van de Ven [this message]
2008-04-28 19:59 ` H. Peter Anvin
2008-04-27 22:00 ` Breakage caused by unreviewed patch in x86 tree H. Peter Anvin
2008-04-27 22:10 ` James Bottomley
2008-04-27 22:13 ` H. Peter Anvin
2008-04-27 22:18 ` James Bottomley
2008-04-27 22:31 ` H. Peter Anvin
2008-04-27 22:58 ` Arjan van de Ven
2008-04-27 23:00 ` David Miller
2008-04-27 23:07 ` Arjan van de Ven
2008-04-27 23:03 ` James Bottomley
2008-04-27 23:11 ` Arjan van de Ven
2008-04-27 23:17 ` H. Peter Anvin
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=20080428080700.4190f5e6@laptopd505.fenrus.org \
--to=arjan@infradead.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=davem@davemloft.net \
--cc=hpa@zytor.com \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®