public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: how does one disable processor cache on memory allocated with get_free_pages?
@ 2004-02-26 16:25 Ross Tyler
  2004-02-27 10:51 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 6+ messages in thread
From: Ross Tyler @ 2004-02-26 16:25 UTC (permalink / raw)
  To: linux-kernel

Andrew,

Thank you for taking the time to reply. I really appreciate your help.

My understanding of ioremap_nocache is that it falls short of what I 
need to do.
It is appropriate for, say, mapping physical memory on a PCI device that 
is marked prefetchable (and otherwise subject to caching when mapped 
with ioremap) as non-caching.
Can you confirm my understanding?

If so, it will not work for me as I am not mapping physical memory but 
memory allocated by get_free_pages.
Do you concur?

AFAIK, the only way to access this memory without using processor cache 
is to have a device driver memory map it for a process like 
drivers/char/mem.c does.
When the memory is accessed through these memory mapped pages, the 
access will not be cached.
When the memory is accessed through the get_free_pages pages, the access 
will be cached.
Concur?

In order to access this process mapped memory from outside the context 
of the process it was mapped for, one either needs to independently 
remap it for the current process (what to do in interrupt code?) or set 
up a kiobuf to the memory.
It has been my experience, however, that the pages referenced by the 
kiobuf are the same pages returned by get_free_pages.
I expect these same pages have the same (caching) attributes associated 
with them which would not work.
?

Again, I thank you for your support.

Andrew Morton wrote:

>Ross Tyler <retyler@raytheon.com> wrote:
>  
>
>>If so, what is the mechanism for modifying the entries and synchronizing 
>>the configuration with the processor cache?
>>    
>>
>
>The only thing we have is ioremap_nocache()
>  
>



^ permalink raw reply	[flat|nested] 6+ messages in thread
* how does one disable processor cache on memory allocated with get_free_pages?
@ 2004-02-25 23:37 Ross Tyler
  0 siblings, 0 replies; 6+ messages in thread
From: Ross Tyler @ 2004-02-25 23:37 UTC (permalink / raw)
  To: linux-kernel

I am writing a kernel module that is allocating memory using get_free_pages.
It is important that access to/from these pages not use the processor 
(Pentium 4) cache.
How can I do this?

I have looked at drivers/char/mem.c which uses a pgprot_noncached 
function to modify the vm_page_prot attribute of a vma during a mmap call.
If I understand this correctly, this would make sure that all access to 
the pages that are done through the mapping will not be cached.

This will not work for me, however, because I need to access this memory 
from the device driver independent of any user code that might mmap it.
I thought of the device driver open'ing and mmap'ing itself but it 
doesn't have a special file in the file system (I am not using DEVFS) 
and this seems kludgy.

I am hoping that there is a way to simply modify the page table entries 
for the allocated pages.
Is there?
If so, what is the mechanism for modifying the entries and synchronizing 
the configuration with the processor cache?

Please CC any response directly to me (retyler@raytheon.com).

Thanks!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-02-27 23:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-26 16:25 how does one disable processor cache on memory allocated with get_free_pages? Ross Tyler
2004-02-27 10:51 ` Benjamin Herrenschmidt
2004-02-27 15:36   ` Ross Tyler
2004-02-27 22:40     ` Benjamin Herrenschmidt
2004-02-27 23:29       ` Ross Tyler
  -- strict thread matches above, loose matches on Subject: below --
2004-02-25 23:37 Ross Tyler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox