[PATCH v7 0/3] dma-mapping: benchmark: Add support for dma_map_sg

Qinxin Xia posted 3 patches 1 month, 1 week ago
include/uapi/linux/map_benchmark.h |  13 +-
kernel/dma/map_benchmark.c         | 246 ++++++++++++++++++++++++++---
tools/dma/dma_map_benchmark.c      |  23 ++-
3 files changed, 254 insertions(+), 28 deletions(-)
[PATCH v7 0/3] dma-mapping: benchmark: Add support for dma_map_sg
Posted by Qinxin Xia 1 month, 1 week ago
Modify the framework to adapt to more map modes, add benchmark
support for dma_map_sg, and add support sg map mode in ioctl.
 
The result:
[root@localhost]# ./dma_map_benchmark -m 1 -g 8 -t 8 -s 30 -d 2
dma mapping benchmark(SG_MODE): threads:8 seconds:30 node:-1 dir:FROM_DEVICE granule/sg_nents: 8
average map latency(us):1.4 standard deviation:0.3
average unmap latency(us):1.3 standard deviation:0.3
[root@localhost]# ./dma_map_benchmark -m 0 -g 8 -t 8 -s 30 -d 2
dma mapping benchmark(SINGLE_MODE): threads:8 seconds:30 node:-1 dir:FROM_DEVICE granule/sg_nents: 8
average map latency(us):1.0 standard deviation:0.3
average unmap latency(us):1.3 standard deviation:0.5 

---
Changes since V6:
- Address the comments from Barry, update the comment of the granule.
- Link: https://lore.kernel.org/lkml/20260112093436.3456315-1-xiaqinxin@huawei.com/

Changes since V5:
- Address the comments from Barry, the incorrect and unnecessary 'prepare_data' judgment
  is deleted and renamed 'prepare_data()' to 'initialize_data()'. The mode and
  other parameters in the output print are placed in the same print. In addition, the incorrect
  map_mode judgment in ioctrl and the wrong path in sg:prepare() does not release 'params' is fixed.
- Link: https://lore.kernel.org/all/20251222153246.2220659-1-xiaqinxin@huawei.com/

Changes since V4:
- Address the comments from Barry and Jonathan, irrelevant patches are deleted and
  the original cache processing logic is restored with add prepare_data().
- Link: https://lore.kernel.org/all/20250614143454.2927363-3-xiaqinxin@huawei.com/

Changes since V3:
- Address the comments from Barry, change mode to a more specific namespace.
- Link: https://lore.kernel.org/all/20250509020238.3378396-1-xiaqinxin@huawei.com/

Changes since V2:
- Address the comments from Barry and ALOK, some commit information and function
  input parameter names are modified to make them more accurate.
- Link: https://lore.kernel.org/all/20250506030100.394376-1-xiaqinxin@huawei.com/

Changes since V1:
- Address the comments from Barry, added some comments and changed the unmap type to void.
- Link: https://lore.kernel.org/lkml/20250212022718.1995504-1-xiaqinxin@huawei.com/

Qinxin Xia (3):
  dma-mapping: benchmark: modify the framework to adapt to more map
    modes
  dma-mapping: benchmark: add support for dma_map_sg
  tools/dma: Add dma_map_sg support

 include/uapi/linux/map_benchmark.h |  13 +-
 kernel/dma/map_benchmark.c         | 246 ++++++++++++++++++++++++++---
 tools/dma/dma_map_benchmark.c      |  23 ++-
 3 files changed, 254 insertions(+), 28 deletions(-)

-- 
2.33.0
Re: [PATCH v7 0/3] dma-mapping: benchmark: Add support for dma_map_sg
Posted by Marek Szyprowski 1 month ago
On 25.02.2026 10:37, Qinxin Xia wrote:
> Modify the framework to adapt to more map modes, add benchmark
> support for dma_map_sg, and add support sg map mode in ioctl.
>   
> The result:
> [root@localhost]# ./dma_map_benchmark -m 1 -g 8 -t 8 -s 30 -d 2
> dma mapping benchmark(SG_MODE): threads:8 seconds:30 node:-1 dir:FROM_DEVICE granule/sg_nents: 8
> average map latency(us):1.4 standard deviation:0.3
> average unmap latency(us):1.3 standard deviation:0.3
> [root@localhost]# ./dma_map_benchmark -m 0 -g 8 -t 8 -s 30 -d 2
> dma mapping benchmark(SINGLE_MODE): threads:8 seconds:30 node:-1 dir:FROM_DEVICE granule/sg_nents: 8
> average map latency(us):1.0 standard deviation:0.3
> average unmap latency(us):1.3 standard deviation:0.5

Applied to dma-mapping-next. Thanks! Next time please CC: me directly.


> ---
> Changes since V6:
> - Address the comments from Barry, update the comment of the granule.
> - Link: https://lore.kernel.org/lkml/20260112093436.3456315-1-xiaqinxin@huawei.com/
>
> Changes since V5:
> - Address the comments from Barry, the incorrect and unnecessary 'prepare_data' judgment
>    is deleted and renamed 'prepare_data()' to 'initialize_data()'. The mode and
>    other parameters in the output print are placed in the same print. In addition, the incorrect
>    map_mode judgment in ioctrl and the wrong path in sg:prepare() does not release 'params' is fixed.
> - Link: https://lore.kernel.org/all/20251222153246.2220659-1-xiaqinxin@huawei.com/
>
> Changes since V4:
> - Address the comments from Barry and Jonathan, irrelevant patches are deleted and
>    the original cache processing logic is restored with add prepare_data().
> - Link: https://lore.kernel.org/all/20250614143454.2927363-3-xiaqinxin@huawei.com/
>
> Changes since V3:
> - Address the comments from Barry, change mode to a more specific namespace.
> - Link: https://lore.kernel.org/all/20250509020238.3378396-1-xiaqinxin@huawei.com/
>
> Changes since V2:
> - Address the comments from Barry and ALOK, some commit information and function
>    input parameter names are modified to make them more accurate.
> - Link: https://lore.kernel.org/all/20250506030100.394376-1-xiaqinxin@huawei.com/
>
> Changes since V1:
> - Address the comments from Barry, added some comments and changed the unmap type to void.
> - Link: https://lore.kernel.org/lkml/20250212022718.1995504-1-xiaqinxin@huawei.com/
>
> Qinxin Xia (3):
>    dma-mapping: benchmark: modify the framework to adapt to more map
>      modes
>    dma-mapping: benchmark: add support for dma_map_sg
>    tools/dma: Add dma_map_sg support
>
>   include/uapi/linux/map_benchmark.h |  13 +-
>   kernel/dma/map_benchmark.c         | 246 ++++++++++++++++++++++++++---
>   tools/dma/dma_map_benchmark.c      |  23 ++-
>   3 files changed, 254 insertions(+), 28 deletions(-)
>
Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Re: [PATCH v7 0/3] dma-mapping: benchmark: Add support for dma_map_sg
Posted by Qinxin Xia 1 month ago

On 2026/3/6 16:50:56, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>> dma mapping benchmark(SG_MODE): threads:8 seconds:30 node:-1 dir:FROM_DEVICE granule/sg_nents: 8
>> average map latency(us):1.4 standard deviation:0.3
>> average unmap latency(us):1.3 standard deviation:0.3
>> [root@localhost]# ./dma_map_benchmark -m 0 -g 8 -t 8 -s 30 -d 2
>> dma mapping benchmark(SINGLE_MODE): threads:8 seconds:30 node:-1 dir:FROM_DEVICE granule/sg_nents: 8
>> average map latency(us):1.0 standard deviation:0.3
>> average unmap latency(us):1.3 standard deviation:0.5
> Applied to dma-mapping-next. Thanks! Next time please CC: me directly.
Thank you for applying the patch. I apologize for not CC-ing you
directly earlier; I'll make sure to do so next time.:-)

-- 
Thanks,
Qinxin
Re: [PATCH v7 0/3] dma-mapping: benchmark: Add support for dma_map_sg
Posted by Barry Song 1 month, 1 week ago
On Wed, Feb 25, 2026 at 5:38 PM Qinxin Xia <xiaqinxin@huawei.com> wrote:
>
> Modify the framework to adapt to more map modes, add benchmark
> support for dma_map_sg, and add support sg map mode in ioctl.
>
> The result:
> [root@localhost]# ./dma_map_benchmark -m 1 -g 8 -t 8 -s 30 -d 2
> dma mapping benchmark(SG_MODE): threads:8 seconds:30 node:-1 dir:FROM_DEVICE granule/sg_nents: 8
> average map latency(us):1.4 standard deviation:0.3
> average unmap latency(us):1.3 standard deviation:0.3
> [root@localhost]# ./dma_map_benchmark -m 0 -g 8 -t 8 -s 30 -d 2
> dma mapping benchmark(SINGLE_MODE): threads:8 seconds:30 node:-1 dir:FROM_DEVICE granule/sg_nents: 8
> average map latency(us):1.0 standard deviation:0.3
> average unmap latency(us):1.3 standard deviation:0.5
>

+ Marek,

Hi Marek,

Would you be willing to pick up Qinxin's series into the dma-mapping
tree? I think that would be helpful, at least for my
"dma-mapping: arm64: support batched cache sync" series[1] and for
potential further optimizations to dma_map_sg().

[1] https://lore.kernel.org/lkml/20251226225254.46197-1-21cnbao@gmail.com/


Thanks
Barry
Re: [PATCH v7 0/3] dma-mapping: benchmark: Add support for dma_map_sg
Posted by Marek Szyprowski 1 month ago
On 25.02.2026 11:42, Barry Song wrote:
> On Wed, Feb 25, 2026 at 5:38 PM Qinxin Xia <xiaqinxin@huawei.com> wrote:
>> Modify the framework to adapt to more map modes, add benchmark
>> support for dma_map_sg, and add support sg map mode in ioctl.
>>
>> The result:
>> [root@localhost]# ./dma_map_benchmark -m 1 -g 8 -t 8 -s 30 -d 2
>> dma mapping benchmark(SG_MODE): threads:8 seconds:30 node:-1 dir:FROM_DEVICE granule/sg_nents: 8
>> average map latency(us):1.4 standard deviation:0.3
>> average unmap latency(us):1.3 standard deviation:0.3
>> [root@localhost]# ./dma_map_benchmark -m 0 -g 8 -t 8 -s 30 -d 2
>> dma mapping benchmark(SINGLE_MODE): threads:8 seconds:30 node:-1 dir:FROM_DEVICE granule/sg_nents: 8
>> average map latency(us):1.0 standard deviation:0.3
>> average unmap latency(us):1.3 standard deviation:0.5
>>
> + Marek,
>
> Hi Marek,
>
> Would you be willing to pick up Qinxin's series into the dma-mapping
> tree? I think that would be helpful, at least for my
> "dma-mapping: arm64: support batched cache sync" series[1] and for
> potential further optimizations to dma_map_sg().
>
> [1] https://lore.kernel.org/lkml/20251226225254.46197-1-21cnbao@gmail.com/

I would be easier for me to track that work if I were on CC:, but I will 
take it.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland