[RFC] mmaping with VIVT cache

Russell King - ARM Linux linux at arm.linux.org.uk
Fri Sep 17 17:06:49 EDT 2010


On Fri, Sep 17, 2010 at 12:07:50PM -0700, P F wrote:
> From your comment, I take it that there is no kernel API to invalidate the
> cache of a range in a VMA.  Do you think linux-mm would be a more
> appropriate forum to continue investigating?  Any input would be
> appreciated.

That's not really the point.  To implement an API in terms of "it
invalidates a range in a VMA" is absurd when you have a kernel
supporting VIVT, VIVT with an address space tag, VIPT, VIPT with
address space tag, PIPT, etc.  Does it mean you have to invalidate
for every different kind of cache?  If you define it in terms of
"invalidates a range in a VMA" then yes it does - even if a cache
architecture doesn't need it.

It's much better to define APIs in terms of their purpose - such as
"we're tearing down MMU mappings, so flush this range in the VMA".
That allows implementations to say "do I need to do anything when
this operation occurs?  No - I can optimize it away."

The problem we face is that you wouldn't port a Unix-like OS to a
CPU with VIVT caches if you were in a sane state of mind...  It
is the worst for aliasing issues, such as the one you've found.  As
ARM is the only Linux arch which has VIVT caches, we trip over many
of these issues.

However, in this case, architectures using VIPT aliasing caches will
also trip over it - has anyone used this webcam on something like
Sparc or powerpc?  I'm guessing that it'll fail there too...



More information about the linux-arm-kernel mailing list