DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  could not l2fwd in DOM0
@ 2014-05-17  7:48 Liu, Jijiang
  2014-05-29  9:58 ` Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: Liu, Jijiang @ 2014-05-17  7:48 UTC (permalink / raw)
  To: dev, SMonderer; +Cc: xen-devel

In Linux kernel versions < 3.14 , the vstart is kernel virtual address, the API prototype below.
int xen_create_contiguous_region(unsigned long vstart, unsigned int order,
				 unsigned int address_bits)

In Linux kernel 3.14, the pstart is kernel physical address, the API prototype below.
int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
				 unsigned int address_bits,
				 dma_addr_t *dma_handle)

,so the mm_data->block_info[i].vir_addr cannot pass to xen_create_contiguous_region() directly for Linux kernel 3.14, the pstart should be mm_data->block_info[i].pfn * PAGE_SIZE in the Dom0 Driver.

#include <linux/errno.h>
 #include <linux/vmalloc.h>
 #include <linux/mm.h>

 #include <xen/xen.h>
 #include <xen/page.h>
@@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
        uint64_t pfn, vstart, vaddr;
        uint32_t i, num_block, size;
        int idx;
+       dma_addr_t dma_handle;

        /* Allocate 2M memory once */
        num_block = meminfo->size / 2;
@@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
                 * contiguous physical addresses, its maximum size is 2M.
                 */
                if (xen_create_contiguous_region(mm_data->block_info[i].pfn * PAGE_SIZE,
-                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
+                                   DOM0_CONTIG_NUM_ORDER, 0,
+ &dma_handle) == 0) {
                        mm_data->block_info[i].exchange_flag = 1;
                        mm_data->block_info[i].mfn =
                                pfn_to_mfn(mm_data->block_info[i].pfn);

Thanks
Frank Liu

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Samuel Monderer
Sent: Wednesday, May 07, 2014 8:44 PM
To: Liu, Jijiang
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] could not l2fwd in DOM0

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Liu, Jijiang
> Sent: Wednesday, May 07, 2014 7:36 AM
> To: dev@dpdk.org
> Subject: Re: [dpdk-dev] could not l2fwd in DOM0
> 
> Hi,
> 
> I have checked source codes of xen_create_contiguous_region function 
> in kernel 3.14, and found the dma_handle cannot be NULL.
> 
> int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
>                                  unsigned int address_bits,
>                                  dma_addr_t *dma_handle) {
>         unsigned long *in_frames = discontig_frames, out_frame;
>         unsigned long  flags;
>         int            success;
>         unsigned long vstart = (unsigned long)phys_to_virt(pstart);
>     ...
>         *dma_handle = virt_to_machine(vstart).maddr;
>         return success ? 0 : -ENOMEM;
> }
> 
> Thanks
> Frank Liu
> 

Thanks Frank,

I've changed the code as following but now the kernel module crashes.

diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
b/lib/librte_eal/linuxapp/xen index 87fa3e6..8addc21 100644
--- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
+++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
@@ -64,6 +64,7 @@
 #include <linux/errno.h>
 #include <linux/vmalloc.h>
 #include <linux/mm.h>

 #include <xen/xen.h>
 #include <xen/page.h>
@@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
        uint64_t pfn, vstart, vaddr;
        uint32_t i, num_block, size;
        int idx;
+       dma_addr_t dma_handle;

        /* Allocate 2M memory once */
        num_block = meminfo->size / 2;
@@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
                 * contiguous physical addresses, its maximum size is 2M.
                 */
                if (xen_create_contiguous_region(mm_data->block_info[i].vir_addr,
-                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
+                                   DOM0_CONTIG_NUM_ORDER, 0,
+ &dma_handle) == 0) {
                        mm_data->block_info[i].exchange_flag = 1;
                        mm_data->block_info[i].mfn =
                                pfn_to_mfn(mm_data->block_info[i].pfn);

Samuel

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Samuel Monderer
> Sent: Wednesday, April 30, 2014 1:54 AM
> To: dev@dpdk.org<mailto:dev@dpdk.org>
> Cc: Shimon Zadok
> Subject: [dpdk-dev] could not l2fwd in DOM0
> 
> Hi,
> 
> First I've encountered a compiling problem when compiling for DOM0 due 
> to prototype change of the function xen_create_contiguous_region I 
> made the following changes:
> 
> diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> b/lib/librte_eal/linuxapp/xen index 87fa3e6..8addc21 100644
> --- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> +++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> @@ -64,6 +64,7 @@
>  #include <linux/errno.h>
>  #include <linux/vmalloc.h>
>  #include <linux/mm.h>
> +//#include <linux/types.h>
> 
>  #include <xen/xen.h>
>  #include <xen/page.h>
> @@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, 
> struct dom0_mm_data
>         uint64_t pfn, vstart, vaddr;
>         uint32_t i, num_block, size;
>         int idx;
> +       dma_addr_t *dma_handle = NULL;
> 
>         /* Allocate 2M memory once */
>         num_block = meminfo->size / 2; @@ -344,7 +346,7 @@ 
> dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
>                  * contiguous physical addresses, its maximum size is 2M.
>                  */
>                 if (xen_create_contiguous_region(mm_data->block_info[i].vir_addr,
> -                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
> +                                   DOM0_CONTIG_NUM_ORDER, 0,
> + dma_handle) == 0) {
>                         mm_data->block_info[i].exchange_flag = 1;
>                         mm_data->block_info[i].mfn =
>                                 
> pfn_to_mfn(mm_data->block_info[i].pfn);
> 
> After that I tried to run l2fwd example and got a segmentation fault
> 
> root@Smart:~/samuelm/dpdk/dpdk# modprobe uio 
> root@Smart:~/samuelm/dpdk/dpdk# insmod ./x86_64-default-linuxapp- 
> gcc/kmod/igb_uio.ko root@Smart:~/samuelm/dpdk/dpdk# insmod 
> ./x86_64-default-linuxapp- gcc/kmod/rte_dom0_mm.ko 
> root@Smart:~/samuelm/dpdk/dpdk# cd examples/l2fwd/build/ 
> root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# echo 2048 > 
> /sys/kernel/mm/dom0-mm/memsize-mB/memsize
> root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# ./l2fwd -c 3 -n 4
> --xen-dom0 -- -q 1 -p 3
> EAL: Detected lcore 0 as core 0 on socket 0
> EAL: Detected lcore 1 as core 0 on socket 0
> EAL: Setting up memory...
> Segmentation fault
> root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build#
> 
> Has anyone already encountered this problem?
> 
> Samuelm

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] could not l2fwd in DOM0
  2014-05-17  7:48 [dpdk-dev] could not l2fwd in DOM0 Liu, Jijiang
@ 2014-05-29  9:58 ` Thomas Monjalon
  2014-05-29 10:12   ` Liu, Jijiang
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2014-05-29  9:58 UTC (permalink / raw)
  To: Liu, Jijiang; +Cc: dev, SMonderer, xen-devel

Jijiang, I'm not sure to understand.
Could you send a proper patch for this issue?

Thanks
-- 
Thomas


2014-05-17 07:48, Liu, Jijiang:
> In Linux kernel versions < 3.14 , the vstart is kernel virtual address, the
> API prototype below. int xen_create_contiguous_region(unsigned long vstart,
> unsigned int order, unsigned int address_bits)
> 
> In Linux kernel 3.14, the pstart is kernel physical address, the API
> prototype below. int xen_create_contiguous_region(phys_addr_t pstart,
> unsigned int order, unsigned int address_bits,
> 				 dma_addr_t *dma_handle)
> 
> ,so the mm_data->block_info[i].vir_addr cannot pass to
> xen_create_contiguous_region() directly for Linux kernel 3.14, the pstart
> should be mm_data->block_info[i].pfn * PAGE_SIZE in the Dom0 Driver.
> 
> #include <linux/errno.h>
>  #include <linux/vmalloc.h>
>  #include <linux/mm.h>
> 
>  #include <xen/xen.h>
>  #include <xen/page.h>
> @@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct
> dom0_mm_data uint64_t pfn, vstart, vaddr;
>         uint32_t i, num_block, size;
>         int idx;
> +       dma_addr_t dma_handle;
> 
>         /* Allocate 2M memory once */
>         num_block = meminfo->size / 2;
> @@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct
> dom0_mm_data * contiguous physical addresses, its maximum size is 2M. */
>                 if (xen_create_contiguous_region(mm_data->block_info[i].pfn
> * PAGE_SIZE, -                                   DOM0_CONTIG_NUM_ORDER, 0)
> == 0) { +                                   DOM0_CONTIG_NUM_ORDER, 0,
> + &dma_handle) == 0) {
>                         mm_data->block_info[i].exchange_flag = 1;
>                         mm_data->block_info[i].mfn =
>                                 pfn_to_mfn(mm_data->block_info[i].pfn);
> 
> Thanks
> Frank Liu
> 
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Samuel Monderer
> Sent: Wednesday, May 07, 2014 8:44 PM
> To: Liu, Jijiang
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] could not l2fwd in DOM0
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Liu, Jijiang
> > Sent: Wednesday, May 07, 2014 7:36 AM
> > To: dev@dpdk.org
> > Subject: Re: [dpdk-dev] could not l2fwd in DOM0
> > 
> > Hi,
> > 
> > I have checked source codes of xen_create_contiguous_region function
> > in kernel 3.14, and found the dma_handle cannot be NULL.
> > 
> > int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
> > 
> >                                  unsigned int address_bits,
> >                                  dma_addr_t *dma_handle) {
> >         
> >         unsigned long *in_frames = discontig_frames, out_frame;
> >         unsigned long  flags;
> >         int            success;
> >         unsigned long vstart = (unsigned long)phys_to_virt(pstart);
> >     
> >     ...
> >     
> >         *dma_handle = virt_to_machine(vstart).maddr;
> >         return success ? 0 : -ENOMEM;
> > 
> > }
> > 
> > Thanks
> > Frank Liu
> 
> Thanks Frank,
> 
> I've changed the code as following but now the kernel module crashes.
> 
> diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> b/lib/librte_eal/linuxapp/xen index 87fa3e6..8addc21 100644
> --- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> +++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> @@ -64,6 +64,7 @@
>  #include <linux/errno.h>
>  #include <linux/vmalloc.h>
>  #include <linux/mm.h>
> 
>  #include <xen/xen.h>
>  #include <xen/page.h>
> @@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct
> dom0_mm_data uint64_t pfn, vstart, vaddr;
>         uint32_t i, num_block, size;
>         int idx;
> +       dma_addr_t dma_handle;
> 
>         /* Allocate 2M memory once */
>         num_block = meminfo->size / 2;
> @@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct
> dom0_mm_data * contiguous physical addresses, its maximum size is 2M. */
>                 if
> (xen_create_contiguous_region(mm_data->block_info[i].vir_addr,
> -                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
> +                                   DOM0_CONTIG_NUM_ORDER, 0,
> + &dma_handle) == 0) {
>                         mm_data->block_info[i].exchange_flag = 1;
>                         mm_data->block_info[i].mfn =
>                                 pfn_to_mfn(mm_data->block_info[i].pfn);
> 
> Samuel
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Samuel Monderer
> > Sent: Wednesday, April 30, 2014 1:54 AM
> > To: dev@dpdk.org<mailto:dev@dpdk.org>
> > Cc: Shimon Zadok
> > Subject: [dpdk-dev] could not l2fwd in DOM0
> > 
> > Hi,
> > 
> > First I've encountered a compiling problem when compiling for DOM0 due
> > to prototype change of the function xen_create_contiguous_region I
> > made the following changes:
> > 
> > diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > b/lib/librte_eal/linuxapp/xen index 87fa3e6..8addc21 100644
> > --- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > +++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > @@ -64,6 +64,7 @@
> > 
> >  #include <linux/errno.h>
> >  #include <linux/vmalloc.h>
> >  #include <linux/mm.h>
> > 
> > +//#include <linux/types.h>
> > 
> >  #include <xen/xen.h>
> >  #include <xen/page.h>
> > 
> > @@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo,
> > struct dom0_mm_data
> > 
> >         uint64_t pfn, vstart, vaddr;
> >         uint32_t i, num_block, size;
> >         int idx;
> > 
> > +       dma_addr_t *dma_handle = NULL;
> > 
> >         /* Allocate 2M memory once */
> >         num_block = meminfo->size / 2; @@ -344,7 +346,7 @@
> > 
> > dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
> > 
> >                  * contiguous physical addresses, its maximum size is 2M.
> >                  */
> >                 
> >                 if
> >                 (xen_create_contiguous_region(mm_data->block_info[i].vir_
> >                 addr,
> > 
> > -                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
> > +                                   DOM0_CONTIG_NUM_ORDER, 0,
> > + dma_handle) == 0) {
> > 
> >                         mm_data->block_info[i].exchange_flag = 1;
> >                         mm_data->block_info[i].mfn =
> > 
> > pfn_to_mfn(mm_data->block_info[i].pfn);
> > 
> > After that I tried to run l2fwd example and got a segmentation fault
> > 
> > root@Smart:~/samuelm/dpdk/dpdk# modprobe uio
> > root@Smart:~/samuelm/dpdk/dpdk# insmod ./x86_64-default-linuxapp-
> > gcc/kmod/igb_uio.ko root@Smart:~/samuelm/dpdk/dpdk# insmod
> > ./x86_64-default-linuxapp- gcc/kmod/rte_dom0_mm.ko
> > root@Smart:~/samuelm/dpdk/dpdk# cd examples/l2fwd/build/
> > root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# echo 2048 >
> > /sys/kernel/mm/dom0-mm/memsize-mB/memsize
> > root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# ./l2fwd -c 3 -n 4
> > --xen-dom0 -- -q 1 -p 3
> > EAL: Detected lcore 0 as core 0 on socket 0
> > EAL: Detected lcore 1 as core 0 on socket 0
> > EAL: Setting up memory...
> > Segmentation fault
> > root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build#
> > 
> > Has anyone already encountered this problem?
> > 
> > Samuelm

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] could not l2fwd in DOM0
  2014-05-29  9:58 ` Thomas Monjalon
@ 2014-05-29 10:12   ` Liu, Jijiang
  2014-06-09 16:02     ` Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: Liu, Jijiang @ 2014-05-29 10:12 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, SMonderer, xen-devel

Ok, I will send a patch for fixing this.

-----Original Message-----
From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] 
Sent: Thursday, May 29, 2014 5:59 PM
To: Liu, Jijiang
Cc: dev@dpdk.org; SMonderer@advaoptical.com; xen-devel@lists.xen.org
Subject: Re: [dpdk-dev] could not l2fwd in DOM0

Jijiang, I'm not sure to understand.
Could you send a proper patch for this issue?

Thanks
-- 
Thomas


2014-05-17 07:48, Liu, Jijiang:
> In Linux kernel versions < 3.14 , the vstart is kernel virtual address, the
> API prototype below. int xen_create_contiguous_region(unsigned long vstart,
> unsigned int order, unsigned int address_bits)
> 
> In Linux kernel 3.14, the pstart is kernel physical address, the API
> prototype below. int xen_create_contiguous_region(phys_addr_t pstart,
> unsigned int order, unsigned int address_bits,
> 				 dma_addr_t *dma_handle)
> 
> ,so the mm_data->block_info[i].vir_addr cannot pass to
> xen_create_contiguous_region() directly for Linux kernel 3.14, the pstart
> should be mm_data->block_info[i].pfn * PAGE_SIZE in the Dom0 Driver.
> 
> #include <linux/errno.h>
>  #include <linux/vmalloc.h>
>  #include <linux/mm.h>
> 
>  #include <xen/xen.h>
>  #include <xen/page.h>
> @@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct
> dom0_mm_data uint64_t pfn, vstart, vaddr;
>         uint32_t i, num_block, size;
>         int idx;
> +       dma_addr_t dma_handle;
> 
>         /* Allocate 2M memory once */
>         num_block = meminfo->size / 2;
> @@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct
> dom0_mm_data * contiguous physical addresses, its maximum size is 2M. */
>                 if (xen_create_contiguous_region(mm_data->block_info[i].pfn
> * PAGE_SIZE, -                                   DOM0_CONTIG_NUM_ORDER, 0)
> == 0) { +                                   DOM0_CONTIG_NUM_ORDER, 0,
> + &dma_handle) == 0) {
>                         mm_data->block_info[i].exchange_flag = 1;
>                         mm_data->block_info[i].mfn =
>                                 pfn_to_mfn(mm_data->block_info[i].pfn);
> 
> Thanks
> Frank Liu
> 
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Samuel Monderer
> Sent: Wednesday, May 07, 2014 8:44 PM
> To: Liu, Jijiang
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] could not l2fwd in DOM0
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Liu, Jijiang
> > Sent: Wednesday, May 07, 2014 7:36 AM
> > To: dev@dpdk.org
> > Subject: Re: [dpdk-dev] could not l2fwd in DOM0
> > 
> > Hi,
> > 
> > I have checked source codes of xen_create_contiguous_region function
> > in kernel 3.14, and found the dma_handle cannot be NULL.
> > 
> > int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
> > 
> >                                  unsigned int address_bits,
> >                                  dma_addr_t *dma_handle) {
> >         
> >         unsigned long *in_frames = discontig_frames, out_frame;
> >         unsigned long  flags;
> >         int            success;
> >         unsigned long vstart = (unsigned long)phys_to_virt(pstart);
> >     
> >     ...
> >     
> >         *dma_handle = virt_to_machine(vstart).maddr;
> >         return success ? 0 : -ENOMEM;
> > 
> > }
> > 
> > Thanks
> > Frank Liu
> 
> Thanks Frank,
> 
> I've changed the code as following but now the kernel module crashes.
> 
> diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> b/lib/librte_eal/linuxapp/xen index 87fa3e6..8addc21 100644
> --- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> +++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> @@ -64,6 +64,7 @@
>  #include <linux/errno.h>
>  #include <linux/vmalloc.h>
>  #include <linux/mm.h>
> 
>  #include <xen/xen.h>
>  #include <xen/page.h>
> @@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct
> dom0_mm_data uint64_t pfn, vstart, vaddr;
>         uint32_t i, num_block, size;
>         int idx;
> +       dma_addr_t dma_handle;
> 
>         /* Allocate 2M memory once */
>         num_block = meminfo->size / 2;
> @@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct
> dom0_mm_data * contiguous physical addresses, its maximum size is 2M. */
>                 if
> (xen_create_contiguous_region(mm_data->block_info[i].vir_addr,
> -                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
> +                                   DOM0_CONTIG_NUM_ORDER, 0,
> + &dma_handle) == 0) {
>                         mm_data->block_info[i].exchange_flag = 1;
>                         mm_data->block_info[i].mfn =
>                                 pfn_to_mfn(mm_data->block_info[i].pfn);
> 
> Samuel
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Samuel Monderer
> > Sent: Wednesday, April 30, 2014 1:54 AM
> > To: dev@dpdk.org<mailto:dev@dpdk.org>
> > Cc: Shimon Zadok
> > Subject: [dpdk-dev] could not l2fwd in DOM0
> > 
> > Hi,
> > 
> > First I've encountered a compiling problem when compiling for DOM0 due
> > to prototype change of the function xen_create_contiguous_region I
> > made the following changes:
> > 
> > diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > b/lib/librte_eal/linuxapp/xen index 87fa3e6..8addc21 100644
> > --- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > +++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > @@ -64,6 +64,7 @@
> > 
> >  #include <linux/errno.h>
> >  #include <linux/vmalloc.h>
> >  #include <linux/mm.h>
> > 
> > +//#include <linux/types.h>
> > 
> >  #include <xen/xen.h>
> >  #include <xen/page.h>
> > 
> > @@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo,
> > struct dom0_mm_data
> > 
> >         uint64_t pfn, vstart, vaddr;
> >         uint32_t i, num_block, size;
> >         int idx;
> > 
> > +       dma_addr_t *dma_handle = NULL;
> > 
> >         /* Allocate 2M memory once */
> >         num_block = meminfo->size / 2; @@ -344,7 +346,7 @@
> > 
> > dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
> > 
> >                  * contiguous physical addresses, its maximum size is 2M.
> >                  */
> >                 
> >                 if
> >                 (xen_create_contiguous_region(mm_data->block_info[i].vir_
> >                 addr,
> > 
> > -                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
> > +                                   DOM0_CONTIG_NUM_ORDER, 0,
> > + dma_handle) == 0) {
> > 
> >                         mm_data->block_info[i].exchange_flag = 1;
> >                         mm_data->block_info[i].mfn =
> > 
> > pfn_to_mfn(mm_data->block_info[i].pfn);
> > 
> > After that I tried to run l2fwd example and got a segmentation fault
> > 
> > root@Smart:~/samuelm/dpdk/dpdk# modprobe uio
> > root@Smart:~/samuelm/dpdk/dpdk# insmod ./x86_64-default-linuxapp-
> > gcc/kmod/igb_uio.ko root@Smart:~/samuelm/dpdk/dpdk# insmod
> > ./x86_64-default-linuxapp- gcc/kmod/rte_dom0_mm.ko
> > root@Smart:~/samuelm/dpdk/dpdk# cd examples/l2fwd/build/
> > root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# echo 2048 >
> > /sys/kernel/mm/dom0-mm/memsize-mB/memsize
> > root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# ./l2fwd -c 3 -n 4
> > --xen-dom0 -- -q 1 -p 3
> > EAL: Detected lcore 0 as core 0 on socket 0
> > EAL: Detected lcore 1 as core 0 on socket 0
> > EAL: Setting up memory...
> > Segmentation fault
> > root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build#
> > 
> > Has anyone already encountered this problem?
> > 
> > Samuelm

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] could not l2fwd in DOM0
  2014-05-29 10:12   ` Liu, Jijiang
@ 2014-06-09 16:02     ` Thomas Monjalon
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2014-06-09 16:02 UTC (permalink / raw)
  To: SMonderer; +Cc: dev, xen-devel

Jijiang's patch has been applied on master branch:
	http://dpdk.org/browse/dpdk/commit/?id=6f0ce7b9cd490

2014-05-29 10:12, Liu, Jijiang:
> Ok, I will send a patch for fixing this.
> 
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Thursday, May 29, 2014 5:59 PM
> To: Liu, Jijiang
> Cc: dev@dpdk.org; SMonderer@advaoptical.com; xen-devel@lists.xen.org
> Subject: Re: [dpdk-dev] could not l2fwd in DOM0
> 
> Jijiang, I'm not sure to understand.
> Could you send a proper patch for this issue?
> 
> Thanks
> 
> > In Linux kernel versions < 3.14 , the vstart is kernel virtual address,
> > the
> > API prototype below. int xen_create_contiguous_region(unsigned long
> > vstart,
> > unsigned int order, unsigned int address_bits)
> > 
> > In Linux kernel 3.14, the pstart is kernel physical address, the API
> > prototype below. int xen_create_contiguous_region(phys_addr_t pstart,
> > unsigned int order, unsigned int address_bits,
> > 
> > 				 dma_addr_t *dma_handle)
> > 
> > ,so the mm_data->block_info[i].vir_addr cannot pass to
> > xen_create_contiguous_region() directly for Linux kernel 3.14, the pstart
> > should be mm_data->block_info[i].pfn * PAGE_SIZE in the Dom0 Driver.
> > 
> > #include <linux/errno.h>
> > 
> >  #include <linux/vmalloc.h>
> >  #include <linux/mm.h>
> >  
> >  #include <xen/xen.h>
> >  #include <xen/page.h>
> > 
> > @@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo,
> > struct dom0_mm_data uint64_t pfn, vstart, vaddr;
> > 
> >         uint32_t i, num_block, size;
> >         int idx;
> > 
> > +       dma_addr_t dma_handle;
> > 
> >         /* Allocate 2M memory once */
> >         num_block = meminfo->size / 2;
> > 
> > @@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo,
> > struct dom0_mm_data * contiguous physical addresses, its maximum size is
> > 2M. */> 
> >                 if
> >                 (xen_create_contiguous_region(mm_data->block_info[i].pfn
> > 
> > * PAGE_SIZE, -                                   DOM0_CONTIG_NUM_ORDER, 0)
> > == 0) { +                                   DOM0_CONTIG_NUM_ORDER, 0,
> > + &dma_handle) == 0) {
> > 
> >                         mm_data->block_info[i].exchange_flag = 1;
> >                         mm_data->block_info[i].mfn =
> >                         
> >                                 pfn_to_mfn(mm_data->block_info[i].pfn);
> > 
> > Thanks
> > Frank Liu
> > 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Samuel Monderer
> > Sent: Wednesday, May 07, 2014 8:44 PM
> > To: Liu, Jijiang
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] could not l2fwd in DOM0
> > 
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Liu, Jijiang
> > > Sent: Wednesday, May 07, 2014 7:36 AM
> > > To: dev@dpdk.org
> > > Subject: Re: [dpdk-dev] could not l2fwd in DOM0
> > > 
> > > Hi,
> > > 
> > > I have checked source codes of xen_create_contiguous_region function
> > > in kernel 3.14, and found the dma_handle cannot be NULL.
> > > 
> > > int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
> > > 
> > >                                  unsigned int address_bits,
> > >                                  dma_addr_t *dma_handle) {
> > >         
> > >         unsigned long *in_frames = discontig_frames, out_frame;
> > >         unsigned long  flags;
> > >         int            success;
> > >         unsigned long vstart = (unsigned long)phys_to_virt(pstart);
> > >     
> > >     ...
> > >     
> > >         *dma_handle = virt_to_machine(vstart).maddr;
> > >         return success ? 0 : -ENOMEM;
> > > 
> > > }
> > > 
> > > Thanks
> > > Frank Liu
> > 
> > Thanks Frank,
> > 
> > I've changed the code as following but now the kernel module crashes.
> > 
> > diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > b/lib/librte_eal/linuxapp/xen index 87fa3e6..8addc21 100644
> > --- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > +++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > @@ -64,6 +64,7 @@
> > 
> >  #include <linux/errno.h>
> >  #include <linux/vmalloc.h>
> >  #include <linux/mm.h>
> >  
> >  #include <xen/xen.h>
> >  #include <xen/page.h>
> > 
> > @@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo,
> > struct dom0_mm_data uint64_t pfn, vstart, vaddr;
> > 
> >         uint32_t i, num_block, size;
> >         int idx;
> > 
> > +       dma_addr_t dma_handle;
> > 
> >         /* Allocate 2M memory once */
> >         num_block = meminfo->size / 2;
> > 
> > @@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo,
> > struct dom0_mm_data * contiguous physical addresses, its maximum size is
> > 2M. */> 
> >                 if
> > 
> > (xen_create_contiguous_region(mm_data->block_info[i].vir_addr,
> > -                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
> > +                                   DOM0_CONTIG_NUM_ORDER, 0,
> > + &dma_handle) == 0) {
> > 
> >                         mm_data->block_info[i].exchange_flag = 1;
> >                         mm_data->block_info[i].mfn =
> >                         
> >                                 pfn_to_mfn(mm_data->block_info[i].pfn);
> > 
> > Samuel
> > 
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Samuel Monderer
> > > Sent: Wednesday, April 30, 2014 1:54 AM
> > > To: dev@dpdk.org<mailto:dev@dpdk.org>
> > > Cc: Shimon Zadok
> > > Subject: [dpdk-dev] could not l2fwd in DOM0
> > > 
> > > Hi,
> > > 
> > > First I've encountered a compiling problem when compiling for DOM0 due
> > > to prototype change of the function xen_create_contiguous_region I
> > > made the following changes:
> > > 
> > > diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > > b/lib/librte_eal/linuxapp/xen index 87fa3e6..8addc21 100644
> > > --- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > > +++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> > > @@ -64,6 +64,7 @@
> > > 
> > >  #include <linux/errno.h>
> > >  #include <linux/vmalloc.h>
> > >  #include <linux/mm.h>
> > > 
> > > +//#include <linux/types.h>
> > > 
> > >  #include <xen/xen.h>
> > >  #include <xen/page.h>
> > > 
> > > @@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo,
> > > struct dom0_mm_data
> > > 
> > >         uint64_t pfn, vstart, vaddr;
> > >         uint32_t i, num_block, size;
> > >         int idx;
> > > 
> > > +       dma_addr_t *dma_handle = NULL;
> > > 
> > >         /* Allocate 2M memory once */
> > >         num_block = meminfo->size / 2; @@ -344,7 +346,7 @@
> > > 
> > > dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
> > > 
> > >                  * contiguous physical addresses, its maximum size is
> > >                  2M.
> > >                  */
> > >                 
> > >                 if
> > >                 (xen_create_contiguous_region(mm_data->block_info[i].vir
> > >                 _
> > >                 addr,
> > > 
> > > -                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
> > > +                                   DOM0_CONTIG_NUM_ORDER, 0,
> > > + dma_handle) == 0) {
> > > 
> > >                         mm_data->block_info[i].exchange_flag = 1;
> > >                         mm_data->block_info[i].mfn =
> > > 
> > > pfn_to_mfn(mm_data->block_info[i].pfn);
> > > 
> > > After that I tried to run l2fwd example and got a segmentation fault
> > > 
> > > root@Smart:~/samuelm/dpdk/dpdk# modprobe uio
> > > root@Smart:~/samuelm/dpdk/dpdk# insmod ./x86_64-default-linuxapp-
> > > gcc/kmod/igb_uio.ko root@Smart:~/samuelm/dpdk/dpdk# insmod
> > > ./x86_64-default-linuxapp- gcc/kmod/rte_dom0_mm.ko
> > > root@Smart:~/samuelm/dpdk/dpdk# cd examples/l2fwd/build/
> > > root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# echo 2048 >
> > > /sys/kernel/mm/dom0-mm/memsize-mB/memsize
> > > root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# ./l2fwd -c 3 -n 4
> > > --xen-dom0 -- -q 1 -p 3
> > > EAL: Detected lcore 0 as core 0 on socket 0
> > > EAL: Detected lcore 1 as core 0 on socket 0
> > > EAL: Setting up memory...
> > > Segmentation fault
> > > root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build#
> > > 
> > > Has anyone already encountered this problem?
> > > 
> > > Samuelm

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] could not l2fwd in DOM0
       [not found]     ` <9f34498d15cd400eb2db76212778c038@MUC-SRV-MBX2.advaoptical.com>
@ 2014-05-07 12:44       ` Samuel Monderer
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Monderer @ 2014-05-07 12:44 UTC (permalink / raw)
  To: Liu, Jijiang; +Cc: dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Liu, Jijiang
> Sent: Wednesday, May 07, 2014 7:36 AM
> To: dev@dpdk.org
> Subject: Re: [dpdk-dev] could not l2fwd in DOM0
> 
> Hi,
> 
> I have checked source codes of xen_create_contiguous_region function in
> kernel 3.14, and found the dma_handle cannot be NULL.
> 
> int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
>                                  unsigned int address_bits,
>                                  dma_addr_t *dma_handle) {
>         unsigned long *in_frames = discontig_frames, out_frame;
>         unsigned long  flags;
>         int            success;
>         unsigned long vstart = (unsigned long)phys_to_virt(pstart);
>     ...
>         *dma_handle = virt_to_machine(vstart).maddr;
>         return success ? 0 : -ENOMEM;
> }
> 
> Thanks
> Frank Liu
> 

Thanks Frank,

I've changed the code as following but now the kernel module crashes.

diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c 
b/lib/librte_eal/linuxapp/xen index 87fa3e6..8addc21 100644
--- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
+++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
@@ -64,6 +64,7 @@
 #include <linux/errno.h>
 #include <linux/vmalloc.h>
 #include <linux/mm.h>

 #include <xen/xen.h>
 #include <xen/page.h>
@@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct 
dom0_mm_data
        uint64_t pfn, vstart, vaddr;
        uint32_t i, num_block, size;
        int idx;
+       dma_addr_t dma_handle;

        /* Allocate 2M memory once */
        num_block = meminfo->size / 2;
@@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct 
dom0_mm_data
                 * contiguous physical addresses, its maximum size is 2M.
                 */
                if (xen_create_contiguous_region(mm_data->block_info[i].vir_addr,
-                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
+                                   DOM0_CONTIG_NUM_ORDER, 0,
+ &dma_handle) == 0) {
                        mm_data->block_info[i].exchange_flag = 1;
                        mm_data->block_info[i].mfn =
                                pfn_to_mfn(mm_data->block_info[i].pfn);

Samuel

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Samuel Monderer
> Sent: Wednesday, April 30, 2014 1:54 AM
> To: dev@dpdk.org<mailto:dev@dpdk.org>
> Cc: Shimon Zadok
> Subject: [dpdk-dev] could not l2fwd in DOM0
> 
> Hi,
> 
> First I've encountered a compiling problem when compiling for DOM0 due to
> prototype change of the function xen_create_contiguous_region I made the
> following changes:
> 
> diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> b/lib/librte_eal/linuxapp/xen index 87fa3e6..8addc21 100644
> --- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> +++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
> @@ -64,6 +64,7 @@
>  #include <linux/errno.h>
>  #include <linux/vmalloc.h>
>  #include <linux/mm.h>
> +//#include <linux/types.h>
> 
>  #include <xen/xen.h>
>  #include <xen/page.h>
> @@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info*
> meminfo, struct dom0_mm_data
>         uint64_t pfn, vstart, vaddr;
>         uint32_t i, num_block, size;
>         int idx;
> +       dma_addr_t *dma_handle = NULL;
> 
>         /* Allocate 2M memory once */
>         num_block = meminfo->size / 2;
> @@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info*
> meminfo, struct dom0_mm_data
>                  * contiguous physical addresses, its maximum size is 2M.
>                  */
>                 if (xen_create_contiguous_region(mm_data->block_info[i].vir_addr,
> -                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
> +                                   DOM0_CONTIG_NUM_ORDER, 0,
> + dma_handle) == 0) {
>                         mm_data->block_info[i].exchange_flag = 1;
>                         mm_data->block_info[i].mfn =
>                                 pfn_to_mfn(mm_data->block_info[i].pfn);
> 
> After that I tried to run l2fwd example and got a segmentation fault
> 
> root@Smart:~/samuelm/dpdk/dpdk# modprobe uio
> root@Smart:~/samuelm/dpdk/dpdk# insmod ./x86_64-default-linuxapp-
> gcc/kmod/igb_uio.ko
> root@Smart:~/samuelm/dpdk/dpdk# insmod ./x86_64-default-linuxapp-
> gcc/kmod/rte_dom0_mm.ko
> root@Smart:~/samuelm/dpdk/dpdk# cd examples/l2fwd/build/
> root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# echo 2048 >
> /sys/kernel/mm/dom0-mm/memsize-mB/memsize
> root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# ./l2fwd -c 3 -n 4
> --xen-dom0 -- -q 1 -p 3
> EAL: Detected lcore 0 as core 0 on socket 0
> EAL: Detected lcore 1 as core 0 on socket 0
> EAL: Setting up memory...
> Segmentation fault
> root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build#
> 
> Has anyone already encountered this problem?
> 
> Samuelm

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] could not l2fwd in DOM0
       [not found] ` <CAD16F236028A64DBBC0158B1636EA4510E8816E@SHSMSX104.ccr.corp.intel.com>
@ 2014-05-07  4:35   ` Liu, Jijiang
       [not found]     ` <9f34498d15cd400eb2db76212778c038@MUC-SRV-MBX2.advaoptical.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Liu, Jijiang @ 2014-05-07  4:35 UTC (permalink / raw)
  To: dev

Hi,

I have checked source codes of xen_create_contiguous_region function in kernel 3.14, and found the dma_handle cannot be NULL.

int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
                                 unsigned int address_bits,
                                 dma_addr_t *dma_handle)
{
        unsigned long *in_frames = discontig_frames, out_frame;
        unsigned long  flags;
        int            success;
        unsigned long vstart = (unsigned long)phys_to_virt(pstart);
    ...
        *dma_handle = virt_to_machine(vstart).maddr;
        return success ? 0 : -ENOMEM;
}

Thanks
Frank Liu

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Samuel Monderer
Sent: Wednesday, April 30, 2014 1:54 AM
To: dev@dpdk.org<mailto:dev@dpdk.org>
Cc: Shimon Zadok
Subject: [dpdk-dev] could not l2fwd in DOM0

Hi,

First I've encountered a compiling problem when compiling for DOM0 due to prototype change of the function xen_create_contiguous_region I made the following changes:

diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c b/lib/librte_eal/linuxapp/xen index 87fa3e6..8addc21 100644
--- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
+++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
@@ -64,6 +64,7 @@
 #include <linux/errno.h>
 #include <linux/vmalloc.h>
 #include <linux/mm.h>
+//#include <linux/types.h>

 #include <xen/xen.h>
 #include <xen/page.h>
@@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
        uint64_t pfn, vstart, vaddr;
        uint32_t i, num_block, size;
        int idx;
+       dma_addr_t *dma_handle = NULL;

        /* Allocate 2M memory once */
        num_block = meminfo->size / 2;
@@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
                 * contiguous physical addresses, its maximum size is 2M.
                 */
                if (xen_create_contiguous_region(mm_data->block_info[i].vir_addr,
-                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
+                                   DOM0_CONTIG_NUM_ORDER, 0,
+ dma_handle) == 0) {
                        mm_data->block_info[i].exchange_flag = 1;
                        mm_data->block_info[i].mfn =
                                pfn_to_mfn(mm_data->block_info[i].pfn);

After that I tried to run l2fwd example and got a segmentation fault

root@Smart:~/samuelm/dpdk/dpdk# modprobe uio root@Smart:~/samuelm/dpdk/dpdk# insmod ./x86_64-default-linuxapp-gcc/kmod/igb_uio.ko
root@Smart:~/samuelm/dpdk/dpdk# insmod ./x86_64-default-linuxapp-gcc/kmod/rte_dom0_mm.ko
root@Smart:~/samuelm/dpdk/dpdk# cd examples/l2fwd/build/ root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# echo 2048 > /sys/kernel/mm/dom0-mm/memsize-mB/memsize
root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# ./l2fwd -c 3 -n 4 --xen-dom0 -- -q 1 -p 3
EAL: Detected lcore 0 as core 0 on socket 0
EAL: Detected lcore 1 as core 0 on socket 0
EAL: Setting up memory...
Segmentation fault
root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build#

Has anyone already encountered this problem?

Samuelm

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] could not l2fwd in DOM0
@ 2014-04-29 17:53 Samuel Monderer
       [not found] ` <CAD16F236028A64DBBC0158B1636EA4510E8816E@SHSMSX104.ccr.corp.intel.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Monderer @ 2014-04-29 17:53 UTC (permalink / raw)
  To: dev; +Cc: Shimon Zadok

Hi,

First I've encountered a compiling problem when compiling for DOM0 due to prototype change of the function xen_create_contiguous_region
I made the following changes:

diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c b/lib/librte_eal/linuxapp/xen
index 87fa3e6..8addc21 100644
--- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
+++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
@@ -64,6 +64,7 @@
 #include <linux/errno.h>
 #include <linux/vmalloc.h>
 #include <linux/mm.h>
+//#include <linux/types.h>

 #include <xen/xen.h>
 #include <xen/page.h>
@@ -309,6 +310,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
        uint64_t pfn, vstart, vaddr;
        uint32_t i, num_block, size;
        int idx;
+       dma_addr_t *dma_handle = NULL;

        /* Allocate 2M memory once */
        num_block = meminfo->size / 2;
@@ -344,7 +346,7 @@ dom0_prepare_memsegs(struct memory_info* meminfo, struct dom0_mm_data
                 * contiguous physical addresses, its maximum size is 2M.
                 */
                if (xen_create_contiguous_region(mm_data->block_info[i].vir_addr,
-                                   DOM0_CONTIG_NUM_ORDER, 0) == 0) {
+                                   DOM0_CONTIG_NUM_ORDER, 0, dma_handle) == 0) {
                        mm_data->block_info[i].exchange_flag = 1;
                        mm_data->block_info[i].mfn =
                                pfn_to_mfn(mm_data->block_info[i].pfn);

After that I tried to run l2fwd example and got a segmentation fault

root@Smart:~/samuelm/dpdk/dpdk# modprobe uio
root@Smart:~/samuelm/dpdk/dpdk# insmod ./x86_64-default-linuxapp-gcc/kmod/igb_uio.ko
root@Smart:~/samuelm/dpdk/dpdk# insmod ./x86_64-default-linuxapp-gcc/kmod/rte_dom0_mm.ko
root@Smart:~/samuelm/dpdk/dpdk# cd examples/l2fwd/build/
root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# echo 2048 > /sys/kernel/mm/dom0-mm/memsize-mB/memsize
root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build# ./l2fwd -c 3 -n 4 --xen-dom0 -- -q 1 -p 3
EAL: Detected lcore 0 as core 0 on socket 0
EAL: Detected lcore 1 as core 0 on socket 0
EAL: Setting up memory...
Segmentation fault
root@Smart:~/samuelm/dpdk/dpdk/examples/l2fwd/build#

Has anyone already encountered this problem?

Samuelm

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-06-09 16:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-17  7:48 [dpdk-dev] could not l2fwd in DOM0 Liu, Jijiang
2014-05-29  9:58 ` Thomas Monjalon
2014-05-29 10:12   ` Liu, Jijiang
2014-06-09 16:02     ` Thomas Monjalon
  -- strict thread matches above, loose matches on Subject: below --
2014-04-29 17:53 Samuel Monderer
     [not found] ` <CAD16F236028A64DBBC0158B1636EA4510E8816E@SHSMSX104.ccr.corp.intel.com>
2014-05-07  4:35   ` Liu, Jijiang
     [not found]     ` <9f34498d15cd400eb2db76212778c038@MUC-SRV-MBX2.advaoptical.com>
2014-05-07 12:44       ` Samuel Monderer

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).