[dpdk-dev] [PATCH v3] Fix two compile issues with i686 platform

Neil Horman nhorman at tuxdriver.com
Fri Dec 5 15:22:05 CET 2014


On Fri, Dec 05, 2014 at 04:31:47PM +0800, Chao Zhu wrote:
> 
> 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 at 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
> >
NACK, this is the wrong way to fix this problem.  Pagesizes are independent of
architecutre.  While a system can't have a hugepage size that exceeds its
virtual address limit, theres no need to do per-architecture special casing of
page sizes here.  Instead of littering the code with ifdef RTE_ARCH_64
everytime you want to check a page size, just convert the size_t to a uint64_t
and you can allow all of the enumerated page types on all architecutres, and
save yourself some ifdeffing in the process.

Neil



More information about the dev mailing list