Re: [PATCH] mm: D-cache aliasing issue in cow_user_page

From: Matt Reimer
Date: Wed Dec 06 2006 - 16:20:01 EST


On 12/5/06, David Miller <davem@xxxxxxxxxxxxx> wrote:
From: "Matt Reimer" <mattjreimer@xxxxxxxxx>
Date: Tue, 5 Dec 2006 16:57:12 -0800

> Right, but isn't he declaring that each architecture needs to take
> care of this? So, say, on ARM we'd need to make kunmap() not a NOP and
> call flush_dcache_page() ?

No. He is only solving a problem that occurs on HIGHMEM
configurations on systems which can have D-cache aliasing
issues.

Are you sure? James specifically mentions "non-highmem architectures,"
and "all architectures with coherence issues," which would seem to
include ARM (which is my concern).

For your convenience I quote the whole commit message below.

Matt

[PATCH] update to the kernel kmap/kunmap API

Give non-highmem architectures access to the kmap API for the purposes of
overriding (this is what the attached patch does).

The proposal is that we should now require all architectures with coherence
issues to manage data coherence via the kmap/kunmap API. Thus driver
writers never have to write code like

kmap(page)
modify data in page
flush_kernel_dcache_page(page)
kunmap(page)

instead, kmap/kunmap will manage the coherence and driver (and filesystem)
writers don't need to worry about how to flush between kmap and kunmap.

For most architectures, the page only needs to be flushed if it was
actually written to *and* there are user mappings of it, so the best
implementation looks to be: clear the page dirty pte bit in the kernel page
tables on kmap and on kunmap, check page->mappings for user maps, and then
the dirty bit, and only flush if it both has user mappings and is dirty.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/