cudaram - a block device exposing nvidia gpus ram implemented with cuda

Piotr Jaroszyński p.jaroszynski at gmail.com
Tue Mar 1 17:41:18 EST 2011


Hello,

as my first real(silly) linux project I have implemented a block
device that can expose the gpu ram available on nvidia cards while not
interfering with normal gpu chores. That was achieved by a userspace
daemon that uses cuda to manage the gpu ram and a linux kernel module
to proxy the I/O requests to it. The longer story is at [1] and the
code is at [2].

As I am pretty new to kernel hacking I would really appreciate you
looking at the code and pointing out the problems.

Apart from that I have a few specific questions:
- Can the make_request function (set with blk_queue_make_request) be
called from interrupt context? Should I be using spin_lock_irq in it?
- see [3]
- Is reading a pointer member variable of a struct atomic? - see [4]
- Are there any safe ways for userspace and kernel to communicate when
handling swapping? E.g. If the userspace is mlockall()ed, is calling a
syscall that doesn't sleep safe?

[1] - http://blog.piotrj.org/2011/03/cudaram-block-device-exposing-nvidia.html
[2] - https://github.com/peper/cudaram
[3] - https://github.com/peper/cudaram/blob/master/kmod/cudaram.c#L81
[4] - https://github.com/peper/cudaram/blob/master/kmod/cudaram.c#L420

-- 
Best Regards
Piotr Jaroszyński



More information about the Kernelnewbies mailing list