This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] SK-AM69:dma_alloc_attrs ()分配的内存上的内存损坏。

Guru**** 2394305 points
Other Parts Discussed in Thread: SK-AM69

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1492146/sk-am69-memory-corruption-on-dma_alloc_attrs-allocated-memories

器件型号:SK-AM69

工具与软件:

您好!

我正在处理一个需要为 DMA 分配内存的项目。
在处理该问题时、所分配的存储器似乎存在内存损坏。

因此、我们制作了一些程序来测试它。

e2e.ti.com/.../dma_5F00_bridge.tar.gz

每个程序的工作方式如下

-内核模块

1.在给定 ioctl (DMA_BRIDGE_ALLOC)时分配存储器。
2.在给出 ioctl 时打印存储器。

-用户空间应用程序

1.使用 ioctl (dma_bridge_alLOC)请求内核模块分配。
2.通过 mmap ()函数将 magic 值(0xbeef0000)写入分配的内存。
3.在用户空间中打印存储器、并 使用 ioctl (dma_bridge_data_dump_in_kernel)请求内核模块转储。

执行结果和问题描述如下。

问题#1 -设备驱动程序上的内存转储显示全为零。 它应该是幻数。
问题#2 -用户空间上的内存转储有时显示为零。 它应该是幻数。

此问题仅在 SK-AM69上出现。
我已经在其他 ARM 板和 x86计算机上测试了此代码。

如果我使用 dma_alloc_相干()进行分配、结果是相同的。

此致、

Minsoo