* [dpdk-dev] [PATCH 1/4] eal: fix typo in Xen Dom0 specific code
2016-07-11 10:20 [dpdk-dev] [PATCH 0/4] fix mempool creation with Xen Dom0 Olivier Matz
@ 2016-07-11 10:20 ` Olivier Matz
2016-07-11 10:20 ` [dpdk-dev] [PATCH 2/4] mbuf: set errno on pool creation error Olivier Matz
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Olivier Matz @ 2016-07-11 10:20 UTC (permalink / raw)
To: dev, huilongx.xu, waterman.cao, yuanhan.liu, weichunx.chen, yu.y.liu
Cc: thomas.monjalon
Fix the compilation with CONFIG_RTE_LIBRTE_XEN_DOM0=y, by correcting the
typo in variable names.
Fixes: 8dab48370129 ("xen: return machine address without knowing memseg id")
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
lib/librte_eal/linuxapp/eal/eal_xen_memory.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_xen_memory.c b/lib/librte_eal/linuxapp/eal/eal_xen_memory.c
index 0b612bb..bddbdb0 100644
--- a/lib/librte_eal/linuxapp/eal/eal_xen_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_xen_memory.c
@@ -167,8 +167,8 @@ rte_xen_mem_phy2mch(int32_t memseg_id, const phys_addr_t phy_addr)
if (memseg_id == -1) {
for (i = 0; i < RTE_MAX_MEMSEG; i++) {
if ((phy_addr >= memseg[i].phys_addr) &&
- (phys_addr < memseg[i].phys_addr +
- memseg[i].size)) {
+ (phy_addr < memseg[i].phys_addr +
+ memseg[i].len)) {
memseg_id = i;
break;
}
--
2.8.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 2/4] mbuf: set errno on pool creation error
2016-07-11 10:20 [dpdk-dev] [PATCH 0/4] fix mempool creation with Xen Dom0 Olivier Matz
2016-07-11 10:20 ` [dpdk-dev] [PATCH 1/4] eal: fix typo in Xen Dom0 specific code Olivier Matz
@ 2016-07-11 10:20 ` Olivier Matz
2016-07-11 10:20 ` [dpdk-dev] [PATCH 3/4] eal: fix retrieval of phys address with Xen Dom0 Olivier Matz
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Olivier Matz @ 2016-07-11 10:20 UTC (permalink / raw)
To: dev, huilongx.xu, waterman.cao, yuanhan.liu, weichunx.chen, yu.y.liu
Cc: thomas.monjalon
In rte_pktmbuf_pool_create(), the rte_errno variable was not always
set on failure.
Fixes: 152ca517900b ("mbuf: use default mempool handler from config")
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
lib/librte_mbuf/rte_mbuf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 601e528..4846b89 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -156,6 +156,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
struct rte_mempool *mp;
struct rte_pktmbuf_pool_private mbp_priv;
unsigned elt_size;
+ int ret;
if (RTE_ALIGN(priv_size, RTE_MBUF_PRIV_ALIGN) != priv_size) {
RTE_LOG(ERR, MBUF, "mbuf priv_size=%u is not aligned\n",
@@ -181,8 +182,10 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
}
rte_pktmbuf_pool_init(mp, &mbp_priv);
- if (rte_mempool_populate_default(mp) < 0) {
+ ret = rte_mempool_populate_default(mp);
+ if (ret < 0) {
rte_mempool_free(mp);
+ rte_errno = -ret;
return NULL;
}
--
2.8.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 3/4] eal: fix retrieval of phys address with Xen Dom0
2016-07-11 10:20 [dpdk-dev] [PATCH 0/4] fix mempool creation with Xen Dom0 Olivier Matz
2016-07-11 10:20 ` [dpdk-dev] [PATCH 1/4] eal: fix typo in Xen Dom0 specific code Olivier Matz
2016-07-11 10:20 ` [dpdk-dev] [PATCH 2/4] mbuf: set errno on pool creation error Olivier Matz
@ 2016-07-11 10:20 ` Olivier Matz
2016-07-11 10:20 ` [dpdk-dev] [PATCH 4/4] mempool: fix creation " Olivier Matz
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Olivier Matz @ 2016-07-11 10:20 UTC (permalink / raw)
To: dev, huilongx.xu, waterman.cao, yuanhan.liu, weichunx.chen, yu.y.liu
Cc: thomas.monjalon
When using Xen Dom0, it looks that /proc/self/pagemap returns 0.
This breaks the creation of mbufs pool.
We can workaround this in rte_mem_virt2phy() by browsing the dpdk memory
segments. This only works for dpdk memory, but it's enough to fix the
mempool creation.
Fixes: c042ba20674a ("mempool: rework support of Xen dom0")
Fixes: 3097de6e6bfb ("mem: get physical address of any pointer")
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
lib/librte_eal/linuxapp/eal/eal_memory.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index b663244..42a29fa 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -164,6 +164,29 @@ rte_mem_virt2phy(const void *virtaddr)
int page_size;
off_t offset;
+ /* when using dom0, /proc/self/pagemap always returns 0, check in
+ * dpdk memory by browsing the memsegs */
+ if (rte_xen_dom0_supported()) {
+ struct rte_mem_config *mcfg;
+ struct rte_memseg *memseg;
+ unsigned i;
+
+ mcfg = rte_eal_get_configuration()->mem_config;
+ for (i = 0; i < RTE_MAX_MEMSEG; i++) {
+ memseg = &mcfg->memseg[i];
+ if (memseg->addr == NULL)
+ break;
+ if (virtaddr > memseg->addr &&
+ virtaddr < RTE_PTR_ADD(memseg->addr,
+ memseg->len)) {
+ return memseg->phys_addr +
+ RTE_PTR_DIFF(virtaddr, memseg->addr);
+ }
+ }
+
+ return RTE_BAD_PHYS_ADDR;
+ }
+
/* Cannot parse /proc/self/pagemap, no need to log errors everywhere */
if (!proc_pagemap_readable)
return RTE_BAD_PHYS_ADDR;
--
2.8.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 4/4] mempool: fix creation with Xen Dom0
2016-07-11 10:20 [dpdk-dev] [PATCH 0/4] fix mempool creation with Xen Dom0 Olivier Matz
` (2 preceding siblings ...)
2016-07-11 10:20 ` [dpdk-dev] [PATCH 3/4] eal: fix retrieval of phys address with Xen Dom0 Olivier Matz
@ 2016-07-11 10:20 ` Olivier Matz
2016-07-11 16:23 ` [dpdk-dev] [PATCH 0/4] fix mempool " Olivier Matz
2016-07-11 17:09 ` Thomas Monjalon
5 siblings, 0 replies; 8+ messages in thread
From: Olivier Matz @ 2016-07-11 10:20 UTC (permalink / raw)
To: dev, huilongx.xu, waterman.cao, yuanhan.liu, weichunx.chen, yu.y.liu
Cc: thomas.monjalon
Restore the use of 2M hugepages when using Xen Dom0 that was
dropped during mempool rework.
Fixes: c042ba20674a ("mempool: rework support of Xen dom0")
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
lib/librte_mempool/rte_mempool.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index d78d02b..6ec0906 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -524,7 +524,11 @@ rte_mempool_populate_default(struct rte_mempool *mp)
if (mp->nb_mem_chunks != 0)
return -EEXIST;
- if (rte_eal_has_hugepages()) {
+ if (rte_xen_dom0_supported()) {
+ pg_sz = RTE_PGSIZE_2M;
+ pg_shift = rte_bsf32(pg_sz);
+ align = pg_sz;
+ } else if (rte_eal_has_hugepages()) {
pg_shift = 0; /* not needed, zone is physically contiguous */
pg_sz = 0;
align = RTE_CACHE_LINE_SIZE;
--
2.8.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 0/4] fix mempool creation with Xen Dom0
2016-07-11 10:20 [dpdk-dev] [PATCH 0/4] fix mempool creation with Xen Dom0 Olivier Matz
` (3 preceding siblings ...)
2016-07-11 10:20 ` [dpdk-dev] [PATCH 4/4] mempool: fix creation " Olivier Matz
@ 2016-07-11 16:23 ` Olivier Matz
2016-07-11 17:09 ` Thomas Monjalon
5 siblings, 0 replies; 8+ messages in thread
From: Olivier Matz @ 2016-07-11 16:23 UTC (permalink / raw)
To: dev, huilongx.xu, waterman.cao, yuanhan.liu, weichunx.chen, yu.y.liu
Cc: thomas.monjalon
On 07/11/2016 12:20 PM, Olivier Matz wrote:
> Since the recent mempool rework [1], Xen Dom0 is broken.
> This series aims at fixing it. I think it should be integrated
> in 16.07.
>
> As I don't have a full testing platform, any help in validating
> this patchset would be appreciated.
>
> [1] http://www.dpdk.org/ml/archives/dev/2016-May/039229.html
I forgot to mention:
Reported-by: Xu, HuilongX <huilongx.xu@intel.com>
Thanks
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 0/4] fix mempool creation with Xen Dom0
2016-07-11 10:20 [dpdk-dev] [PATCH 0/4] fix mempool creation with Xen Dom0 Olivier Matz
` (4 preceding siblings ...)
2016-07-11 16:23 ` [dpdk-dev] [PATCH 0/4] fix mempool " Olivier Matz
@ 2016-07-11 17:09 ` Thomas Monjalon
2016-07-12 0:31 ` Chen, WeichunX
5 siblings, 1 reply; 8+ messages in thread
From: Thomas Monjalon @ 2016-07-11 17:09 UTC (permalink / raw)
To: Olivier Matz
Cc: dev, huilongx.xu, waterman.cao, yuanhan.liu, weichunx.chen, yu.y.liu
2016-07-11 12:20, Olivier Matz:
> Since the recent mempool rework [1], Xen Dom0 is broken.
> This series aims at fixing it. I think it should be integrated
> in 16.07.
>
> As I don't have a full testing platform, any help in validating
> this patchset would be appreciated.
>
> [1] http://www.dpdk.org/ml/archives/dev/2016-May/039229.html
>
> Olivier Matz (4):
> eal: fix typo in Xen Dom0 specific code
> mbuf: set errno on pool creation error
> eal: fix retrieval of phys address with Xen Dom0
> mempool: fix creation with Xen Dom0
Applied with an additional fix:
xen: fix build as shared library
When building as shared library, the compiler complains for
undefined reference to `rte_xen_mem_phy2mch'
The symbol rte_xen_mem_phy2mch was introduced in DPDK 2.2
and has been called in mempool recently via rte_mem_phy2mch.
Fixes: c042ba20674a ("mempool: rework support of Xen dom0")
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 0/4] fix mempool creation with Xen Dom0
2016-07-11 17:09 ` Thomas Monjalon
@ 2016-07-12 0:31 ` Chen, WeichunX
0 siblings, 0 replies; 8+ messages in thread
From: Chen, WeichunX @ 2016-07-12 0:31 UTC (permalink / raw)
To: Thomas Monjalon, Olivier Matz, Xu, HuilongX
Cc: dev, Xu, HuilongX, Cao, Waterman, Liu, Yuanhan, Liu, Yu Y
Add huilong
-----Original Message-----
From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
Sent: Tuesday, July 12, 2016 1:10 AM
To: Olivier Matz <olivier.matz@6wind.com>
Cc: dev@dpdk.org; Xu, HuilongX <huilongx.xu@intel.com>; Cao, Waterman <waterman.cao@intel.com>; Liu, Yuanhan <yuanhan.liu@intel.com>; Chen, WeichunX <weichunx.chen@intel.com>; Liu, Yu Y <yu.y.liu@intel.com>
Subject: Re: [PATCH 0/4] fix mempool creation with Xen Dom0
2016-07-11 12:20, Olivier Matz:
> Since the recent mempool rework [1], Xen Dom0 is broken.
> This series aims at fixing it. I think it should be integrated in
> 16.07.
>
> As I don't have a full testing platform, any help in validating this
> patchset would be appreciated.
>
> [1] http://www.dpdk.org/ml/archives/dev/2016-May/039229.html
>
> Olivier Matz (4):
> eal: fix typo in Xen Dom0 specific code
> mbuf: set errno on pool creation error
> eal: fix retrieval of phys address with Xen Dom0
> mempool: fix creation with Xen Dom0
Applied with an additional fix:
xen: fix build as shared library
When building as shared library, the compiler complains for
undefined reference to `rte_xen_mem_phy2mch'
The symbol rte_xen_mem_phy2mch was introduced in DPDK 2.2
and has been called in mempool recently via rte_mem_phy2mch.
Fixes: c042ba20674a ("mempool: rework support of Xen dom0")
^ permalink raw reply [flat|nested] 8+ messages in thread