DPDK patches and discussions
 help / color / mirror / Atom feed
From: santosh <santosh.shukla@caviumnetworks.com>
To: Anatoly Burakov <anatoly.burakov@intel.com>, dev@dpdk.org
Cc: thomas@monjalon.net, stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 2/4] eal: do not use physical addresses in IOVA as VA mode
Date: Mon, 2 Apr 2018 11:05:42 +0530	[thread overview]
Message-ID: <21509d3e-fc7f-bf00-ee7c-fa20b41ac228@caviumnetworks.com> (raw)
In-Reply-To: <4868d2ccaffa1ae0d793fe10623d3e303a514ccf.1522585461.git.anatoly.burakov@intel.com>


On Sunday 01 April 2018 05:56 PM, Anatoly Burakov wrote:
> We already use VA addresses for IOVA purposes everywhere if we're in
> RTE_IOVA_VA mode:
>  1) rte_malloc_virt2phy()/rte_malloc_virt2iova() always return VA addresses
>  2) Because of 1), memzone's IOVA is set to VA address on reserve
>  3) Because of 2), mempool's IOVA addresses are set to VA addresses
>
> The only place where actual physical addresses are stored is in memsegs at
> init time, but we're not using them anywhere, and there is no external API
> to get those addresses (aside from manually iterating through memsegs), nor
> should anyone care about them in RTE_IOVA_VA mode.
>
> So, fix EAL initialization to allocate VA-contiguous segments at the start
> without regard for physical addresses (as if they weren't available), and
> use VA to set final IOVA addresses for all pages.
>
> Fixes: 62196f4e0941 ("mem: rename address mapping function to IOVA")
> Cc: thomas@monjalon.net
> Cc: stable@dpdk.org
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  lib/librte_eal/linuxapp/eal/eal_memory.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
> index 38853b7..ecf375b 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
> @@ -473,6 +473,9 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
>  			hugepg_tbl[i].orig_va = virtaddr;
>  		}
>  		else {
> +			/* rewrite physical addresses in IOVA as VA mode */
> +			if (rte_eal_iova_mode() == RTE_IOVA_VA)
> +				hugepg_tbl[i].physaddr = (uintptr_t)virtaddr;
>  			hugepg_tbl[i].final_va = virtaddr;
>  		}
>  
> @@ -1091,7 +1094,8 @@ rte_eal_hugepage_init(void)
>  				continue;
>  		}
>  
> -		if (phys_addrs_available) {
> +		if (phys_addrs_available &&
> +				rte_eal_iova_mode() != RTE_IOVA_VA) {

Also can be done like below:
if (phys_addrs_available)
	/* find physical addresses for each hugepage */
	if (find_iovaaddrs(&tmp_hp[hp_offset], hpi) < 0) {

such that;
find_iovaaddrs() --> rte_mem_virt2iova().

That way avoid iova check in above if loop.
does that make sense?
Thanks.
[...]

  reply	other threads:[~2018-04-02  5:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-01 12:26 [dpdk-dev] [PATCH 1/4] test-crypto-perf: use virt2iova to get op IOVA address Anatoly Burakov
2018-04-01 12:26 ` [dpdk-dev] [PATCH 2/4] eal: do not use physical addresses in IOVA as VA mode Anatoly Burakov
2018-04-02  5:35   ` santosh [this message]
2018-04-02 10:02     ` Burakov, Anatoly
2018-04-02 13:02       ` santosh
2018-04-01 12:26 ` [dpdk-dev] [PATCH 3/4] fslmc: do not needlessly check for IOVA mode Anatoly Burakov
2018-04-02  7:47   ` Hemant Agrawal
2018-04-01 12:26 ` [dpdk-dev] [PATCH 4/4] vfio: " Anatoly Burakov
2018-04-02 16:29   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-04-02 17:12     ` Burakov, Anatoly
2018-04-02 19:55       ` Thomas Monjalon
2018-04-02 12:34 ` [dpdk-dev] [PATCH 1/4] test-crypto-perf: use virt2iova to get op IOVA address De Lara Guarch, Pablo
2018-04-04 12:39 ` [dpdk-dev] [PATCH v2 1/4] app/crypto-perf: " Anatoly Burakov
2018-04-04 14:40   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
2018-04-04 14:40   ` [dpdk-dev] [PATCH v3 2/4] eal: do not use physical addresses in IOVA as VA mode Anatoly Burakov
2018-04-04 14:40   ` [dpdk-dev] [PATCH v3 3/4] fslmc: do not needlessly check for IOVA mode Anatoly Burakov
2018-04-04 14:40   ` [dpdk-dev] [PATCH v3 4/4] vfio: " Anatoly Burakov
2018-04-11  0:19     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-04-04 12:39 ` [dpdk-dev] [PATCH v2 2/4] eal: do not use physical addresses in IOVA as VA mode Anatoly Burakov
2018-04-04 12:39 ` [dpdk-dev] [PATCH v2 3/4] fslmc: do not needlessly check for IOVA mode Anatoly Burakov
2018-04-04 12:39 ` [dpdk-dev] [PATCH v2 4/4] vfio: " Anatoly Burakov

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=21509d3e-fc7f-bf00-ee7c-fa20b41ac228@caviumnetworks.com \
    --to=santosh.shukla@caviumnetworks.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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).