Re: [OT] Wrapping memory.

Jamie Lokier (lk@tantalophile.demon.co.uk)
Tue, 4 Dec 2001 16:39:50 +0000


Russell King wrote:
> On Mon, Dec 03, 2001 at 09:11:18AM +0000, David Woodhouse wrote:
> > ARM used to just break, but I pointed it out to Russell a while ago and I
> > believe he fixed it. I don't remember what his fix was - it may have been
> > just to map the offending page uncached, which is also a fairly effective
> > was of avoiding cache aliasing :)
>
> We actually still map the pages as cached, but when update_mmu_cache
> detects that a page has been mmapped more than once, we ensure that
> the other mappings in the current mm will fault when accessed.

It should be possible, in a "portable" program, to map the two pages you
want and then test to see whether they are aliasing correctly.

Write to one and read from the other page, and vice versa. Repeat a few
thousand times just in case you were interrupted in the middle.

That is my approach to creating circular buffers (which is the question
which started this thread).

Unfortunately, the update_mmu_cache makes aliasing work properly while
ruining performence, so then it's better to not to use the mapping trick
at all in that case. To check for this, I have to call gettimeofday()
between pairs of accesses, to check whether they are slow. I don't know
for sure if this works because I don't have an ARM to try it on.

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/