GithubHelp home page GithubHelp logo

Comments (2)

jeremytrimble avatar jeremytrimble commented on August 22, 2024

Mike,

I think the reasoning for this is because there's no guarantee that the userspace buffer (which appears to be contiguous inside the userspace process's virtual memory) is actually physically contiguous. In fact, if you have a 512 Mbyte buffer I'm almost sure that it isn't physically-contiguous -- on Zynq systems I've worked with, 4 MB was the maximum physically-contiguous allocation that was possible without special accomodations (e.g. the CMA -- contiguous memory allocator).

4096 bytes is the size of a single page (the smallest unit of contiguous allocation), so allocating buf_size/4096 is kind of assuming worst-case (every page is physically discontiguous). I suspect with a little bit of logic after calling get_user_pages() it would be possible to compute exactly how many scatterlist entries are required (one for each contiguous section), and only allocate that many entries in sg_alloc_table().

from ezdma.

Livius90 avatar Livius90 commented on August 22, 2024

Hi Jeremy,
I'm trying to DMA very large buffers (512M byte if I can) into memory. I seem to run into a memory problem for sg_alloc_table if I try to create a DMA buffer > 1Mbyte. I believe I just have too many entries in the sg table.
My AXI DMA core is configured with 23bit addressing for the scatter/gather engine which should allow for individual DMA blocks of up to 8MByte each, so it should be possible to describe the 512 MByte buffer with just 64 chained entries. Looking at the ezdma driver it seems like you are allocating blocks of 4096 bytes for each of the scatterlist entries. Is there a way to allocate 8Mbyte blocks for each of the scatterlist entries so I can reduce the number of them?

Thanks Mike.

Root cause of your problem is that there is a hard-coded limitation in the Linux kernel driver xilinx_dma.c.

https://github.com/Xilinx/linux-xlnx/blob/xilinx-v2020.2/drivers/dma/xilinx/xilinx_dma.c#L181

#define XILINX_DMA_NUM_DESCS		255

You need to make a patch for Linux kernel and increase this max desc num, for example to 8*255 or more for your 8MB demand and it should works.

from ezdma.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.