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 589FD3B5 for ; Wed, 27 May 2015 02:43:30 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 26 May 2015 17:43:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,502,1427785200"; d="scan'208";a="577278275" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga003.jf.intel.com with ESMTP; 26 May 2015 17:43:28 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.73]) by IRSMSX154.ger.corp.intel.com ([169.254.12.182]) with mapi id 14.03.0224.002; Wed, 27 May 2015 01:43:27 +0100 From: "Ananyev, Konstantin" To: Adrien Mazarguil , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/2] mempool: fix returned value on 64 bit after counting objects Thread-Index: AQHQlwfRkRXnKxAbPUi2oYEmXvW3Lp2O/fUw Date: Wed, 27 May 2015 00:43:27 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725821431E1D@irsmsx105.ger.corp.intel.com> References: <1432571266-25840-1-git-send-email-adrien.mazarguil@6wind.com> In-Reply-To: <1432571266-25840-1-git-send-email-adrien.mazarguil@6wind.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/2] mempool: fix returned value on 64 bit after counting objects 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, 27 May 2015 00:43:30 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Adrien Mazarguil > Sent: Monday, May 25, 2015 5:28 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH 1/2] mempool: fix returned value on 64 bit aft= er counting objects >=20 > rte_mempool_xmem_usage()'s return type is ssize_t which has the same > architecture-dependent width as size_t but is signed. >=20 > On 64-bit architectures, returning a negative uint32_t value without cast= ing > to ssize_t first does not work as intended, the sign bit is lost and the > returned value is garbage. >=20 > This commit fixes an assertion failure in testpmd on 64 bit architectures > when combining --no-huge and --mp-anon outside of Xen Dom0: >=20 > PANIC in mempool_anon_create(): > line 170 assert "elt_num =3D=3D mp->size" failed >=20 > Fixes: 148f963fb532 ("xen: core library changes") >=20 > Signed-off-by: Adrien Mazarguil > --- > lib/librte_mempool/rte_mempool.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_me= mpool.c > index 01972ba..d1a02a2 100644 > --- a/lib/librte_mempool/rte_mempool.c > +++ b/lib/librte_mempool/rte_mempool.c > @@ -361,7 +361,7 @@ rte_mempool_xmem_usage(void *vaddr, uint32_t elt_num,= size_t elt_sz, > if ((n =3D rte_mempool_obj_iter(vaddr, elt_num, elt_sz, 1, > paddr, pg_num, pg_shift, mempool_lelem_iter, > &uv)) !=3D elt_num) { > - return (-n); > + return (-(ssize_t)n); > } >=20 > uv =3D RTE_ALIGN_CEIL(uv, pg_sz); > -- Acked-by: Konstantin Ananyev > 2.1.0