Leon Romanovsky began his session at the 2025 Linux Storage, Filesystem, Memory Management, and BPF Summit (LSFMM+BPF) by explaining that the improved DMA-mapping API that he has been working on is a group effort. He, Chaitanya Kulkarni, Christoph Hellwig, Jason Gunthorpe, and others are proposing to modernize the API and to "make it more suitable for current kernels". He told the assembled storage and filesystem developers that the progress on the proposal has stalled, but that it was the basis for further work in various areas, so he hoped to find a way to move forward with it.
Leon Romanovsky 在 2025 年 Linux 存储、文件系统、内存管理与 BPF 峰会(LSFMM+BPF)上开始了他的议题,他解释称他正在推进的 DMA 映射 API 改进工作是一个团队合作的成果。他、Chaitanya Kulkarni、Christoph Hellwig、Jason Gunthorpe 等人正在提议对该 API 进行现代化改造,使其“更适合当前内核”。他告诉在场的存储与文件系统开发者,这项提议目前进展停滞,但它是多个领域进一步工作的基础,因此他希望找到继续推进的方法。
The existing DMA API is based on struct page, which is fine, but using DMA requires scatter-gather (SG) lists, so there is a lot of conversion between the two formats. In addition, many DMA users have their own formats for the data being transferred, leading to more conversions (between SG and native formats).
现有的 DMA API 是基于 struct page
的,这本身没有问题,但使用 DMA 需要散布-聚集(SG)列表,因此在这两种格式之间存在大量转换。此外,许多 DMA 用户还采用了各自的数据传输格式,进一步导致了 SG 与本地格式之间的更多转换。
A struct scatterlist has two fields that are supposed to contain a CPU address (page_link) and a DMA address (dma_address) but various (ab)uses of the scatterlist have changed the meanings of those fields. For peer-to-peer DMA, page_link is a synthetic CPU address used to get information from the page structure, he said. For dma-buf usage, page_link is null and dma_address is synthetic in order to access the device-private memory. Hellwig pointed out that the dma-buf usage is explicitly invalid according to the documentation, but "the dma-buf people did it anyway and refused to fix it".
struct scatterlist
有两个字段:一个原本应该是 CPU 地址(page_link
),另一个是 DMA 地址(dma_address
),但由于 scatterlist 被各种方式(滥用)使用,这两个字段的含义已经发生变化。他表示,对于点对点 DMA,page_link
是一个合成的 CPU 地址,用于从页结构中获取信息;而在 dma-buf 的用法中,page_link
是空的,而 dma_address
是一个合成地址ÿ