From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id D61829ADA for ; Wed, 8 Jun 2016 12:34:20 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 08 Jun 2016 03:34:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,438,1459839600"; d="scan'208";a="993435302" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga002.jf.intel.com with ESMTP; 08 Jun 2016 03:34:18 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.51]) by IRSMSX103.ger.corp.intel.com ([169.254.3.240]) with mapi id 14.03.0248.002; Wed, 8 Jun 2016 11:34:17 +0100 From: "Ananyev, Konstantin" To: Adrien Mazarguil , "dev@dpdk.org" CC: Olivier Matz Thread-Topic: [dpdk-dev] [PATCH] mbuf: remove inconsistent assert statements Thread-Index: AQHRwWBHlYh+pJQko0aMG2e1V0BGOZ/fXbUQ Date: Wed, 8 Jun 2016 10:34:17 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836B6CE18@irsmsx105.ger.corp.intel.com> References: <1465374688-11729-1-git-send-email-adrien.mazarguil@6wind.com> In-Reply-To: <1465374688-11729-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.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] mbuf: remove inconsistent assert statements 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, 08 Jun 2016 10:34:21 -0000 Hi Adrien, >=20 > An assertion failure occurs in __rte_mbuf_raw_free() (called by a few PMD= s) > when compiling DPDK with CONFIG_RTE_LOG_LEVEL=3DRTE_LOG_DEBUG and startin= g > applications with a log level high enough to trigger it. >=20 > While rte_mbuf_raw_alloc() sets refcount to 1, __rte_mbuf_raw_free() > expects it to be 0.=20 >Considering users are not expected to reset the > reference count to satisfy assert() and that raw functions are designed o= n > purpose without safety belts, remove these checks. Yes, it refcnt supposed to be set to 0 by __rte_pktmbuf_prefree_seg(). Wright now, it is a user responsibility to make sure refcnt=3D=3D0 before p= ushing mbuf back to the pool. Not sure why do you consider that wrong? If the user calls __rte_mbuf_raw_free() manualy it is his responsibility to= make sure mbuf's refcn=3D=3D0. BTW, why are you doing it? The comment clearly states that the function is for internal use: /** * @internal Put mbuf back into its original mempool. * The use of that function is reserved for RTE internal needs. * Please use rte_pktmbuf_free(). * * @param m * The mbuf to be freed. */ static inline void __attribute__((always_inline)) __rte_mbuf_raw_free(struct rte_mbuf *m) Konstantin >=20 > Signed-off-by: Adrien Mazarguil > --- > lib/librte_mbuf/rte_mbuf.h | 2 -- > 1 file changed, 2 deletions(-) >=20 > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > index 11fa06d..7070bb8 100644 > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -1108,7 +1108,6 @@ static inline struct rte_mbuf *rte_mbuf_raw_alloc(s= truct rte_mempool *mp) > if (rte_mempool_get(mp, &mb) < 0) > return NULL; > m =3D (struct rte_mbuf *)mb; > - RTE_ASSERT(rte_mbuf_refcnt_read(m) =3D=3D 0); > rte_mbuf_refcnt_set(m, 1); > __rte_mbuf_sanity_check(m, 0); >=20 > @@ -1133,7 +1132,6 @@ __rte_mbuf_raw_alloc(struct rte_mempool *mp) > static inline void __attribute__((always_inline)) > __rte_mbuf_raw_free(struct rte_mbuf *m) > { > - RTE_ASSERT(rte_mbuf_refcnt_read(m) =3D=3D 0); > rte_mempool_put(m->pool, m); > } >=20 > -- > 2.1.4