[U-Boot] [PATCH] ARM926: Add mb to the cache invalidate/flush

Albert ARIBAUD albert.u.boot at aribaud.net
Thu Oct 11 07:31:46 CEST 2012


Hi Marek,

On Wed, 10 Oct 2012 00:44:29 +0200, Marek Vasut <marex at denx.de> wrote:

> Add memory barrier to cache invalidate and flush calls.

Memory barrier...

"You keep using that word. I do not think it means what you think it
means." :)

A memory barrier's effect is only that all of the volatile accesses
placed before it in the source code finish when the barrier executes,
and that none of the volatile accesses placed after it in the source
code starts before the barrier has executed.

Non-volatile accesses are not guaranteed to stay on one side of the
barrier, and the barrier itself is not guaranteed to stay put during
optimizations.

If what you intended was to ensure that e.g. all writes be finished
when a flush occurs, or that no read happens before an invalide has
executed, then adding memory clobbers is not an adequate solution.

If you were aiming for something else entirely, please don't hesitate
to develop a description of the problem you wish to solve.

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list