eal: fix build for 32-bit system
authorMichael Qiu <michael.qiu@intel.com>
Wed, 10 Dec 2014 10:46:41 +0000 (18:46 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 11 Dec 2014 00:42:02 +0000 (01:42 +0100)
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)) {
    ^

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>
Suggested-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
lib/librte_eal/common/eal_common_memory.c
lib/librte_eal/common/eal_internal_cfg.h
lib/librte_eal/common/include/rte_memory.h
lib/librte_eal/common/include/rte_memzone.h
lib/librte_eal/linuxapp/eal/eal_memory.c

index 412b432..77830f8 100644 (file)
@@ -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,
index aac6abf..e2ecb0d 100644 (file)
@@ -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 */
index 1990833..7f8103f 100644 (file)
@@ -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. */
index 7d47bff..81b6ad4 100644 (file)
@@ -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. */
 
index e6cb919..bae2507 100644 (file)
@@ -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;