Discussion:
mmap'ed memory cacheable or uncheable
Teresa Tao
2003-07-25 03:26:59 UTC
Permalink
Hi there,

I got a question regarding the mmap'ed memory. Is the mmap'ed memory cacheable or uncheable? My driver just use the remap_page_range to map a reserved physical memory.

Thanks in advance!

Teresa
Jun Sun
2003-07-25 22:02:24 UTC
Permalink
Post by Teresa Tao
Hi there,
I got a question regarding the mmap'ed memory. Is the mmap'ed memory cacheable or uncheable? My driver just use the remap_page_range to map a reserved physical memory.
I am pretty much sure it is cached, although I can't pin down exactly
where in the mm subsystem it does so - I have had cache bugs related
to mmap().

Jun
Teresa Tao
2003-07-25 22:52:33 UTC
Permalink
How about if I specify the following flags in my mmap routine just like what the pgprot_noncached micro did.
pgprot_val(vma->vm_page_prot) &= ~_CACHE_MASK;
pgprot_val(vma->vm_page_prot) |= _CACHE_UNCACHED;

Will this have kernel make the mmap'd memory non-cacheable? Or is there a mmap non-cacheable patch?

Thanks in advance!

Teresa



-----Original Message-----
From: Jun Sun [mailto:***@mvista.com]
Sent: Friday, July 25, 2003 3:02 PM
To: Teresa Tao
Cc: linux-***@linux-mips.org; ***@mvista.com
Subject: Re: mmap'ed memory cacheable or uncheable
Post by Teresa Tao
Hi there,
I got a question regarding the mmap'ed memory. Is the mmap'ed memory cacheable or uncheable? My driver just use the remap_page_range to map a reserved physical memory.
I am pretty much sure it is cached, although I can't pin down exactly
where in the mm subsystem it does so - I have had cache bugs related
to mmap().

Jun
Jun Sun
2003-07-28 21:24:01 UTC
Permalink
Post by Teresa Tao
How about if I specify the following flags in my mmap routine just like what the pgprot_noncached micro did.
pgprot_val(vma->vm_page_prot) &= ~_CACHE_MASK;
pgprot_val(vma->vm_page_prot) |= _CACHE_UNCACHED;
Will this have kernel make the mmap'd memory non-cacheable? Or is there a mmap non-cacheable patch?
I think this might work. Did you try it? The performance will be bad
though as mmap() is used widely by userland.

Jun
Maciej W. Rozycki
2003-07-29 16:09:43 UTC
Permalink
Post by Jun Sun
Post by Teresa Tao
How about if I specify the following flags in my mmap routine just like what the pgprot_noncached micro did.
pgprot_val(vma->vm_page_prot) &= ~_CACHE_MASK;
pgprot_val(vma->vm_page_prot) |= _CACHE_UNCACHED;
Will this have kernel make the mmap'd memory non-cacheable? Or is there a mmap non-cacheable patch?
I think this might work. Did you try it? The performance will be bad
though as mmap() is used widely by userland.
See mmap_mem() for how to select between cached and uncached mmap()ing
cleanly.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: ***@ds2.pg.gda.pl, PGP key available +
Ralf Baechle
2003-07-31 11:31:21 UTC
Permalink
Post by Teresa Tao
I got a question regarding the mmap'ed memory. Is the mmap'ed memory
cacheable or uncheable? My driver just use the remap_page_range to map
a reserved physical memory.
Mmap(2) creates cachable mappings for everything below the highest memory
address and uncached above that. That's a somewhat naive mechanism
which fails a few systems but somehow nobody did complain so far ...

Ralf

Loading...