From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id A4FE0282 for ; Wed, 10 Dec 2014 11:47:00 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 10 Dec 2014 02:45:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,551,1413270000"; d="scan'208";a="621507935" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 10 Dec 2014 02:46:55 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id sBAAkrDM031243; Wed, 10 Dec 2014 18:46:53 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id sBAAkobS007639; Wed, 10 Dec 2014 18:46:52 +0800 Received: (from dayuqiu@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id sBAAko1r007635; Wed, 10 Dec 2014 18:46:50 +0800 From: Michael Qiu To: dev@dpdk.org Date: Wed, 10 Dec 2014 18:46:41 +0800 Message-Id: <1418208402-7597-2-git-send-email-michael.qiu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1418208402-7597-1-git-send-email-michael.qiu@intel.com> References: <1417684369-21330-1-git-send-email-michael.qiu@intel.com> <1418208402-7597-1-git-send-email-michael.qiu@intel.com> Subject: [dpdk-dev] [PATCH 1/2 v4] Fix compile issue with hugepage_sz in 32-bit system X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 10:47:02 -0000 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 --- 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