From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Brian Waite <linwoes@gmail.com>
Cc: "Mark A. Greer" <mgreer@mvista.com>,
Adrian Cox <adrian@humboldt.co.uk>,
linuxppc-dev list <linuxppc-dev@lists.linuxppc.org>
Subject: Re: [PATCH] Workaround for 745x data corruption bug
Date: Thu, 05 Aug 2004 08:43:34 +1000 [thread overview]
Message-ID: <1091659414.1862.148.camel@gaston> (raw)
In-Reply-To: <36b714c8040804103826917da1@mail.gmail.com>
On Thu, 2004-08-05 at 03:38, Brian Waite wrote:
> Ben,
>
> So what kind of aliasing issues do you forsee uner 2.4?
The problem is that the kernel maps all RAM (or as much as it can fit
into 2 BATs) using BATs for the linear mapping at c0000000. This mapping
is cacheable.
If you map, even temporarily, part of your RAM as uncacheable (for DMA
purposes), you end up having 2 different mappings of the same physical
addresses, one cacheable, one non cacheable. The problem is that you may
have
1) stale data for these physical addresses from before the mapping
(you have to take care of that by flushing the cache over the area
when creating the non-cacheable mapping)
2) CPU speculative load or HW prefetch (most likely speculative load)
can bring some of those data into the cache via the cacheable
mapping even though you are not actually reading from the affected
pages, but only from one nearby (like the one just before).
In both cases, you end up with the possibility that you try to do a non
cacheable access to some space that is also aliased in your cache
somewhere.
This is an undefined behaviour as far as the CPU is concerned. For
example, I think a POWER4 or a G5 will checkstop. I'm not sure what will
happen with the various 74xx but it's definitely not something you can
rely on working properly.
You can of course try to completely avoid non-cacheable mappings and
only do explicit cache invalidate/flushes around DMA operations, but
that would prevent proper implementation of dma_alloc_coherent(), and
I wish you good luck trying to get something like a USB OHCI driver
working with such a scheme.
The solution would be to get rid of the BAT mapping, at least for the
D-BAT, at the expense of kernel performances (possibly significant here)
. The I-BAT must remain though, which can be an issue, I'm not sure how
things will work out at the L2 and L3 caches level...
Ben.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
prev parent reply other threads:[~2004-08-04 22:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-31 16:27 [PATCH] Workaround for 745x data corruption bug Adrian Cox
2004-08-01 2:53 ` Benjamin Herrenschmidt
2004-08-02 15:20 ` Kumar Gala
2004-08-02 21:40 ` Benjamin Herrenschmidt
2004-08-02 18:20 ` Mark A. Greer
2004-08-02 21:47 ` Sven Luther
2004-08-03 13:17 ` Brian Waite
2004-08-03 21:55 ` Mark A. Greer
2004-08-04 14:37 ` Brian Waite
2004-08-04 17:55 ` Mark A. Greer
2004-08-04 20:39 ` Adrian Cox
2004-08-04 0:45 ` Benjamin Herrenschmidt
2004-08-04 17:38 ` Brian Waite
2004-08-04 22:43 ` Benjamin Herrenschmidt [this message]
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=1091659414.1862.148.camel@gaston \
--to=benh@kernel.crashing.org \
--cc=adrian@humboldt.co.uk \
--cc=linuxppc-dev@lists.linuxppc.org \
--cc=linwoes@gmail.com \
--cc=mgreer@mvista.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).