From: Qinxin Xia <xiaqinxin@huawei.com>
To: Barry Song <21cnbao@gmail.com>
Cc: <jonathan.cameron@huawei.com>, <wangzhou1@hisilicon.com>,
<iommu@lists.linux.dev>, <prime.zeng@huawei.com>,
<fanghao11@huawei.com>, <linux-kernel@vger.kernel.org>,
<linuxarm@huawei.com>
Subject: Re: [PATCH v6 3/3] tools/dma: Add dma_map_sg support
Date: Fri, 30 Jan 2026 16:38:15 +0800 [thread overview]
Message-ID: <4794d927-6de4-4283-b3ee-ee5030941a72@huawei.com> (raw)
In-Reply-To: <CAGsJ_4zkLF8Si6A0tvFNPGq2VJ8Md-Be=25K65XxSn-JWtCxbA@mail.gmail.com>
On 2026/1/26 10:51:11, Barry Song <21cnbao@gmail.com> wrote:
> On Mon, Jan 12, 2026 at 5:34 PM Qinxin Xia <xiaqinxin@huawei.com> wrote:
>>
>> Support for dma_map_sg, add option '-m' to distinguish mode.
>>
>> i) Users can set option '-m' to select mode:
>> DMA_MAP_BENCH_SINGLE_MODE=0, DMA_MAP_BENCH_SG_MODE:=1
>> (The mode is also show in the test result).
>> ii) Users can set option '-g' to set sg_nents
>> (total count of entries in scatterlist)
>> the maximum number is 1024. Each of sg buf size is PAGE_SIZE.
>> e.g
>> [root@localhost]# ./dma_map_benchmark -m 1 -g 8 -t 8 -s 30 -d 2
>> dma mapping mode: DMA_MAP_BENCH_SG_MODE
>> dma mapping benchmark: 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 mode: DMA_MAP_BENCH_SINGLE_MODE
>> dma mapping benchmark: 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
>>
>
> What happens if m is set to 0 while g is set to 8?
>
> Thanks
> Barry
Hi Barry!
m set '0' and g set '8', This means that 8 page_sizes are mapped at a
time in single mode.
As the comment for the struct map_benchmark definition says:
__u32 granule; /* how many PAGE_SIZE will do map/unmap once a time */
[root@localhost xqx]# ./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:8
average map latency(us):0.2 standard deviation:0.1
average unmap latency(us):4.3 standard deviation:1.4
======================================================
The newly added sg mode reuses the -g option as sgnents and is described
in the comments:
/*
* Set the number of scatterlist entries based on the granule.
* In SG mode, 'granule' represents the number of scatterlist
entries.
* Each scatterlist entry corresponds to a single page.
*/
By the way, I've considered testing sgnents of different sizes, but it's
not very easy to set for user parameters, so I set it with each
scatterlist entry corresponds to a single page.
Thanks,
Qinxin
next prev parent reply other threads:[~2026-01-30 8:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 9:34 [PATCH v6 0/3] dma-mapping: benchmark: Add support for dma_map_sg Qinxin Xia
2026-01-12 9:34 ` [PATCH v6 1/3] dma-mapping: benchmark: modify the framework to adapt to more map modes Qinxin Xia
2026-01-12 9:34 ` [PATCH v6 2/3] dma-mapping: benchmark: add support for dma_map_sg Qinxin Xia
2026-01-12 9:34 ` [PATCH v6 3/3] tools/dma: Add dma_map_sg support Qinxin Xia
2026-01-26 2:51 ` Barry Song
2026-01-30 8:38 ` Qinxin Xia [this message]
2026-01-30 9:16 ` Barry Song
2026-02-03 2:45 ` Qinxin Xia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4794d927-6de4-4283-b3ee-ee5030941a72@huawei.com \
--to=xiaqinxin@huawei.com \
--cc=21cnbao@gmail.com \
--cc=fanghao11@huawei.com \
--cc=iommu@lists.linux.dev \
--cc=jonathan.cameron@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=prime.zeng@huawei.com \
--cc=wangzhou1@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®