DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chao Zhu <chaozhu@linux.vnet.ibm.com>
To: Michael Qiu <qdy220091330@gmail.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v3] Fix two compile issues with i686 platform
Date: Fri, 05 Dec 2014 16:31:47 +0800	[thread overview]
Message-ID: <54816D73.1020906@linux.vnet.ibm.com> (raw)
In-Reply-To: <1417684369-21330-1-git-send-email-michael.qiu@intel.com>


On 2014/12/4 17:12, Michael Qiu wrote:
> lib/librte_eal/linuxapp/eal/eal_memory.c:324:4: error: comparison
> is always false due to limited range of data type [-Werror=type-limits]
>      || (hugepage_sz == RTE_PGSIZE_16G)) {
>      ^
> cc1: all warnings being treated as errors
>
> lib/librte_eal/linuxapp/eal/eal.c(461): error #2259: non-pointer
> conversion from "long long" to "void *" may lose significant bits
>     RTE_PTR_ALIGN_CEIL((uintptr_t)addr, RTE_PGSIZE_16M);
>
> This was introuduced by commit b77b5639:
>          mem: add huge page sizes for IBM Power
>
> The root cause is that size_t and uintptr_t are 32-bit in i686
> platform, but RTE_PGSIZE_16M and RTE_PGSIZE_16G are always 64-bit.
>
> Define RTE_PGSIZE_16G only in 64 bit platform to avoid
> this issue.
>
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> ---
>   v3 ---> v2
> 	Change RTE_PGSIZE_16G from ULL to UL
> 	to keep all entries consistent
>
>   V2 ---> v1
> 	Change two type entries to one, and
> 	leave RTE_PGSIZE_16G only valid for
> 	64-bit platform
>
>   app/test/test_memzone.c                    | 18 ++++++++++++------
>   lib/librte_eal/common/eal_common_memzone.c |  2 ++
>   lib/librte_eal/common/include/rte_memory.h | 14 ++++++++------
>   lib/librte_eal/linuxapp/eal/eal_memory.c   | 12 +++++-------
>   4 files changed, 27 insertions(+), 19 deletions(-)
>
> diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c
> index 5da6903..7bab8b5 100644
> --- a/app/test/test_memzone.c
> +++ b/app/test/test_memzone.c
> @@ -145,8 +145,10 @@ test_memzone_reserve_flags(void)
>   			hugepage_1GB_avail = 1;
>   		if (ms[i].hugepage_sz == RTE_PGSIZE_16M)
>   			hugepage_16MB_avail = 1;
> +#ifdef RTE_ARCH_64
>   		if (ms[i].hugepage_sz == RTE_PGSIZE_16G)
>   			hugepage_16GB_avail = 1;
> +#endif
>   	}
>   	/* Display the availability of 2MB ,1GB, 16MB, 16GB pages */
>   	if (hugepage_2MB_avail)
> @@ -234,8 +236,8 @@ test_memzone_reserve_flags(void)
>   			return -1;
>   		}
>
> -		/* Check if 1GB huge pages are unavailable, that function fails unless
> -		 * HINT flag is indicated
> +		/* Check if 2MB huge pages are unavailable, that function
> +		 * fails unless HINT flag is indicated
>   		 */
>   		if (!hugepage_2MB_avail) {
>   			mz = rte_memzone_reserve("flag_zone_2M_HINT", size, SOCKET_ID_ANY,
> @@ -295,8 +297,9 @@ test_memzone_reserve_flags(void)
>   			return -1;
>   		}
>
> -		/* Check if 1GB huge pages are unavailable, that function fails
> -		 * unless HINT flag is indicated
> +#ifdef RTE_ARCH_64
> +		/* Check if 16GB huge pages are unavailable, that function
> +		 * fails unless HINT flag is indicated
>   		 */
>   		if (!hugepage_16GB_avail) {
>   			mz = rte_memzone_reserve("flag_zone_16G_HINT", size,
> @@ -318,7 +321,9 @@ test_memzone_reserve_flags(void)
>   				return -1;
>   			}
>   		}
> +#endif
>   	}
> +#ifdef RTE_ARCH_64
>   	/*As with 16MB tests above for 16GB huge page requests*/
>   	if (hugepage_16GB_avail) {
>   		mz = rte_memzone_reserve("flag_zone_16G", size, SOCKET_ID_ANY,
> @@ -343,8 +348,8 @@ test_memzone_reserve_flags(void)
>   			return -1;
>   		}
>
> -		/* Check if 1GB huge pages are unavailable, that function fails
> -		 * unless HINT flag is indicated
> +		/* Check if 16MB huge pages are unavailable, that function
> +		 * fails unless HINT flag is indicated
>   		 */
>   		if (!hugepage_16MB_avail) {
>   			mz = rte_memzone_reserve("flag_zone_16M_HINT", size,
> @@ -376,6 +381,7 @@ test_memzone_reserve_flags(void)
>   			}
>   		}
>   	}
> +#endif
>   	return 0;
>   }
>
> diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
> index b5a5d72..ee233ad 100644
> --- a/lib/librte_eal/common/eal_common_memzone.c
> +++ b/lib/librte_eal/common/eal_common_memzone.c
> @@ -221,12 +221,14 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
>   		if ((flags & RTE_MEMZONE_1GB) &&
>   				free_memseg[i].hugepage_sz == RTE_PGSIZE_2M)
>   			continue;
> +#ifdef RTE_ARCH_64
>   		if ((flags & RTE_MEMZONE_16MB) &&
>   				free_memseg[i].hugepage_sz == RTE_PGSIZE_16G)
>   			continue;
>   		if ((flags & RTE_MEMZONE_16GB) &&
>   				free_memseg[i].hugepage_sz == RTE_PGSIZE_16M)
>   			continue;
> +#endif
>
>   		/* this segment is the best until now */
>   		if (memseg_idx == -1) {
> diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h
> index 1990833..6bcb92b 100644
> --- a/lib/librte_eal/common/include/rte_memory.h
> +++ b/lib/librte_eal/common/include/rte_memory.h
> @@ -53,12 +53,14 @@ extern "C" {
>   #endif
>
>   enum rte_page_sizes {
> -	RTE_PGSIZE_4K = 1ULL << 12,
> -	RTE_PGSIZE_2M = 1ULL << 21,
> -	RTE_PGSIZE_1G = 1ULL << 30,
> -	RTE_PGSIZE_64K = 1ULL << 16,
> -	RTE_PGSIZE_16M = 1ULL << 24,
> -	RTE_PGSIZE_16G = 1ULL << 34
> +	RTE_PGSIZE_4K	= 1UL << 12,
> +	RTE_PGSIZE_2M	= 1UL << 21,
> +	RTE_PGSIZE_1G	= 1UL << 30,
> +	RTE_PGSIZE_64K	= 1UL << 16,
> +	RTE_PGSIZE_16M	= 1UL << 24,
> +#ifdef RTE_ARCH_64
> +	RTE_PGSIZE_16G	= 1UL << 34
> +#endif
>   };
>
>   #define SOCKET_ID_ANY -1                    /**< Any NUMA socket. */
> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
> index e6cb919..833670c 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
> @@ -317,11 +317,10 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl,
>   			hugepg_tbl[i].filepath[sizeof(hugepg_tbl[i].filepath) - 1] = '\0';
>   		}
>   #ifndef RTE_ARCH_64
> -		/* for 32-bit systems, don't remap 1G and 16G pages, just reuse
> -		 * original map address as final map address.
> +		/* for 32-bit systems, don't remap 1G pages(16G not defined),
> +		 * just reuse original map address as final map address.
>   		 */
> -		else if ((hugepage_sz == RTE_PGSIZE_1G)
> -			|| (hugepage_sz == RTE_PGSIZE_16G)) {
> +		else if (hugepage_sz == RTE_PGSIZE_1G) {
>   			hugepg_tbl[i].final_va = hugepg_tbl[i].orig_va;
>   			hugepg_tbl[i].orig_va = NULL;
>   			continue;
> @@ -422,11 +421,10 @@ remap_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
>   	while (i < hpi->num_pages[0]) {
>
>   #ifndef RTE_ARCH_64
> -		/* for 32-bit systems, don't remap 1G pages and 16G pages,
> +		/* for 32-bit systems, don't remap 1G pages(16G not defined,
>   		 * just reuse original map address as final map address.
>   		 */
> -		if ((hugepage_sz == RTE_PGSIZE_1G)
> -			|| (hugepage_sz == RTE_PGSIZE_16G)) {
> +		if (hugepage_sz == RTE_PGSIZE_1G) {
>   			hugepg_tbl[i].final_va = hugepg_tbl[i].orig_va;
>   			hugepg_tbl[i].orig_va = NULL;
>   			i++;
This patch works on IBM PPC64.

Acked-by: Chao Zhu<chaozhu@linux.vnet.ibm.com>

  parent reply	other threads:[~2014-12-05  8:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1417329845-7482-1-git-send-email-michael.qiu@intel.com>
     [not found] ` <1417594223-2573-1-git-send-email-michael.qiu@intel.com>
2014-12-03 11:32   ` [dpdk-dev] [PATCH v2] " Qiu, Michael
2014-12-03 15:40   ` Bruce Richardson
2014-12-04  2:49     ` Qiu, Michael
2014-12-04  9:03       ` Thomas Monjalon
2014-12-04 10:21         ` Qiu, Michael
2014-12-04  9:12           ` [dpdk-dev] [PATCH v3] " Michael Qiu
2014-12-05  6:56             ` Qiu, Michael
2014-12-05  7:04               ` Chao Zhu
2014-12-05  8:31             ` Chao Zhu [this message]
2014-12-05 14:22               ` Neil Horman
2014-12-05 15:02                 ` Bruce Richardson
2014-12-05 15:24                   ` Neil Horman
2014-12-08  2:46                     ` Qiu, Michael
2014-12-08  2:59                       ` Neil Horman
2014-12-08  3:37                         ` Qiu, Michael
2014-12-08  4:57                           ` Qiu, Michael
2014-12-08 11:37                           ` Neil Horman
2014-12-08 11:50                             ` Thomas Monjalon
2014-12-08 14:59                             ` Qiu, Michael
2014-12-10 10:46             ` [dpdk-dev] [PATCH 0/2 v4] " Michael Qiu
2014-12-10 10:46               ` [dpdk-dev] [PATCH 1/2 v4] Fix compile issue with hugepage_sz in 32-bit system Michael Qiu
2014-12-10 10:46               ` [dpdk-dev] [PATCH 2/2] Fix compile issue of eal with icc compile Michael Qiu
2014-12-11  0:56               ` [dpdk-dev] [PATCH 0/2 v4] Fix two compile issues with i686 platform Thomas Monjalon
2014-12-11 13:25                 ` Neil Horman
2014-12-11 15:28                   ` Qiu, Michael
2014-12-11 21:21                     ` Thomas Monjalon
2014-12-12 11:38                       ` Neil Horman
2014-12-12 15:09                         ` Thomas Monjalon
2014-12-12 15:29                           ` Neil Horman

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=54816D73.1020906@linux.vnet.ibm.com \
    --to=chaozhu@linux.vnet.ibm.com \
    --cc=dev@dpdk.org \
    --cc=qdy220091330@gmail.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).