PERFORCE change 180741 for review

Alexander Fiveg pebu3op at googlemail.com
Wed Jul 14 12:32:35 UTC 2010


On Monday 12 July 2010 16:13:30 you wrote:
> On Saturday, July 10, 2010 11:09:21 pm Alexandre Fiveg wrote:
> > http://p4web.freebsd.org/@@180741?ac=10
> >
> > Change 180741 by afiveg at cottonmouth on 2010/07/11 03:08:49
> >
> > 	d_mmap is eliminated from ringmap because of very strange behavior. Now:
>
> user-space process calls read(/dev/ringmap ... ) in order get physical
> addres of ring. Then by calling mmap(/dev/mem, .... ,
> offset=ring_phys_addr) the ring will be mapped into user-space.
>
> Oof, this is not appropriate.  You should use d_mmap.  Can you provide more
> details on the problems you see with d_mmap?


yes, it was a lot of problems. The first one: 
- after calling mmap(2) (in user-space) the d_mmap() (in kernel) will be 
called TWO times! In the first run of d_mmap() the current-thread can access 
the private data that was previously set by devfs_set_cdevpriv(9) in the 
d_open(). But after the first run the  d_mmap() will somehow (unexpected) 
called again. In the second run it can NOT access private data and returns 
with error in the user-space. The call of devfs_get_cdevpriv() in the second 
run of d_mmap() returned error.

It was not really a big problem for me. The data needed in the d_mmap() is 
stored in the SLIST which head is accessible through ringmap structure. But 
traverse the SLIST in order to search our data... boring :) if we can use 
devfs_* functions.


The ringmaps kernel code is in:
//depot/projects/soc2010/ringmap/current/sys/net/ringmap.c

The ringmaps user-space code:
 //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c

Please tell me if you need more information from me. Probably some code 
examples ? 


Thanx for review,
Alex


More information about the p4-projects mailing list