DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] lib/eal: resolve address conflicts
       [not found] <1572680282-89785-1-git-send-email-dengxiaofeng@huawei.com>
@ 2019-11-04  6:32 ` Wangyu (Turing Solution Development Dep)
  2019-11-04 10:14   ` Burakov, Anatoly
  0 siblings, 1 reply; 5+ messages in thread
From: Wangyu (Turing Solution Development Dep) @ 2019-11-04  6:32 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Linuxarm, humin (Q), Liyuan (Larry), dengxiaofeng


Resolve address conflicts on 64K pagesize without base_virtaddr, which cause new address conflicts in eal_get_virtual_area().

Signed-off-by: Beard-627 <dengxiaofeng@huawei.com>
Acked-by: Eric wang <seven.wangyu@huawei.com>
Acked-by: Wei Hu <xavier.huwei@huawei.com>
Acked-by: Min Hu <humin29@huawei.com>
---
 lib/librte_eal/linux/eal/eal.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index 946222c..c15d406 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -360,6 +360,28 @@ enum rte_iova_mode
 		return -1;
 	}
 
+	if ((getpagesize() == RTE_PGSIZE_64K) &&
+		(internal_config.base_virtaddr == 0)) {
+
+		munmap(rte_mem_cfg_addr, sizeof(*rte_config.mem_config));
+		rte_mem_cfg_addr = (void *)RTE_PTR_ALIGN_CEIL(
+			(uintptr_t)rte_mem_cfg_addr, (size_t)RTE_PGSIZE_16M);
+		rte_mem_cfg_addr = (void *)RTE_ALIGN_FLOOR(
+			(uintptr_t)rte_mem_cfg_addr -
+			sizeof(*rte_config.mem_config), sysconf(_SC_PAGE_SIZE));
+
+		rte_mem_cfg_addr = mmap(rte_mem_cfg_addr,
+			sizeof(*rte_config.mem_config),
+			PROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);
+
+		if (rte_mem_cfg_addr == MAP_FAILED) {
+			close(mem_cfg_fd);
+			mem_cfg_fd = -1;
+			RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config\n");
+			return -1;
+		}
+	}
+
 	memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));
 	rte_config.mem_config = rte_mem_cfg_addr;
 
--
1.8.3.1

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

* Re: [dpdk-dev] [PATCH] lib/eal: resolve address conflicts
  2019-11-04  6:32 ` [dpdk-dev] [PATCH] lib/eal: resolve address conflicts Wangyu (Turing Solution Development Dep)
@ 2019-11-04 10:14   ` Burakov, Anatoly
  2019-11-13  7:34     ` David Marchand
  0 siblings, 1 reply; 5+ messages in thread
From: Burakov, Anatoly @ 2019-11-04 10:14 UTC (permalink / raw)
  To: Wangyu (Turing Solution Development Dep), dev
  Cc: ferruh.yigit, Linuxarm, humin (Q), Liyuan (Larry), dengxiaofeng

On 04-Nov-19 6:32 AM, Wangyu (Turing Solution Development Dep) wrote:
> 
> Resolve address conflicts on 64K pagesize without base_virtaddr, which cause new address conflicts in eal_get_virtual_area().
> 
> Signed-off-by: Beard-627 <dengxiaofeng@huawei.com>
> Acked-by: Eric wang <seven.wangyu@huawei.com>
> Acked-by: Wei Hu <xavier.huwei@huawei.com>
> Acked-by: Min Hu <humin29@huawei.com>
> ---
>   lib/librte_eal/linux/eal/eal.c | 22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)
> 
> diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index 946222c..c15d406 100644
> --- a/lib/librte_eal/linux/eal/eal.c
> +++ b/lib/librte_eal/linux/eal/eal.c
> @@ -360,6 +360,28 @@ enum rte_iova_mode
>   		return -1;
>   	}
>   
> +	if ((getpagesize() == RTE_PGSIZE_64K) &&
> +		(internal_config.base_virtaddr == 0)) {
> +
> +		munmap(rte_mem_cfg_addr, sizeof(*rte_config.mem_config));
> +		rte_mem_cfg_addr = (void *)RTE_PTR_ALIGN_CEIL(
> +			(uintptr_t)rte_mem_cfg_addr, (size_t)RTE_PGSIZE_16M);
> +		rte_mem_cfg_addr = (void *)RTE_ALIGN_FLOOR(
> +			(uintptr_t)rte_mem_cfg_addr -
> +			sizeof(*rte_config.mem_config), sysconf(_SC_PAGE_SIZE));

Please use RTE_PTR_ADD and RTE_PTR_DIFF to perform pointer arithmetic.

> +
> +		rte_mem_cfg_addr = mmap(rte_mem_cfg_addr,
> +			sizeof(*rte_config.mem_config),
> +			PROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);
> +
> +		if (rte_mem_cfg_addr == MAP_FAILED) {
> +			close(mem_cfg_fd);
> +			mem_cfg_fd = -1;
> +			RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config\n");
> +			return -1;
> +		}
> +	}
> +
>   	memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));
>   	rte_config.mem_config = rte_mem_cfg_addr;
>   
> --
> 1.8.3.1
> 

The patch requires a bit more explanation - what exactly is the problem, 
and why the solution is as above? Also, did you test it on the latest 
master, since the eal_get_virtal_area() patches [1] got merged?

[1] http://patches.dpdk.org/project/dpdk/list/?series=7043&state=*

-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] [PATCH] lib/eal: resolve address conflicts
  2019-11-04 10:14   ` Burakov, Anatoly
@ 2019-11-13  7:34     ` David Marchand
       [not found]       ` <D3165BB52137B64493C4E18DC69F10D62C8F4C5B@dggemm521-mbx.china.huawei.com>
  0 siblings, 1 reply; 5+ messages in thread
From: David Marchand @ 2019-11-13  7:34 UTC (permalink / raw)
  To: Wangyu (Turing Solution Development Dep)
  Cc: dev, ferruh.yigit, Linuxarm, humin (Q), Liyuan (Larry),
	dengxiaofeng, Burakov, Anatoly

On Mon, Nov 4, 2019 at 11:15 AM Burakov, Anatoly
<anatoly.burakov@intel.com> wrote:
>
> On 04-Nov-19 6:32 AM, Wangyu (Turing Solution Development Dep) wrote:
> >
> > Resolve address conflicts on 64K pagesize without base_virtaddr, which cause new address conflicts in eal_get_virtual_area().
> >
> > Signed-off-by: Beard-627 <dengxiaofeng@huawei.com>
> > Acked-by: Eric wang <seven.wangyu@huawei.com>
> > Acked-by: Wei Hu <xavier.huwei@huawei.com>
> > Acked-by: Min Hu <humin29@huawei.com>
> > ---
> >   lib/librte_eal/linux/eal/eal.c | 22 ++++++++++++++++++++++
> >   1 file changed, 22 insertions(+)
> >
> > diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index 946222c..c15d406 100644
> > --- a/lib/librte_eal/linux/eal/eal.c
> > +++ b/lib/librte_eal/linux/eal/eal.c
> > @@ -360,6 +360,28 @@ enum rte_iova_mode
> >               return -1;
> >       }
> >
> > +     if ((getpagesize() == RTE_PGSIZE_64K) &&
> > +             (internal_config.base_virtaddr == 0)) {
> > +
> > +             munmap(rte_mem_cfg_addr, sizeof(*rte_config.mem_config));
> > +             rte_mem_cfg_addr = (void *)RTE_PTR_ALIGN_CEIL(
> > +                     (uintptr_t)rte_mem_cfg_addr, (size_t)RTE_PGSIZE_16M);
> > +             rte_mem_cfg_addr = (void *)RTE_ALIGN_FLOOR(
> > +                     (uintptr_t)rte_mem_cfg_addr -
> > +                     sizeof(*rte_config.mem_config), sysconf(_SC_PAGE_SIZE));
>
> Please use RTE_PTR_ADD and RTE_PTR_DIFF to perform pointer arithmetic.
>
> > +
> > +             rte_mem_cfg_addr = mmap(rte_mem_cfg_addr,
> > +                     sizeof(*rte_config.mem_config),
> > +                     PROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);
> > +
> > +             if (rte_mem_cfg_addr == MAP_FAILED) {
> > +                     close(mem_cfg_fd);
> > +                     mem_cfg_fd = -1;
> > +                     RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config\n");
> > +                     return -1;
> > +             }
> > +     }
> > +
> >       memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));
> >       rte_config.mem_config = rte_mem_cfg_addr;
> >
> > --
> > 1.8.3.1
> >
>
> The patch requires a bit more explanation - what exactly is the problem,
> and why the solution is as above? Also, did you test it on the latest
> master, since the eal_get_virtal_area() patches [1] got merged?
>
> [1] http://patches.dpdk.org/project/dpdk/list/?series=7043&state=*

Please, do you still have an issue after the fix Anatoly pointed at?
Thanks.


-- 
David Marchand


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

* [dpdk-dev] 答复:  [PATCH] lib/eal: resolve address conflicts
       [not found]       ` <D3165BB52137B64493C4E18DC69F10D62C8F4C5B@dggemm521-mbx.china.huawei.com>
@ 2019-11-13  7:46         ` Wangyu (Eric)
  2019-11-13  7:54           ` [dpdk-dev] " David Marchand
  0 siblings, 1 reply; 5+ messages in thread
From: Wangyu (Eric) @ 2019-11-13  7:46 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, ferruh.yigit, Linuxarm, humin (Q), Liyuan (Larry),
	Burakov, Anatoly, dengxiaofeng


The problem has been solved after that fix, it's a good solution to this problem :)

And many thanks to you and Anatoly.


-----邮件原件-----
发件人: David Marchand [mailto:david.marchand@redhat.com]
发送时间: 2019年11月13日 15:34
收件人: Wangyu (Eric) <seven.wangyu@huawei.com>
抄送: dev@dpdk.org; ferruh.yigit@intel.com; Linuxarm <linuxarm@huawei.com>; humin (Q) <humin29@huawei.com>; Liyuan (Larry) <Larry.T@huawei.com>; dengxiaofeng <dengxiaofeng@huawei.com>; Burakov, Anatoly <anatoly.burakov@intel.com>
主题: Re: [dpdk-dev] [PATCH] lib/eal: resolve address conflicts

On Mon, Nov 4, 2019 at 11:15 AM Burakov, Anatoly <anatoly.burakov@intel.com> wrote:
>
> On 04-Nov-19 6:32 AM, Wangyu (Turing Solution Development Dep) wrote:
> >
> > Resolve address conflicts on 64K pagesize without base_virtaddr, which cause new address conflicts in eal_get_virtual_area().
> >
> > Signed-off-by: Beard-627 <dengxiaofeng@huawei.com>
> > Acked-by: Eric wang <seven.wangyu@huawei.com>
> > Acked-by: Wei Hu <xavier.huwei@huawei.com>
> > Acked-by: Min Hu <humin29@huawei.com>
> > ---
> >   lib/librte_eal/linux/eal/eal.c | 22 ++++++++++++++++++++++
> >   1 file changed, 22 insertions(+)
> >
> > diff --git a/lib/librte_eal/linux/eal/eal.c 
> > b/lib/librte_eal/linux/eal/eal.c index 946222c..c15d406 100644
> > --- a/lib/librte_eal/linux/eal/eal.c
> > +++ b/lib/librte_eal/linux/eal/eal.c
> > @@ -360,6 +360,28 @@ enum rte_iova_mode
> >               return -1;
> >       }
> >
> > +     if ((getpagesize() == RTE_PGSIZE_64K) &&
> > +             (internal_config.base_virtaddr == 0)) {
> > +
> > +             munmap(rte_mem_cfg_addr, sizeof(*rte_config.mem_config));
> > +             rte_mem_cfg_addr = (void *)RTE_PTR_ALIGN_CEIL(
> > +                     (uintptr_t)rte_mem_cfg_addr, (size_t)RTE_PGSIZE_16M);
> > +             rte_mem_cfg_addr = (void *)RTE_ALIGN_FLOOR(
> > +                     (uintptr_t)rte_mem_cfg_addr -
> > +                     sizeof(*rte_config.mem_config), 
> > + sysconf(_SC_PAGE_SIZE));
>
> Please use RTE_PTR_ADD and RTE_PTR_DIFF to perform pointer arithmetic.
>
> > +
> > +             rte_mem_cfg_addr = mmap(rte_mem_cfg_addr,
> > +                     sizeof(*rte_config.mem_config),
> > +                     PROT_READ | PROT_WRITE, MAP_SHARED, 
> > + mem_cfg_fd, 0);
> > +
> > +             if (rte_mem_cfg_addr == MAP_FAILED) {
> > +                     close(mem_cfg_fd);
> > +                     mem_cfg_fd = -1;
> > +                     RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config\n");
> > +                     return -1;
> > +             }
> > +     }
> > +
> >       memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));
> >       rte_config.mem_config = rte_mem_cfg_addr;
> >
> > --
> > 1.8.3.1
> >
>
> The patch requires a bit more explanation - what exactly is the 
> problem, and why the solution is as above? Also, did you test it on 
> the latest master, since the eal_get_virtal_area() patches [1] got merged?
>
> [1] http://patches.dpdk.org/project/dpdk/list/?series=7043&state=*

Please, do you still have an issue after the fix Anatoly pointed at?
Thanks.


--
David Marchand


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

* Re: [dpdk-dev] [PATCH] lib/eal: resolve address conflicts
  2019-11-13  7:46         ` [dpdk-dev] 答复: " Wangyu (Eric)
@ 2019-11-13  7:54           ` David Marchand
  0 siblings, 0 replies; 5+ messages in thread
From: David Marchand @ 2019-11-13  7:54 UTC (permalink / raw)
  To: Wangyu (Eric)
  Cc: dev, ferruh.yigit, Linuxarm, humin (Q), Liyuan (Larry),
	Burakov, Anatoly, dengxiaofeng

On Wed, Nov 13, 2019 at 8:46 AM Wangyu (Eric) <seven.wangyu@huawei.com> wrote:
>
>
> The problem has been solved after that fix, it's a good solution to this problem :)

Cool, marking this patch as rejected.


> And many thanks to you and Anatoly.

You are welcome.


-- 
David Marchand


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

end of thread, other threads:[~2019-11-13  7:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1572680282-89785-1-git-send-email-dengxiaofeng@huawei.com>
2019-11-04  6:32 ` [dpdk-dev] [PATCH] lib/eal: resolve address conflicts Wangyu (Turing Solution Development Dep)
2019-11-04 10:14   ` Burakov, Anatoly
2019-11-13  7:34     ` David Marchand
     [not found]       ` <D3165BB52137B64493C4E18DC69F10D62C8F4C5B@dggemm521-mbx.china.huawei.com>
2019-11-13  7:46         ` [dpdk-dev] 答复: " Wangyu (Eric)
2019-11-13  7:54           ` [dpdk-dev] " David Marchand

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