From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 17A8A7F58 for ; Wed, 3 Dec 2014 12:32:23 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 03 Dec 2014 03:32:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,507,1413270000"; d="scan'208";a="641796194" Received: from pgsmsx105.gar.corp.intel.com ([10.221.44.96]) by fmsmga002.fm.intel.com with ESMTP; 03 Dec 2014 03:32:07 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by pgsmsx105.gar.corp.intel.com (10.221.44.96) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 3 Dec 2014 19:32:03 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.86]) with mapi id 14.03.0195.001; Wed, 3 Dec 2014 19:32:02 +0800 From: "Qiu, Michael" To: Michael Qiu , "dev@dpdk.org" Thread-Topic: [PATCH v2] Fix two compile issues with i686 platform Thread-Index: AQHQDtC2sNKGP0Pvek+HmA2FP8qVgQ== Date: Wed, 3 Dec 2014 11:32:02 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286C9C4A8@SHSMSX101.ccr.corp.intel.com> References: <1417329845-7482-1-git-send-email-michael.qiu@intel.com> <1417594223-2573-1-git-send-email-michael.qiu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] Fix two compile issues with i686 platform 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, 03 Dec 2014 11:32:25 -0000 Hi all,=0A= =0A= Any comments on this patch?=0A= =0A= It is really a big issue in dpdk1.8-rc2 and blocked the testing on i686=0A= platform.=0A= =0A= Thanks,=0A= Michael=0A= On 12/3/2014 4:11 PM, Michael Qiu wrote:=0A= > lib/librte_eal/linuxapp/eal/eal_memory.c:324:4: error: comparison=0A= > is always false due to limited range of data type [-Werror=3Dtype-limits]= =0A= > || (hugepage_sz =3D=3D RTE_PGSIZE_16G)) {=0A= > ^=0A= > cc1: all warnings being treated as errors=0A= >=0A= > lib/librte_eal/linuxapp/eal/eal.c(461): error #2259: non-pointer=0A= > conversion from "long long" to "void *" may lose significant bits=0A= > RTE_PTR_ALIGN_CEIL((uintptr_t)addr, RTE_PGSIZE_16M);=0A= >=0A= > This was introuduced by commit b77b5639:=0A= > mem: add huge page sizes for IBM Power=0A= >=0A= > The root cause is that size_t and uintptr_t are 32-bit in i686=0A= > platform, but RTE_PGSIZE_16M and RTE_PGSIZE_16G are always 64-bit.=0A= >=0A= > Define RTE_PGSIZE_16G only in 64 bit platform to avoid=0A= > this issue.=0A= >=0A= > Signed-off-by: Michael Qiu =0A= > ---=0A= > app/test/test_memzone.c | 18 ++++++++++++------=0A= > lib/librte_eal/common/eal_common_memzone.c | 2 ++=0A= > lib/librte_eal/common/include/rte_memory.h | 14 ++++++++------=0A= > lib/librte_eal/linuxapp/eal/eal_memory.c | 12 +++++-------=0A= > 4 files changed, 27 insertions(+), 19 deletions(-)=0A= >=0A= > diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c=0A= > index 5da6903..7bab8b5 100644=0A= > --- a/app/test/test_memzone.c=0A= > +++ b/app/test/test_memzone.c=0A= > @@ -145,8 +145,10 @@ test_memzone_reserve_flags(void)=0A= > hugepage_1GB_avail =3D 1;=0A= > if (ms[i].hugepage_sz =3D=3D RTE_PGSIZE_16M)=0A= > hugepage_16MB_avail =3D 1;=0A= > +#ifdef RTE_ARCH_64=0A= > if (ms[i].hugepage_sz =3D=3D RTE_PGSIZE_16G)=0A= > hugepage_16GB_avail =3D 1;=0A= > +#endif=0A= > }=0A= > /* Display the availability of 2MB ,1GB, 16MB, 16GB pages */=0A= > if (hugepage_2MB_avail)=0A= > @@ -234,8 +236,8 @@ test_memzone_reserve_flags(void)=0A= > return -1;=0A= > }=0A= > =0A= > - /* Check if 1GB huge pages are unavailable, that function fails unless= =0A= > - * HINT flag is indicated=0A= > + /* Check if 2MB huge pages are unavailable, that function=0A= > + * fails unless HINT flag is indicated=0A= > */=0A= > if (!hugepage_2MB_avail) {=0A= > mz =3D rte_memzone_reserve("flag_zone_2M_HINT", size, SOCKET_ID_ANY,= =0A= > @@ -295,8 +297,9 @@ test_memzone_reserve_flags(void)=0A= > return -1;=0A= > }=0A= > =0A= > - /* Check if 1GB huge pages are unavailable, that function fails=0A= > - * unless HINT flag is indicated=0A= > +#ifdef RTE_ARCH_64=0A= > + /* Check if 16GB huge pages are unavailable, that function=0A= > + * fails unless HINT flag is indicated=0A= > */=0A= > if (!hugepage_16GB_avail) {=0A= > mz =3D rte_memzone_reserve("flag_zone_16G_HINT", size,=0A= > @@ -318,7 +321,9 @@ test_memzone_reserve_flags(void)=0A= > return -1;=0A= > }=0A= > }=0A= > +#endif=0A= > }=0A= > +#ifdef RTE_ARCH_64=0A= > /*As with 16MB tests above for 16GB huge page requests*/=0A= > if (hugepage_16GB_avail) {=0A= > mz =3D rte_memzone_reserve("flag_zone_16G", size, SOCKET_ID_ANY,=0A= > @@ -343,8 +348,8 @@ test_memzone_reserve_flags(void)=0A= > return -1;=0A= > }=0A= > =0A= > - /* Check if 1GB huge pages are unavailable, that function fails=0A= > - * unless HINT flag is indicated=0A= > + /* Check if 16MB huge pages are unavailable, that function=0A= > + * fails unless HINT flag is indicated=0A= > */=0A= > if (!hugepage_16MB_avail) {=0A= > mz =3D rte_memzone_reserve("flag_zone_16M_HINT", size,=0A= > @@ -376,6 +381,7 @@ test_memzone_reserve_flags(void)=0A= > }=0A= > }=0A= > }=0A= > +#endif=0A= > return 0;=0A= > }=0A= > =0A= > diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/= common/eal_common_memzone.c=0A= > index b5a5d72..ee233ad 100644=0A= > --- a/lib/librte_eal/common/eal_common_memzone.c=0A= > +++ b/lib/librte_eal/common/eal_common_memzone.c=0A= > @@ -221,12 +221,14 @@ memzone_reserve_aligned_thread_unsafe(const char *n= ame, size_t len,=0A= > if ((flags & RTE_MEMZONE_1GB) &&=0A= > free_memseg[i].hugepage_sz =3D=3D RTE_PGSIZE_2M)=0A= > continue;=0A= > +#ifdef RTE_ARCH_64=0A= > if ((flags & RTE_MEMZONE_16MB) &&=0A= > free_memseg[i].hugepage_sz =3D=3D RTE_PGSIZE_16G)=0A= > continue;=0A= > if ((flags & RTE_MEMZONE_16GB) &&=0A= > free_memseg[i].hugepage_sz =3D=3D RTE_PGSIZE_16M)=0A= > continue;=0A= > +#endif=0A= > =0A= > /* this segment is the best until now */=0A= > if (memseg_idx =3D=3D -1) {=0A= > diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/= common/include/rte_memory.h=0A= > index 1990833..6bcb92b 100644=0A= > --- a/lib/librte_eal/common/include/rte_memory.h=0A= > +++ b/lib/librte_eal/common/include/rte_memory.h=0A= > @@ -53,12 +53,14 @@ extern "C" {=0A= > #endif=0A= > =0A= > enum rte_page_sizes {=0A= > - RTE_PGSIZE_4K =3D 1ULL << 12,=0A= > - RTE_PGSIZE_2M =3D 1ULL << 21,=0A= > - RTE_PGSIZE_1G =3D 1ULL << 30,=0A= > - RTE_PGSIZE_64K =3D 1ULL << 16,=0A= > - RTE_PGSIZE_16M =3D 1ULL << 24,=0A= > - RTE_PGSIZE_16G =3D 1ULL << 34=0A= > + RTE_PGSIZE_4K =3D 1UL << 12,=0A= > + RTE_PGSIZE_2M =3D 1UL << 21,=0A= > + RTE_PGSIZE_1G =3D 1UL << 30,=0A= > + RTE_PGSIZE_64K =3D 1UL << 16,=0A= > + RTE_PGSIZE_16M =3D 1UL << 24,=0A= > +#ifdef RTE_ARCH_64=0A= > + RTE_PGSIZE_16G =3D 1ULL << 34=0A= > +#endif=0A= > };=0A= > =0A= > #define SOCKET_ID_ANY -1 /**< Any NUMA socket. */=0A= > diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/li= nuxapp/eal/eal_memory.c=0A= > index e6cb919..833670c 100644=0A= > --- a/lib/librte_eal/linuxapp/eal/eal_memory.c=0A= > +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c=0A= > @@ -317,11 +317,10 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl,= =0A= > hugepg_tbl[i].filepath[sizeof(hugepg_tbl[i].filepath) - 1] =3D '\0';= =0A= > }=0A= > #ifndef RTE_ARCH_64=0A= > - /* for 32-bit systems, don't remap 1G and 16G pages, just reuse=0A= > - * original map address as final map address.=0A= > + /* for 32-bit systems, don't remap 1G pages(16G not defined),=0A= > + * just reuse original map address as final map address.=0A= > */=0A= > - else if ((hugepage_sz =3D=3D RTE_PGSIZE_1G)=0A= > - || (hugepage_sz =3D=3D RTE_PGSIZE_16G)) {=0A= > + else if (hugepage_sz =3D=3D RTE_PGSIZE_1G) {=0A= > hugepg_tbl[i].final_va =3D hugepg_tbl[i].orig_va;=0A= > hugepg_tbl[i].orig_va =3D NULL;=0A= > continue;=0A= > @@ -422,11 +421,10 @@ remap_all_hugepages(struct hugepage_file *hugepg_tb= l, struct hugepage_info *hpi)=0A= > while (i < hpi->num_pages[0]) {=0A= > =0A= > #ifndef RTE_ARCH_64=0A= > - /* for 32-bit systems, don't remap 1G pages and 16G pages,=0A= > + /* for 32-bit systems, don't remap 1G pages(16G not defined,=0A= > * just reuse original map address as final map address.=0A= > */=0A= > - if ((hugepage_sz =3D=3D RTE_PGSIZE_1G)=0A= > - || (hugepage_sz =3D=3D RTE_PGSIZE_16G)) {=0A= > + if (hugepage_sz =3D=3D RTE_PGSIZE_1G) {=0A= > hugepg_tbl[i].final_va =3D hugepg_tbl[i].orig_va;=0A= > hugepg_tbl[i].orig_va =3D NULL;=0A= > i++;=0A= =0A=