From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 97B5637B0 for ; Wed, 25 May 2016 19:53:45 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 25 May 2016 10:53:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,364,1459839600"; d="scan'208";a="974443464" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by fmsmga001.fm.intel.com with ESMTP; 25 May 2016 10:53:43 -0700 Received: from irsmsx107.ger.corp.intel.com ([169.254.10.122]) by IRSMSX153.ger.corp.intel.com ([169.254.9.177]) with mapi id 14.03.0248.002; Wed, 25 May 2016 18:52:30 +0100 From: "Jain, Deepak K" To: Olivier Matz , "dev@dpdk.org" CC: "Richardson, Bruce" , "stephen@networkplumber.org" , "Wiles, Keith" , "Griffin, John" , "Kusztal, ArkadiuszX" , "Trahe, Fiona" , "Mcnamara, John" Thread-Topic: [dpdk-dev] [PATCH v3 13/35] mempool: store physical address in objects Thread-Index: AQHRsPWUsJFYqs/qZUW5ucJ/aXtyD5/J+WBA Date: Wed, 25 May 2016 17:51:35 +0000 Deferred-Delivery: Wed, 25 May 2016 17:51:30 +0000 Message-ID: References: <1460629199-32489-1-git-send-email-olivier.matz@6wind.com> <1463569496-31086-1-git-send-email-olivier.matz@6wind.com> <1463569496-31086-14-git-send-email-olivier.matz@6wind.com> In-Reply-To: <1463569496-31086-14-git-send-email-olivier.matz@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODI0ODJiODktZjBjZi00NjcxLWJmM2EtNjQ1ZGE0ZmI4ZWQyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlV1UlJRUzBDeUVHdW5OSmE5MkxuVnlxRTlORWo3Ull1cmVpTjFpcmx4Mzg9In0= x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 13/35] mempool: store physical address in 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, 25 May 2016 17:53:46 -0000 Hi, While running the QAT PMD tests, a system hang is observed when this commit= is used. rte_mempool_virt2phy is used in qat_crypto.c. regards, Deepak -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Olivier Matz Sent: Wednesday, May 18, 2016 12:05 PM To: dev@dpdk.org Cc: Richardson, Bruce ; stephen@networkplumber.= org; Wiles, Keith Subject: [dpdk-dev] [PATCH v3 13/35] mempool: store physical address in obj= ects Store the physical address of the object in its header. It simplifies rte_mempool_virt2phy() and prepares the removing of the paddr[] table in th= e mempool header. Signed-off-by: Olivier Matz --- lib/librte_mempool/rte_mempool.c | 17 +++++++++++------ lib/librte_mempoo= l/rte_mempool.h | 11 ++++++----- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_memp= ool.c index 61e191e..ce12db5 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -133,19 +133,22 @@ static unsigned optimize_object_size(unsigned obj_siz= e) typedef void (*rte_mempool_obj_iter_t)(void * /*obj_iter_arg*/, void * /*obj_start*/, void * /*obj_end*/, - uint32_t /*obj_index */); + uint32_t /*obj_index */, + phys_addr_t /*physaddr*/); =20 static void -mempool_add_elem(struct rte_mempool *mp, void *obj) +mempool_add_elem(struct rte_mempool *mp, void *obj, phys_addr_t=20 +physaddr) { struct rte_mempool_objhdr *hdr; struct rte_mempool_objtlr *tlr __rte_unused; =20 obj =3D (char *)obj + mp->header_size; + physaddr +=3D mp->header_size; =20 /* set mempool ptr in header */ hdr =3D RTE_PTR_SUB(obj, sizeof(*hdr)); hdr->mp =3D mp; + hdr->physaddr =3D physaddr; STAILQ_INSERT_TAIL(&mp->elt_list, hdr, next); =20 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG @@ -175,6 +178,7 @@ rte_mempool_obj_mem_iter(void *vaddr, uint32_t elt_num,= size_t total_elt_sz, uint32_t pgn, pgf; uintptr_t end, start, va; uintptr_t pg_sz; + phys_addr_t physaddr; =20 pg_sz =3D (uintptr_t)1 << pg_shift; va =3D (uintptr_t)vaddr; @@ -210,9 +214,10 @@ rte_mempool_obj_mem_iter(void *vaddr, uint32_t elt_num= , size_t total_elt_sz, * otherwise, just skip that chunk unused. */ if (k =3D=3D pgn) { + physaddr =3D paddr[k] + (start & (pg_sz - 1)); if (obj_iter !=3D NULL) obj_iter(obj_iter_arg, (void *)start, - (void *)end, i); + (void *)end, i, physaddr); va =3D end; j +=3D pgf; i++; @@ -249,11 +254,11 @@ rte_mempool_obj_iter(struct rte_mempool *mp, =20 static void mempool_obj_populate(void *arg, void *start, void *end, - __rte_unused uint32_t idx) + __rte_unused uint32_t idx, phys_addr_t physaddr) { struct rte_mempool *mp =3D arg; =20 - mempool_add_elem(mp, start); + mempool_add_elem(mp, start, physaddr); mp->elt_va_end =3D (uintptr_t)end; } =20 @@ -358,7 +363,7 @@ rte_mempool_xmem_size(uint32_t elt_num, size_t total_el= t_sz, uint32_t pg_shift) */ static void mempool_lelem_iter(void *arg, __rte_unused void *start, void *end, - __rte_unused uint32_t idx) + __rte_unused uint32_t idx, __rte_unused phys_addr_t physaddr) { *(uintptr_t *)arg =3D (uintptr_t)end; } diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_memp= ool.h index 12215f6..4f95bdf 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -159,6 +159,7 @@ struct rte_mempool_objsz { struct rte_mempool_objhdr { STAILQ_ENTRY(rte_mempool_objhdr) next; /**< Next in list. */ struct rte_mempool *mp; /**< The mempool owning the object. */ + phys_addr_t physaddr; /**< Physical address of the object. */ #ifdef RTE_LIBRTE_MEMPOOL_DEBUG uint64_t cookie; /**< Debug cookie. */ #endif @@ -1131,13 +1132,13 @@ rte_mempool_empty(const struct rte_mempool *mp) * The physical address of the elt element. */ static inline phys_addr_t -rte_mempool_virt2phy(const struct rte_mempool *mp, const void *elt) +rte_mempool_virt2phy(__rte_unused const struct rte_mempool *mp, const=20 +void *elt) { if (rte_eal_has_hugepages()) { - uintptr_t off; - - off =3D (const char *)elt - (const char *)mp->elt_va_start; - return mp->elt_pa[off >> mp->pg_shift] + (off & mp->pg_mask); + const struct rte_mempool_objhdr *hdr; + hdr =3D (const struct rte_mempool_objhdr *)RTE_PTR_SUB(elt, + sizeof(*hdr)); + return hdr->physaddr; } else { /* * If huge pages are disabled, we cannot assume the -- 2.8.0.rc3