[parisc-linux] Re: Problems with kernel mmap (failing tst-mmap-eofsync in glibc on parisc)

David S. Miller davem@redhat.com
Fri, 22 Aug 2003 09:14:47 -0700


On 22 Aug 2003 09:40:37 -0500
James Bottomley <James.Bottomley@SteelEye.com> wrote:

> This test essentially opens a file (via open(2)), writes something,
> opens it via a mmaped file object *read only* (via fopen(...,"rm)) reads
> what was writtent, writes some more and reads it via the mmaped file
> object.
> 
> This last read fails to get the data on parisc.  The problem is that our
> CPU cache is virtually indexed, and the page the write is storing the
> data to (in the buffer cache) and the page it is mmapped to have the
> same physical, but different virtual addresses.  We need the write() to
> trigger a cache update via flush_dcache_page to get the virtually
> indexed cache in sync.
> 
> The reason this doesn't happen is because the mapping is not on the
> mmap_shared list that flush_dcache_page() updates.

flush_dcache_page() checks both the shared and non-shared mmap lists,
so if it is on _either_ list it is flushed.  It does not check only
the shared list.

The VM_SHARED change you are proposing is definitely wrong.