From: Jan Viktorin <viktorin@rehivetech.com>
To: "Alejandro.Lucero" <alejandro.lucero@netronome.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [dpdk-dev, 1/3] eal/linux: add function for checking hugepages within device supported address range
Date: Thu, 12 May 2016 17:11:22 +0200 [thread overview]
Message-ID: <20160512171122.0f24fda3@pcviktorin.fit.vutbr.cz> (raw)
In-Reply-To: <1463063640-30715-2-git-send-email-alejandro.lucero@netronome.com>
On Thu, 12 May 2016 15:33:58 +0100
"Alejandro.Lucero" <alejandro.lucero@netronome.com> wrote:
> - This is needed for avoiding problems with devices not being able to address
> all the physical available memory.
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#14:
- This is needed for avoiding problems with devices not being able to address
WARNING:LONG_LINE: line over 80 characters
#57: FILE: lib/librte_eal/linuxapp/eal/eal_memory.c:1048:
+ const struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
ERROR:SPACING: spaces required around that '=' (ctx:WxV)
#59: FILE: lib/librte_eal/linuxapp/eal/eal_memory.c:1050:
+ int i =0;
^
WARNING:LONG_LINE_STRING: line over 80 characters
#63: FILE: lib/librte_eal/linuxapp/eal/eal_memory.c:1054:
+ RTE_LOG(DEBUG, EAL, "Checking page with address %"PRIx64" and device"
WARNING:LONG_LINE_STRING: line over 80 characters
#66: FILE: lib/librte_eal/linuxapp/eal/eal_memory.c:1057:
+ RTE_LOG(ERR, EAL, "Allocated hugepages are out of device address"
total: 1 errors, 4 warnings, 45 lines checked
Regards
Jan
>
> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
>
> ---
> lib/librte_eal/common/include/rte_memory.h | 6 ++++++
> lib/librte_eal/linuxapp/eal/eal_memory.c | 27 +++++++++++++++++++++++++++
> 2 files changed, 33 insertions(+)
>
> diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h
> index f8dbece..67b0b28 100644
> --- a/lib/librte_eal/common/include/rte_memory.h
> +++ b/lib/librte_eal/common/include/rte_memory.h
> @@ -256,6 +256,12 @@ rte_mem_phy2mch(uint32_t memseg_id __rte_unused, const phys_addr_t phy_addr)
> }
> #endif
>
> +/**
> + * Check hugepages are within the supported
> + * device address space range.
> + */
> +int rte_eal_hugepage_check_address_mask(uint64_t dma_mask);
> +
> #ifdef __cplusplus
> }
> #endif
> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
> index 5b9132c..2cd046d 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
> @@ -1037,6 +1037,33 @@ calc_num_pages_per_socket(uint64_t * memory,
> }
>
> /*
> + * Some devices have addressing limitations. A PMD will indirectly call this
> + * function raising an error if any hugepage is out of address range supported.
> + * As hugepages are ordered by physical address, there is nothing to do as
> + * any other hugepage available will be out of range as well.
> + */
> +int
> +rte_eal_hugepage_check_address_mask(uint64_t dma_mask)
> +{
> + const struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
> + phys_addr_t physaddr;
> + int i =0;
> +
> + while (i < RTE_MAX_MEMSEG && mcfg->memseg[i].len > 0) {
> + physaddr = mcfg->memseg[i].phys_addr + mcfg->memseg[i].len;
> + RTE_LOG(DEBUG, EAL, "Checking page with address %"PRIx64" and device"
> + " mask 0x%"PRIx64"\n", physaddr, dma_mask);
> + if (physaddr & ~dma_mask) {
> + RTE_LOG(ERR, EAL, "Allocated hugepages are out of device address"
> + " range.");
> + return -1;
> + }
> + i++;
> + }
> + return 0;
> +}
> +
> +/*
> * Prepare physical memory mapping: fill configuration structure with
> * these infos, return 0 on success.
> * 1. map N huge pages in separate files in hugetlbfs
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
next prev parent reply other threads:[~2016-05-12 15:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 14:33 [dpdk-dev] [PATCH 0/3] add support for devices with addressing limitations Alejandro Lucero
2016-05-12 14:33 ` [dpdk-dev] [PATCH 1/3] eal/linux: add function for checking hugepages within device supported address range Alejandro Lucero
2016-05-12 15:11 ` Jan Viktorin [this message]
2016-05-12 14:33 ` [dpdk-dev] [PATCH 2/3] eth_dev: add support for device dma mask Alejandro Lucero
2016-05-12 14:52 ` [dpdk-dev] [dpdk-dev, " Jan Viktorin
2016-05-12 15:03 ` Alejandro Lucero
2016-05-12 15:41 ` Jan Viktorin
2016-05-13 8:38 ` Alejandro Lucero
2016-05-13 13:49 ` Thomas Monjalon
2016-05-12 14:34 ` [dpdk-dev] [PATCH 3/3] nfp: set " Alejandro Lucero
2016-05-12 15:03 ` [dpdk-dev] [dpdk-dev,3/3] " Jan Viktorin
2016-05-12 15:13 ` Alejandro Lucero
2016-05-12 15:19 ` Jan Viktorin
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=20160512171122.0f24fda3@pcviktorin.fit.vutbr.cz \
--to=viktorin@rehivetech.com \
--cc=alejandro.lucero@netronome.com \
--cc=dev@dpdk.org \
/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).