* [PATCH 24.11 0/3] backport dmaperf bugfix
@ 2025-11-25 1:51 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
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Chengwen Feng @ 2025-11-25 1:51 UTC (permalink / raw)
To: stable, ktraynor; +Cc: david.marchand
This patchset contain two dmaperf bugfix backport, and also include
one commit which will lead to compile error of vduse.h
Chengwen Feng (3):
vhost: fix compile error when without vduse.h
app/dma-perf: fix on-flight DMA when verifying data
app/dma-perf: fix stopping device
app/test-dma-perf/benchmark.c | 89 ++++++++++++++++++++++++-----------
lib/vhost/vduse.h | 2 +-
2 files changed, 62 insertions(+), 29 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 24.11 1/3] [PATCH 24.11] vhost: fix compile error when without vduse.h 2025-11-25 1:51 [PATCH 24.11 0/3] backport dmaperf bugfix Chengwen Feng @ 2025-11-25 1:51 ` Chengwen Feng 2025-11-25 10:30 ` Kevin Traynor 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 ` (2 subsequent siblings) 3 siblings, 1 reply; 7+ messages in thread From: Chengwen Feng @ 2025-11-25 1:51 UTC (permalink / raw) To: stable, ktraynor; +Cc: david.marchand Fix compile error when don't set VHOST_HAS_VDUSE. Fixes: 0ea4b51e84ce ("vhost: fix external buffer in VDUSE") Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> --- lib/vhost/vduse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vhost/vduse.h b/lib/vhost/vduse.h index 353f297d5a..e923aeac56 100644 --- a/lib/vhost/vduse.h +++ b/lib/vhost/vduse.h @@ -17,7 +17,7 @@ int vduse_device_destroy(const char *path); #else static inline int -vduse_device_create(const char *path, bool compliant_ol_flags, bool extbuf, bool linearbuf); +vduse_device_create(const char *path, bool compliant_ol_flags, bool extbuf, bool linearbuf) { RTE_SET_USED(compliant_ol_flags); RTE_SET_USED(extbuf); -- 2.17.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 24.11 1/3] [PATCH 24.11] vhost: fix compile error when without vduse.h 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 0 siblings, 1 reply; 7+ messages in thread From: Kevin Traynor @ 2025-11-25 10:30 UTC (permalink / raw) To: Chengwen Feng, stable; +Cc: david.marchand On 25/11/2025 01:51, Chengwen Feng wrote: > Fix compile error when don't set VHOST_HAS_VDUSE. > > Fixes: 0ea4b51e84ce ("vhost: fix external buffer in VDUSE") > > Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> > --- > lib/vhost/vduse.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/vhost/vduse.h b/lib/vhost/vduse.h > index 353f297d5a..e923aeac56 100644 > --- a/lib/vhost/vduse.h > +++ b/lib/vhost/vduse.h > @@ -17,7 +17,7 @@ int vduse_device_destroy(const char *path); > #else > > static inline int > -vduse_device_create(const char *path, bool compliant_ol_flags, bool extbuf, bool linearbuf); > +vduse_device_create(const char *path, bool compliant_ol_flags, bool extbuf, bool linearbuf) > { > RTE_SET_USED(compliant_ol_flags); > RTE_SET_USED(extbuf); Ah, thanks for finding this. This was a mistake in rebasing for 24.11 that was not caught as the VHOST_HAS_VDUSE is set. The commit referenced is not pushed yet, so I will fix it directly there before push, rather than introducing the issue and then fixing it. Thanks again for catching it, Kevin. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 24.11 1/3] [PATCH 24.11] vhost: fix compile error when without vduse.h 2025-11-25 10:30 ` Kevin Traynor @ 2025-11-26 0:39 ` fengchengwen 0 siblings, 0 replies; 7+ messages in thread From: fengchengwen @ 2025-11-26 0:39 UTC (permalink / raw) To: Kevin Traynor, stable; +Cc: david.marchand On 11/25/2025 6:30 PM, Kevin Traynor wrote: > On 25/11/2025 01:51, Chengwen Feng wrote: >> Fix compile error when don't set VHOST_HAS_VDUSE. >> >> Fixes: 0ea4b51e84ce ("vhost: fix external buffer in VDUSE") >> >> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> >> --- >> lib/vhost/vduse.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/lib/vhost/vduse.h b/lib/vhost/vduse.h >> index 353f297d5a..e923aeac56 100644 >> --- a/lib/vhost/vduse.h >> +++ b/lib/vhost/vduse.h >> @@ -17,7 +17,7 @@ int vduse_device_destroy(const char *path); >> #else >> >> static inline int >> -vduse_device_create(const char *path, bool compliant_ol_flags, bool extbuf, bool linearbuf); >> +vduse_device_create(const char *path, bool compliant_ol_flags, bool extbuf, bool linearbuf) >> { >> RTE_SET_USED(compliant_ol_flags); >> RTE_SET_USED(extbuf); > > Ah, thanks for finding this. This was a mistake in rebasing for 24.11 > that was not caught as the VHOST_HAS_VDUSE is set. > > The commit referenced is not pushed yet, so I will fix it directly there > before push, rather than introducing the issue and then fixing it. Okay, I happened to compile dpdk on the old kernel which don't support vduse. > > Thanks again for catching it, > Kevin. > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 24.11 2/3] [PATCH 24.11] app/dma-perf: fix on-flight DMA when verifying data 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 1:51 ` Chengwen Feng 2025-11-25 1:51 ` [PATCH 24.11 3/3] [PATCH 24.11] app/dma-perf: fix stopping device Chengwen Feng 2025-11-27 11:45 ` [PATCH 24.11 0/3] backport dmaperf bugfix Kevin Traynor 3 siblings, 0 replies; 7+ messages in thread From: Chengwen Feng @ 2025-11-25 1:51 UTC (permalink / raw) To: stable, ktraynor; +Cc: david.marchand [ upstream commit d1b3b669674a17c58eabf3d631b21aaad7232403 ] There maybe on-flight DMA when verify_data() because the DMA device may still working when worker exit. This commit add wait DMA complete stage before worker exit. 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 | 55 +++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/app/test-dma-perf/benchmark.c b/app/test-dma-perf/benchmark.c index c08c5c8dc6..fc583725c4 100644 --- a/app/test-dma-perf/benchmark.c +++ b/app/test-dma-perf/benchmark.c @@ -19,7 +19,6 @@ #define MAX_DMA_CPL_NB 255 #define TEST_WAIT_U_SECOND 10000 -#define POLL_MAX 1000 #define CSV_LINE_DMA_FMT "Scenario %u,%u,%s,%u,%u,%u,%u,%.2lf,%" PRIu64 ",%.3lf,%.3lf\n" #define CSV_LINE_CPU_FMT "Scenario %u,%u,NA,NA,NA,%u,%u,%.2lf,%" PRIu64 ",%.3lf,%.3lf\n" @@ -282,6 +281,40 @@ do_dma_submit_and_poll(uint16_t dev_id, uint64_t *async_cnt, worker_info->total_cpl += nr_cpl; } +static int +do_dma_submit_and_wait_cpl(uint16_t dev_id, uint64_t async_cnt) +{ +#define MAX_WAIT_MSEC 1000 +#define MAX_POLL 1000 +#define DEQ_SZ 64 + enum rte_dma_vchan_status st; + uint32_t poll_cnt = 0; + uint32_t wait_ms = 0; + uint16_t nr_cpl; + + rte_dma_submit(dev_id, 0); + + if (rte_dma_vchan_status(dev_id, 0, &st) < 0) { + rte_delay_ms(MAX_WAIT_MSEC); + goto wait_cpl; + } + + while (st == RTE_DMA_VCHAN_ACTIVE && wait_ms++ < MAX_WAIT_MSEC) { + rte_delay_ms(1); + rte_dma_vchan_status(dev_id, 0, &st); + } + +wait_cpl: + while ((async_cnt > 0) && (poll_cnt++ < MAX_POLL)) { + nr_cpl = rte_dma_completed(dev_id, 0, MAX_DMA_CPL_NB, NULL, NULL); + async_cnt -= nr_cpl; + } + if (async_cnt > 0) + PRINT_ERR("Error: wait DMA %u failed!\n", dev_id); + + return async_cnt == 0 ? 0 : -1; +} + static inline int do_dma_plain_mem_copy(void *p) { @@ -293,10 +326,8 @@ do_dma_plain_mem_copy(void *p) const uint32_t buf_size = para->buf_size; struct rte_mbuf **srcs = para->srcs; struct rte_mbuf **dsts = para->dsts; - uint16_t nr_cpl; uint64_t async_cnt = 0; uint32_t i; - uint32_t poll_cnt = 0; int ret; worker_info->stop_flag = false; @@ -327,13 +358,7 @@ do_dma_plain_mem_copy(void *p) break; } - rte_dma_submit(dev_id, 0); - while ((async_cnt > 0) && (poll_cnt++ < POLL_MAX)) { - nr_cpl = rte_dma_completed(dev_id, 0, MAX_DMA_CPL_NB, NULL, NULL); - async_cnt -= nr_cpl; - } - - return 0; + return do_dma_submit_and_wait_cpl(dev_id, async_cnt); } static inline int @@ -349,8 +374,6 @@ do_dma_sg_mem_copy(void *p) const uint16_t dev_id = para->dev_id; uint32_t nr_buf = para->nr_buf; uint64_t async_cnt = 0; - uint32_t poll_cnt = 0; - uint16_t nr_cpl; uint32_t i, j; int ret; @@ -386,13 +409,7 @@ do_dma_sg_mem_copy(void *p) break; } - rte_dma_submit(dev_id, 0); - while ((async_cnt > 0) && (poll_cnt++ < POLL_MAX)) { - nr_cpl = rte_dma_completed(dev_id, 0, MAX_DMA_CPL_NB, NULL, NULL); - async_cnt -= nr_cpl; - } - - return 0; + return do_dma_submit_and_wait_cpl(dev_id, async_cnt); } static inline int -- 2.17.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 24.11 3/3] [PATCH 24.11] app/dma-perf: fix stopping device 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 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 2025-11-27 11:45 ` [PATCH 24.11 0/3] backport dmaperf bugfix Kevin Traynor 3 siblings, 0 replies; 7+ messages in thread From: Chengwen Feng @ 2025-11-25 1:51 UTC (permalink / raw) To: stable, ktraynor; +Cc: david.marchand [ 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 24.11 0/3] backport dmaperf bugfix 2025-11-25 1:51 [PATCH 24.11 0/3] backport dmaperf bugfix Chengwen Feng ` (2 preceding siblings ...) 2025-11-25 1:51 ` [PATCH 24.11 3/3] [PATCH 24.11] app/dma-perf: fix stopping device Chengwen Feng @ 2025-11-27 11:45 ` Kevin Traynor 3 siblings, 0 replies; 7+ messages in thread From: Kevin Traynor @ 2025-11-27 11:45 UTC (permalink / raw) To: Chengwen Feng, stable On 25/11/2025 01:51, Chengwen Feng wrote: > This patchset contain two dmaperf bugfix backport, and also include > one commit which will lead to compile error of vduse.h > > Chengwen Feng (3): > vhost: fix compile error when without vduse.h > app/dma-perf: fix on-flight DMA when verifying data > app/dma-perf: fix stopping device > > app/test-dma-perf/benchmark.c | 89 ++++++++++++++++++++++++----------- > lib/vhost/vduse.h | 2 +- > 2 files changed, 62 insertions(+), 29 deletions(-) > Thanks Chengwen. I applied the dma-perf patches to 24.11 branch. Kevin. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-11-27 11:45 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 ` [PATCH 24.11 3/3] [PATCH 24.11] app/dma-perf: fix stopping device Chengwen Feng 2025-11-27 11:45 ` [PATCH 24.11 0/3] backport dmaperf bugfix Kevin Traynor
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).