Re: allocation failed: out of vmalloc space error treating and VIDEO1394 IOC LISTEN CHANNEL ioctl failed problem

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

 



  Hi,

> I think you've convinced me that vmalloc is not a good choice when a
> driver needs a large buffer (many megabytes) for DMA.

Yep.  bttv used to do that long time ago, and some people used to run
into trouble because the nvidia driver used lots of vmalloc address
space ...

> In this case, we need a large ring buffer for reception of isochronous
> packets from a firewire device.  If I understand you correctly, you are
> suggesting that this buffer be obtained as followed:
> 
> 1. Application performs malloc() in user-space and mmap()s it.
> 2. Driver uses vmalloc_to_page() on every page of the malloc'ed memory
> and constructs a scatter-gather list.
> 3. Map the sg list with pci_map_sg().
> 4. Commence DMA.

video4linux drivers do this:

 (1) app opens /dev/video0
 (2) app issues some ioctls to set buffer count, format and size
 (3) app uses mmap(/dev/video0) to map the buffers.

Buffer memory is simple userspace memory, it is allocated by the nopage
handler.  Memory is pinned down by get_user_pages().

> Are there some other convenience
> functions that can be used?

Look at drivers/media/video/video-buf.c, that is the buffer management
code shared by v4l drivers.  It should at least give an idea how it
works, not sure you can actually reuse the code.  Chances are not too
bad though, it is used not only for video buffers, but also for audio
and mpeg2 data, so it could be generic enough to fit your needs too.

cheers,
  Gerd

-- 
Gerd Hoffmann <[email protected]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux