Re: O_DIRECT patch for processors with VIPT cache for mainline kernel (specifically arm in our case)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Russell King - ARM Linux
Date: Thursday, November 20, 2008 - 9:30 am

On Thu, Nov 20, 2008 at 01:55:58PM +0000, Ralf Baechle wrote:

Yes, we effectively already do that for our copy_user_highpage/
clear_user_highpage (note: we really want to override both of those
functions, not just one as the code in include/linux/highmem.h is
currently setup.  And I wish that V4L didn't use the non-highmem
clear_user_page() call...)

Why?  On ARM, we're starting to support highmem on VIVT and VIPT, and
having *_user_highpage() kmap, and then have the *_user_page() setup
yet another mapping for VIPT caches is just silly.

Which reminds me that I need to get a patch to make clear_user_highpage()
overridable out on the relevent lists...


The "no locking needed" depends.  If we're going to be asking drivers
to copy use such an interface in order to copy data into page cache
pages, you can't have two drivers calling it from interrupt context
without some form of locking.

Nor if you're SMP and you don't have the mappings setup per-CPU.

However, as davem has said in the past, the result of a device reading
or writing the page cache should result in the same conditions no
matter how the read or write is actually done.  That's only common
sense.  So ensuring that device PIO accesses are done with the same
cache colour as userspace results in a difference between PIO and DMA,
one which could potentially bite if we end up reading from the kernel
mapping of those pages first.

If we extend the argument that "everything must be the same cache colour"
then we need cache colouring when allocating page cache pages - since
page cache pages are part of the kernel direct mapped memory, their
colour is already fixed from the time that you've setup the initial
kernel memory mappings.  In ARMs case of an aliasing VIPT cache, that
means that VA [13:12] must equal PA [13:12] for every single mapping
no matter where...

That would be nice, since we don't then have to worry about aliases
between kernel and userspace anymore, so we don't have to play these
remapping games in kernel space. ;)
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: O_DIRECT patch for processors with VIPT cache for main ..., Russell King - ARM Linux, (Wed Nov 19, 1:43 pm)
Re: O_DIRECT patch for processors with VIPT cache for main ..., Russell King - ARM Linux, (Thu Nov 20, 2:19 am)
Re: O_DIRECT patch for processors with VIPT cache for main ..., Russell King - ARM Linux, (Thu Nov 20, 9:30 am)
Re: O_DIRECT patch for processors with VIPT cache for main ..., Russell King - ARM Linux, (Thu Nov 20, 12:30 pm)