From: Chengwen Feng <fengchengwen@huawei.com>
To: <stable@dpdk.org>, <ktraynor@redhat.com>
Cc: <david.marchand@redhat.com>
Subject: [PATCH 24.11 3/3] [PATCH 24.11] app/dma-perf: fix stopping device
Date: Tue, 25 Nov 2025 09:51:30 +0800 [thread overview]
Message-ID: <20251125015130.12867-4-fengchengwen@huawei.com> (raw)
In-Reply-To: <20251125015130.12867-1-fengchengwen@huawei.com>
[ upstream commit cca4c3bc3feb16226480ea9b3c1dc5e7f0116fee ]
The benchmark do stop-dmadev at last, it has two problem:
1. it still invoke stop-dmadev when something wrong before
config-dmadev.
2. the dmadev may working but the memory are freed.
Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
app/test-dma-perf/benchmark.c | 34 +++++++++++++++++++++++++---------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/app/test-dma-perf/benchmark.c b/app/test-dma-perf/benchmark.c
index fc583725c4..537cc7618c 100644
--- a/app/test-dma-perf/benchmark.c
+++ b/app/test-dma-perf/benchmark.c
@@ -257,6 +257,25 @@ config_dmadevs(struct test_configure *cfg)
return 0;
}
+static void
+stop_dmadev(struct test_configure *cfg, bool *stopped)
+{
+ struct lcore_dma_map_t *lcore_dma_map;
+ uint32_t i;
+
+ if (*stopped)
+ return;
+
+ if (cfg->is_dma) {
+ for (i = 0; i < cfg->num_worker; i++) {
+ lcore_dma_map = &cfg->dma_config[i].lcore_dma_map;
+ printf("Stopping dmadev %d\n", lcore_dma_map->dma_id);
+ rte_dma_stop(lcore_dma_map->dma_id);
+ }
+ }
+ *stopped = true;
+}
+
static void
error_exit(int dev_id)
{
@@ -709,6 +728,7 @@ mem_copy_benchmark(struct test_configure *cfg)
float memory = 0;
uint32_t avg_cycles = 0;
uint32_t avg_cycles_total;
+ bool dev_stopped = false;
float mops, mops_total;
float bandwidth, bandwidth_total;
uint32_t nr_sgsrc = 0, nr_sgdst = 0;
@@ -770,7 +790,7 @@ mem_copy_benchmark(struct test_configure *cfg)
vchan_dev->tdir == RTE_DMA_DIR_MEM_TO_DEV) {
if (attach_ext_buffer(vchan_dev, lcores[i], cfg->is_sg,
(nr_sgsrc/nb_workers), (nr_sgdst/nb_workers)) < 0)
- goto out;
+ goto stop_dmadev;
}
rte_eal_remote_launch(get_work_function(cfg), (void *)(lcores[i]), lcore_id);
@@ -805,6 +825,8 @@ mem_copy_benchmark(struct test_configure *cfg)
rte_eal_mp_wait_lcore();
+ stop_dmadev(cfg, &dev_stopped);
+
for (k = 0; k < nb_workers; k++) {
struct rte_mbuf **src_buf = NULL, **dst_buf = NULL;
uint32_t nr_buf_pt = nr_buf / nb_workers;
@@ -889,6 +911,8 @@ mem_copy_benchmark(struct test_configure *cfg)
cfg->scenario_id, nr_buf, memory * nb_workers,
(avg_cycles_total * (float) 1.0) / nb_workers, bandwidth_total, mops_total);
+stop_dmadev:
+ stop_dmadev(cfg, &dev_stopped);
out:
for (k = 0; k < nb_workers; k++) {
@@ -944,13 +968,5 @@ mem_copy_benchmark(struct test_configure *cfg)
lcores[i] = NULL;
}
- if (cfg->is_dma) {
- for (i = 0; i < nb_workers; i++) {
- lcore_dma_map = &cfg->dma_config[i].lcore_dma_map;
- printf("Stopping dmadev %d\n", lcore_dma_map->dma_id);
- rte_dma_stop(lcore_dma_map->dma_id);
- }
- }
-
return ret;
}
--
2.17.1
next prev parent reply other threads:[~2025-11-25 1:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 1:51 [PATCH 24.11 0/3] backport dmaperf bugfix Chengwen Feng
2025-11-25 1:51 ` [PATCH 24.11 1/3] [PATCH 24.11] vhost: fix compile error when without vduse.h Chengwen Feng
2025-11-25 10:30 ` Kevin Traynor
2025-11-26 0:39 ` fengchengwen
2025-11-25 1:51 ` [PATCH 24.11 2/3] [PATCH 24.11] app/dma-perf: fix on-flight DMA when verifying data Chengwen Feng
2025-11-25 1:51 ` Chengwen Feng [this message]
2025-11-27 11:45 ` [PATCH 24.11 0/3] backport dmaperf bugfix Kevin Traynor
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=20251125015130.12867-4-fengchengwen@huawei.com \
--to=fengchengwen@huawei.com \
--cc=david.marchand@redhat.com \
--cc=ktraynor@redhat.com \
--cc=stable@dpdk.org \
/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;
as well as URLs for NNTP newsgroup(s).