Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Correct handling of the IO_MMAP message in the resource manager: (3 Items)
   
Correct handling of the IO_MMAP message in the resource manager  
io_mmap and io_mmap_default documentation really tells nothing about how to handle these messages by self in the 
resource manager to let the user application to mmap some resource manager's address space.

My resource manager handles hardware device, which provides a lot of PCI memory. User application needs to read and to 
write directly to the mmap'ed PCI device memory because data transfer amount is really huge, and using devctl's data 
passing via messages is not a good solution for the one or two megabytes of data, it is real performance issue and 
causes high CPU load.

I want to use an "offset" and "len" arguments of the mmap() function and corresponding to them _io_mmap structure's 
field "offset" to control which device memory region user application wants to mmap in its address space. But _io_mmap 
structure doesn't contain len field and it is not clear how resource manager knows how many bytes will be mmaped.

Also a bit obscured _io_mmap_reply structure, which contains only one not "Reserved for future use" member named "coid".
 It is not clear how I can return connection ID to the already mmaped memory region :-/

I'm not sure now, that this common for the generic OSes, trick is supported under QNX.

I'm in total confusion. Any suggestions will be appreciated.

P.S. I can see only one solution right now: to pass physical addresses between user application and resource manager, 
and both will mmap the same region with different rights.
Re: Correct handling of the IO_MMAP message in the resource manager  
You can't do what you are trying to do with a mmap() of an external device.

What you CAN do is to have your resource manager make a shared object which overlays the physical memory (SHMCTL_PHYS)
that you want to grant access to the client, pass back pass back the path to that.

Mike Gorchak wrote:
> io_mmap and io_mmap_default documentation really tells nothing about how to handle these messages by self in the 
resource manager to let the user application to mmap some resource manager's address space.
> 
> My resource manager handles hardware device, which provides a lot of PCI memory. User application needs to read and to
 write directly to the mmap'ed PCI device memory because data transfer amount is really huge, and using devctl's data 
passing via messages is not a good solution for the one or two megabytes of data, it is real performance issue and 
causes high CPU load.
> 
> I want to use an "offset" and "len" arguments of the mmap() function and corresponding to them _io_mmap structure's 
field "offset" to control which device memory region user application wants to mmap in its address space. But _io_mmap 
structure doesn't contain len field and it is not clear how resource manager knows how many bytes will be mmaped.
> 
> Also a bit obscured _io_mmap_reply structure, which contains only one not "Reserved for future use" member named "coid
". It is not clear how I can return connection ID to the already mmaped memory region :-/
> 
> I'm not sure now, that this common for the generic OSes, trick is supported under QNX.
> 
> I'm in total confusion. Any suggestions will be appreciated.
> 
> P.S. I can see only one solution right now: to pass physical addresses between user application and resource manager, 
and both will mmap the same region with different rights.
> 
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post20672
> 

-- 
cburgess@qnx.com
Re: Correct handling of the IO_MMAP message in the resource manager  
I see. Thank you, Colin! Your advice a bit better than pass back physical address instead of shared object name.