DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michael Qiu <michael.qiu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/2 v4] Fix compile issue with hugepage_sz in 32-bit system
Date: Wed, 10 Dec 2014 18:46:41 +0800	[thread overview]
Message-ID: <1418208402-7597-2-git-send-email-michael.qiu@intel.com> (raw)
In-Reply-To: <1418208402-7597-1-git-send-email-michael.qiu@intel.com>

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

This was introuduced by commit b77b5639:
        mem: add huge page sizes for IBM Power

The root cause is that size_t is 32-bit in i686 platform,
but RTE_PGSIZE_16M and RTE_PGSIZE_16G are always 64-bit.

Force hugepage_sz to always 64-bit to avoid this issue.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
 v4 ---> v3
	Change hugepage_sz from size_t to uint64_t
	split second bugfix to another patch

 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

 lib/librte_eal/common/eal_common_memory.c   | 2 +-
 lib/librte_eal/common/eal_internal_cfg.h    | 2 +-
 lib/librte_eal/common/include/rte_memory.h  | 2 +-
 lib/librte_eal/common/include/rte_memzone.h | 2 +-
 lib/librte_eal/linuxapp/eal/eal_memory.c    | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c
index 412b432..77830f8 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -96,7 +96,7 @@ rte_dump_physmem_layout(FILE *f)
 
 		fprintf(f, "Segment %u: phys:0x%"PRIx64", len:%zu, "
 		       "virt:%p, socket_id:%"PRId32", "
-		       "hugepage_sz:%zu, nchannel:%"PRIx32", "
+		       "hugepage_sz:%"PRIu64", nchannel:%"PRIx32", "
 		       "nrank:%"PRIx32"\n", i,
 		       mcfg->memseg[i].phys_addr,
 		       mcfg->memseg[i].len,
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index aac6abf..e2ecb0d 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -49,7 +49,7 @@
  * mount points of hugepages
  */
 struct hugepage_info {
-	size_t hugepage_sz;   /**< size of a huge page */
+	uint64_t hugepage_sz;   /**< size of a huge page */
 	const char *hugedir;    /**< dir where hugetlbfs is mounted */
 	uint32_t num_pages[RTE_MAX_NUMA_NODES];
 				/**< number of hugepages of that size on each socket */
diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h
index 1990833..7f8103f 100644
--- a/lib/librte_eal/common/include/rte_memory.h
+++ b/lib/librte_eal/common/include/rte_memory.h
@@ -92,7 +92,7 @@ struct rte_memseg {
 	phys_addr_t ioremap_addr; /**< Real physical address inside the VM */
 #endif
 	size_t len;               /**< Length of the segment. */
-	size_t hugepage_sz;       /**< The pagesize of underlying memory */
+	uint64_t hugepage_sz;       /**< The pagesize of underlying memory */
 	int32_t socket_id;          /**< NUMA socket ID. */
 	uint32_t nchannel;          /**< Number of channels. */
 	uint32_t nrank;             /**< Number of ranks. */
diff --git a/lib/librte_eal/common/include/rte_memzone.h b/lib/librte_eal/common/include/rte_memzone.h
index 7d47bff..3006e81 100644
--- a/lib/librte_eal/common/include/rte_memzone.h
+++ b/lib/librte_eal/common/include/rte_memzone.h
@@ -83,7 +83,7 @@ struct rte_memzone {
 #endif
 	size_t len;                       /**< Length of the memzone. */
 
-	size_t hugepage_sz;               /**< The page size of underlying memory */
+	uint64_t hugepage_sz;               /**< The page size of underlying memory */
 
 	int32_t socket_id;                /**< NUMA socket ID. */
 
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 700aba2..566a052 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -300,7 +300,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl,
 #endif
 
 	for (i = 0; i < hpi->num_pages[0]; i++) {
-		size_t hugepage_sz = hpi->hugepage_sz;
+		uint64_t hugepage_sz = hpi->hugepage_sz;
 
 		if (orig) {
 			hugepg_tbl[i].file_id = i;
-- 
1.9.3

  reply	other threads:[~2014-12-10 10:47 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] Fix two compile issues with i686 platform 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
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               ` Michael Qiu [this message]
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=1418208402-7597-2-git-send-email-michael.qiu@intel.com \
    --to=michael.qiu@intel.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).