2

I want to reserve a large amount (~1 gigabyte) of contiguous memory for DMA from a device. The entire purpose of this particular Linux box is to run a single application which uses the device. The device does large transfers of ~10-200MB per operation.

To be clear, put up this question for the next guy. Expect to have an answer somewhat shortly.

4
  • To be clear, the Linux kernel has well-described support for allocating DMA buffers. The problem is with large buffers. This seems to be a continuing topic. lwn.net/Kernel/Index/#Memory_management-Large_allocations There are distinct large-allocations use cases. General purpose use is hard and (so far) unsolved. Specialized cases are more solvable. This question and answers are good, but fail to distinguish use-cases. unix.stackexchange.com/questions/37729/… Commented Jul 27, 2020 at 17:00
  • Also check wiki.debian.org/Hugepages Commented Jul 27, 2020 at 17:52
  • In my case, I want to have four 256MB blocks for DMA from the device. The device is an FPGA with streams from four sources at ~4GB/s each. No need for any sort of general purpose pool (how I read CMA) - in fact reason not. Pattern of allocation is fixed. Commented Jul 27, 2020 at 23:23
  • For completeness, will note I used memmap=4G!4G successfully for a time. Most of the development team is in fact still using this version. Then the FPGA design entirely changed, so I am now using the Xilinx XDMA driver for transfers to and from FPGA attached DDR4. The upside is no kernel parameters needed. Commented Mar 27, 2022 at 0:19

1 Answer 1

1

I don't think you'll be able to. Instead, you'll have to "fake it" as described here.

The last time I checked (it's been a while), the CMA hadn't been ported to x86 from ARM yet. Even then, that big a buffer is unlikely to work out for you.

2
  • Yes, I think the answer is in the direction of adding "memmap=1G$4G" as a kernel boot parameter. Still walking through how to use that reserved 1GB of memory. Commented Jul 27, 2020 at 23:25
  • Yes, that horrible answer was also to get large FPGA DMA pools. Commented Jul 28, 2020 at 13:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .