DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: "Wangyu (Turing Solution Development Dep)"
	<seven.wangyu@huawei.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
	Linuxarm <linuxarm@huawei.com>, "humin (Q)" <humin29@huawei.com>,
	"Liyuan (Larry)" <Larry.T@huawei.com>,
	dengxiaofeng <dengxiaofeng@huawei.com>
Subject: Re: [dpdk-dev] [PATCH] lib/eal: resolve address conflicts
Date: Mon, 4 Nov 2019 10:14:52 +0000	[thread overview]
Message-ID: <b4fc320c-56ea-2f2d-ab3d-0aa86b0e704a@intel.com> (raw)
In-Reply-To: <78A93308629D474AA53B84C5879E84D24B0FF9AB@DGGEMM533-MBX.china.huawei.com>

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

  reply	other threads:[~2019-11-04 10:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b4fc320c-56ea-2f2d-ab3d-0aa86b0e704a@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=Larry.T@huawei.com \
    --cc=dengxiaofeng@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=humin29@huawei.com \
    --cc=linuxarm@huawei.com \
    --cc=seven.wangyu@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).