Re: mmap implementation for cdev

2011-12-09 Thread John Baldwin
On Saturday, December 03, 2011 5:37:01 am Filippo Sironi wrote: > I need to access the memory both from user space and kernel space, I cannot do that (simply) with an mmap or thread-specific storage if I recall correctly. You could allocate a dedicated VM object for each thread's information and

Re: mmap implementation for cdev

2011-12-03 Thread Julian Elischer
On 12/3/11 2:37 AM, Filippo Sironi wrote: I need to access the memory both from user space and kernel space, I cannot do that (simply) with an mmap or thread-specific storage if I recall correctly. that's how mmap works.. if you give it pages to expose to the user, you can still access them fro

Re: mmap implementation for cdev

2011-12-03 Thread Julian Elischer
On 12/3/11 12:42 AM, Filippo Sironi wrote: Dear all, I've a strange problem I cannot understand... I implemented a piece of code within the FreeBSD 7.2 kernel that basically allocate a per-thread memory page to store a certain amount of information that must be read and written without crossin

Re: mmap implementation for cdev

2011-12-03 Thread Poul-Henning Kamp
In message <0011fd6a-e29d-4f67-913c-897ba1b2f...@gmail.com>, Filippo Sironi wri tes: >I need to access the memory both from user space and kernel space, I = >cannot do that (simply) with an mmap or thread-specific storage if I = >recall correctly. Have you looked how shm_open(2) and friends are im

Re: mmap implementation for cdev

2011-12-03 Thread Poul-Henning Kamp
In message , Filippo Sironi wri tes: >Ok, that's what I was suspecting. >Do you have any ideas on how to get the behavior I described in the = >previous mail? Why don't you just use mmap(2) ? I couldn't see anything you couldn't do with it. There's also support in pthread for thread specific st

Re: mmap implementation for cdev

2011-12-03 Thread Poul-Henning Kamp
In message , Filippo Sironi wri tes: >The problem is that when I come = >back to user space all the threads write in memory page mapped by the = >first thread that called the mmap leaving their memory pages untouched. That's how cdev->mmap works, it is global rather than per-thread. -- Poul-He

Re: mmap implementation for cdev

2011-12-03 Thread Filippo Sironi
I need to access the memory both from user space and kernel space, I cannot do that (simply) with an mmap or thread-specific storage if I recall correctly. On 03/dic/2011, at 11.00, Poul-Henning Kamp wrote: > In message , Filippo Sironi > wri > tes: > > Why don't you just use mmap(2) ? I coul

Re: mmap implementation for cdev

2011-12-03 Thread Filippo Sironi
Ok, that's what I was suspecting. Do you have any ideas on how to get the behavior I described in the previous mail? On 03/dic/2011, at 10.16, Poul-Henning Kamp wrote: > In message , Filippo Sironi > wri > tes: > >> The problem is that when I come = >> back to user space all the threads write

mmap implementation for cdev

2011-12-03 Thread Filippo Sironi
Dear all, I've a strange problem I cannot understand... I implemented a piece of code within the FreeBSD 7.2 kernel that basically allocate a per-thread memory page to store a certain amount of information that must be read and written without crossing user to kernel and kernel to user boundari

mmap() implementation

2004-07-09 Thread thefly
Hello everybody, i'm implementing the mmap part of my nodegraph. At the moment i'm actually stuck at a point where the process can't actually access the memory allocation: this is the mmap() function: static int ng_counter_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) {