Re: Kernel-userspace shared mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike Tyson wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

G'day!

I'm building a system that consists of an 'interface' kernel module, and
a user daemon that does all the work, connected by megabytes of mmap()'d
memory:

             ______
            |     |
            |     |
            |daem-|
            | on  |
            |_____|
               ||
               || mmap()'d memory
            ___||___                  user space
 ___________|______| <- char dev_____
 |          |      |                |
 |          | modu-|                | kernel space
 |          |  le  |                |



I'm after a mutex mechanism that will protect this area, that's
accessible from both user-space and the kernel.

Before I go ahead and do so, has anyone else been in a similar
situation, or heard of any similar system?
Could there be an alternative I've missed?

   V4L2 uses mmap between the char device and the user proces, as the
data transfer is really huge.
   For synchronization it uses IOCTL's. There are two ways  1) mmap and
2) user-ptr. In the first one the buffers are managed by the kernel and
in the second one the buffers are managed by the user-process. In both
the cases ioctls QBUF ( Queue buffer ) and DQBUF (Dequeue buffer) are
used. In mmap capture case the user process waits ( using select or
poll) for capture to occur and then gets the buffer(dequeue's)  when
capture is finished. It releases back the buffer using when its nolonger
required. In user-ptr capture case , user-process queues the buffer and
uses select to wait and then dequeues the buffer.

   For more details look at the V4L2 API specification 3rd chapter
http://v4l2spec.bytesex.org/spec/
  Also look at the capture example
http://v4l2spec.bytesex.org/spec/capture-example.html

I am not familiar with network drivers. I don't know whether any of the network drivers are using this.

Vikesh






--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux