Re: mmap coherency kernel to user

From: Wolfgang Mes (wolfgang_at_iksw-muees.de)
Date: 08/31/05


Date: Wed, 31 Aug 2005 19:08:58 +0200

Hi eransha,

eransha wrote:
> I have written a driver that implements mmap using the nopage method.
> I handle the nopage simply by supplying a page that i get from
> get_free_page.
>
> As a user I'm using mmap (share mode) to get the page. I write to the
> memory, then I cout its contents (in user mode), then I invoke an ioctl
> that simply prints the content of the first bytes of the page, from the
> kernel point of view.
>
> The problem is that the kernel doesn't get updated often enough. i.e.
> if I wait a second and invoke the ioctl I might see the new value, but
> if I don't wait at all I see an older value.
>
> I guess the problem has to do with cache coherency, but I couldn't find
> a way to solve it

I don't think it is a cache problem. After all, the cache is the same for
user and kernel space.

Post some code.

best regards
Wolfgang