[PATCH v2] app/dma-perf: fix physical address seg-fault

Varghese, Vipin Vipin.Varghese at amd.com
Wed Oct 4 11:00:50 CEST 2023


[AMD Official Use Only - General]

Hi Jerrin,

Apologies for the delay, I missed on the comment

```
>                 for (i = 0; i < nr_buf; i++) {
> +                       void *src = rte_pktmbuf_mtod(dsts[i], void *);
> +                       void *dst = rte_pktmbuf_mtod(srcs[i], void *);

Use _const_ in fast path if src and dst in not changing as better optimization hint to compiler.
```

Thanks for the suggestion, but may I ask this differently `rte_memcpy` is defined with `always_inline` and all places where src used is with `const *`. Hence I have different view there as `setting const * for always_inline definition has the same effect too`.


> -----Original Message-----
> From: Jiang, Cheng1 <cheng1.jiang at intel.com>
> Sent: Thursday, September 21, 2023 7:58 AM
> To: Varghese, Vipin <Vipin.Varghese at amd.com>; thomas at monjalon.net;
> dev at dpdk.org; anoobj at marvell.com
> Cc: Yigit, Ferruh <Ferruh.Yigit at amd.com>; stable at dpdk.org
> Subject: RE: [PATCH v2] app/dma-perf: fix physical address seg-fault
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Hi,
>
> > -----Original Message-----
> > From: Vipin Varghese <vipin.varghese at amd.com>
> > Sent: Wednesday, August 16, 2023 5:42 PM
> > To: thomas at monjalon.net; dev at dpdk.org; anoobj at marvell.com
> > Cc: Ferruh.Yigit at amd.com; Jiang, Cheng1 <cheng1.jiang at intel.com>;
> > stable at dpdk.org
> > Subject: [PATCH v2] app/dma-perf: fix physical address seg-fault
> >
> > 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 at intel.com
> >
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: Vipin Varghese <vipin.varghese at amd.com>
> > Suggested-by: Anoob Joseph <anoobj at marvell.com>
> > ---
> >
> > v2:
> >  - suggest use of pktmbuf_mtod for both va and pa.
> >
> > tested for both va and pa
> >
> > CMD:
> > PA: dpdk-test-dma-perf --iova-mode=pa  -- --config test.ini
> > VA: dpdk-test-dma-perf --iova-mode=va  -- --config test.ini
> > DC: dpdk-test-dma-perf --iova-mode=dc  -- --config test.ini
> >
> > Log: fails for dc mode `EAL: invalid parameters for --iova-mode`
> >
> > test.ini:
> > ```
> > [case1]
> > type=CPU_MEM_COPY
> > mem_size=10
> > buf_size=64,8192,2,MUL
> > src_numa_node=0
> > dst_numa_node=0
> > cache_flush=0
> > test_seconds=2
> > lcore = 7
> > eal_args=--in-memory --no-pci
> > ```
> > ---
> >  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..1d1c9bde99 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++) {
> > +                     void *src = rte_pktmbuf_mtod(dsts[i], void *);
> > +                     void *dst = rte_pktmbuf_mtod(srcs[i], void *);
> > +
>
> Thank you for fixing it.
> Sorry that I missed the discussion earlier.
>
> Reviewed-by: Cheng Jiang <cheng1.jiang at intel.com>
>
> Thanks,
> Cheng


More information about the stable mailing list