* [PATCH v3] app/dma-perf: fix physical address seg-fault
@ 2023-10-19 4:16 Vipin Varghese
2023-10-19 7:13 ` fengchengwen
0 siblings, 1 reply; 5+ messages in thread
From: Vipin Varghese @ 2023-10-19 4:16 UTC (permalink / raw)
To: cheng1.jiang, stable, anoobj, jerinj, dev
do_cpu_mem_copy uses DPDK API rte_mbuf_data_iova to return
the start of the virtual address for both src and dst.
But in case of iova mode set as PA, this results in seg-fault.
This is because rte_memcpy uses VA address and not PA.
This fix invokes `rte_pktmbuf_mtod` for both src and dst.
Bugzilla ID: 1269
Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
Cc: cheng1.jiang@intel.com
Cc: stable@dpdk.org
Signed-off-by: Vipin Varghese <vipin.varghese@amd.com>
Suggested-by: Anoob Joseph <anoobj@marvell.com>
Suggested-by: Jerin Jacob <jerinj@marvell.com>
---
v2:
- suggest use of pktmbuf_mtod for both va and pa by Anoob.
V3:
- add const to src suggested by Jerin.
---
app/test-dma-perf/benchmark.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/test-dma-perf/benchmark.c b/app/test-dma-perf/benchmark.c
index 0601e0d171..9b1f58c78c 100644
--- a/app/test-dma-perf/benchmark.c
+++ b/app/test-dma-perf/benchmark.c
@@ -288,10 +288,11 @@ do_cpu_mem_copy(void *p)
while (1) {
for (i = 0; i < nr_buf; i++) {
+ const void *src = rte_pktmbuf_mtod(dsts[i], void *);
+ void *dst = rte_pktmbuf_mtod(srcs[i], void *);
+
/* copy buffer form src to dst */
- rte_memcpy((void *)(uintptr_t)rte_mbuf_data_iova(dsts[i]),
- (void *)(uintptr_t)rte_mbuf_data_iova(srcs[i]),
- (size_t)buf_size);
+ rte_memcpy(dst, src, (size_t)buf_size);
worker_info->total_cpl++;
}
if (worker_info->stop_flag)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] app/dma-perf: fix physical address seg-fault
2023-10-19 4:16 [PATCH v3] app/dma-perf: fix physical address seg-fault Vipin Varghese
@ 2023-10-19 7:13 ` fengchengwen
0 siblings, 0 replies; 5+ messages in thread
From: fengchengwen @ 2023-10-19 7:13 UTC (permalink / raw)
To: Vipin Varghese, cheng1.jiang, stable, anoobj, jerinj, dev
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
On 2023/10/19 12:16, Vipin Varghese wrote:
> do_cpu_mem_copy uses DPDK API rte_mbuf_data_iova to return
> the start of the virtual address for both src and dst.
> But in case of iova mode set as PA, this results in seg-fault.
> This is because rte_memcpy uses VA address and not PA.
>
> This fix invokes `rte_pktmbuf_mtod` for both src and dst.
>
> Bugzilla ID: 1269
> Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
> Cc: cheng1.jiang@intel.com
>
> Cc: stable@dpdk.org
>
> Signed-off-by: Vipin Varghese <vipin.varghese@amd.com>
> Suggested-by: Anoob Joseph <anoobj@marvell.com>
> Suggested-by: Jerin Jacob <jerinj@marvell.com>
>
> ---
...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] app/dma-perf: fix physical address seg-fault
2023-10-24 2:16 ` lihuisong (C)
@ 2023-11-14 14:27 ` Thomas Monjalon
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2023-11-14 14:27 UTC (permalink / raw)
To: Vipin Varghese; +Cc: cheng1.jiang, stable, anoobj, jerinj, dev, lihuisong (C)
24/10/2023 04:16, lihuisong (C):
>
> 在 2023/10/19 12:19, Vipin Varghese 写道:
> > do_cpu_mem_copy uses DPDK API rte_mbuf_data_iova to return
> > the start of the virtual address for both src and dst.
> > But in case of iova mode set as PA, this results in seg-fault.
> > This is because rte_memcpy uses VA address and not PA.
> >
> > This fix invokes `rte_pktmbuf_mtod` for both src and dst.
> >
> > Bugzilla ID: 1269
> > Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
> > Cc: cheng1.jiang@intel.com
> >
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Vipin Varghese <vipin.varghese@amd.com>
> > Suggested-by: Anoob Joseph <anoobj@marvell.com>
> > Suggested-by: Jerin Jacob <jerinj@marvell.com>
> >
> Acked-by: Huisong Li <lihuisong@huawei.com>
Adding some missing acks.
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] app/dma-perf: fix physical address seg-fault
2023-10-19 4:19 ` [PATCH v3] " Vipin Varghese
@ 2023-10-24 2:16 ` lihuisong (C)
2023-11-14 14:27 ` Thomas Monjalon
0 siblings, 1 reply; 5+ messages in thread
From: lihuisong (C) @ 2023-10-24 2:16 UTC (permalink / raw)
To: Vipin Varghese, cheng1.jiang, stable, anoobj, jerinj, dev
在 2023/10/19 12:19, Vipin Varghese 写道:
> do_cpu_mem_copy uses DPDK API rte_mbuf_data_iova to return
> the start of the virtual address for both src and dst.
> But in case of iova mode set as PA, this results in seg-fault.
> This is because rte_memcpy uses VA address and not PA.
>
> This fix invokes `rte_pktmbuf_mtod` for both src and dst.
>
> Bugzilla ID: 1269
> Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
> Cc: cheng1.jiang@intel.com
>
> Cc: stable@dpdk.org
>
> Signed-off-by: Vipin Varghese <vipin.varghese@amd.com>
> Suggested-by: Anoob Joseph <anoobj@marvell.com>
> Suggested-by: Jerin Jacob <jerinj@marvell.com>
>
Acked-by: Huisong Li <lihuisong@huawei.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3] app/dma-perf: fix physical address seg-fault
2023-08-16 9:42 [PATCH v2] " Vipin Varghese
@ 2023-10-19 4:19 ` Vipin Varghese
2023-10-24 2:16 ` lihuisong (C)
0 siblings, 1 reply; 5+ messages in thread
From: Vipin Varghese @ 2023-10-19 4:19 UTC (permalink / raw)
To: cheng1.jiang, stable, anoobj, jerinj, dev
do_cpu_mem_copy uses DPDK API rte_mbuf_data_iova to return
the start of the virtual address for both src and dst.
But in case of iova mode set as PA, this results in seg-fault.
This is because rte_memcpy uses VA address and not PA.
This fix invokes `rte_pktmbuf_mtod` for both src and dst.
Bugzilla ID: 1269
Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
Cc: cheng1.jiang@intel.com
Cc: stable@dpdk.org
Signed-off-by: Vipin Varghese <vipin.varghese@amd.com>
Suggested-by: Anoob Joseph <anoobj@marvell.com>
Suggested-by: Jerin Jacob <jerinj@marvell.com>
---
v2:
- suggest use of pktmbuf_mtod for both va and pa by Anoob.
V3:
- add const to src suggested by Jerin.
---
app/test-dma-perf/benchmark.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/test-dma-perf/benchmark.c b/app/test-dma-perf/benchmark.c
index 0601e0d171..9b1f58c78c 100644
--- a/app/test-dma-perf/benchmark.c
+++ b/app/test-dma-perf/benchmark.c
@@ -288,10 +288,11 @@ do_cpu_mem_copy(void *p)
while (1) {
for (i = 0; i < nr_buf; i++) {
+ const void *src = rte_pktmbuf_mtod(dsts[i], void *);
+ void *dst = rte_pktmbuf_mtod(srcs[i], void *);
+
/* copy buffer form src to dst */
- rte_memcpy((void *)(uintptr_t)rte_mbuf_data_iova(dsts[i]),
- (void *)(uintptr_t)rte_mbuf_data_iova(srcs[i]),
- (size_t)buf_size);
+ rte_memcpy(dst, src, (size_t)buf_size);
worker_info->total_cpl++;
}
if (worker_info->stop_flag)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-11-14 14:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-19 4:16 [PATCH v3] app/dma-perf: fix physical address seg-fault Vipin Varghese
2023-10-19 7:13 ` fengchengwen
-- strict thread matches above, loose matches on Subject: below --
2023-08-16 9:42 [PATCH v2] " Vipin Varghese
2023-10-19 4:19 ` [PATCH v3] " Vipin Varghese
2023-10-24 2:16 ` lihuisong (C)
2023-11-14 14:27 ` Thomas Monjalon
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).