From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 63B84C356 for ; Mon, 3 Aug 2015 10:10:07 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 03 Aug 2015 01:10:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,600,1432623600"; d="scan'208";a="776611443" Received: from kmsmsx154.gar.corp.intel.com ([172.21.73.14]) by orsmga002.jf.intel.com with ESMTP; 03 Aug 2015 01:10:05 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.110.14) by KMSMSX154.gar.corp.intel.com (172.21.73.14) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 3 Aug 2015 16:10:03 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.126]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.38]) with mapi id 14.03.0224.002; Mon, 3 Aug 2015 16:10:02 +0800 From: "Lu, Wenzhuo" To: HePeng Thread-Topic: [dpdk-dev] [PATCH] [new]ixgbe:set txep.mbuf to NULL when calling ixgbe_tx_free_bufs Thread-Index: AQHQy/k5DQIgsnPyMEyFFZHMcNMuoZ35kB1Q//+BCgCAAK2ZcP//mcmAgACVUwA= Date: Mon, 3 Aug 2015 08:10:01 +0000 Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC0909D1A630@shsmsx102.ccr.corp.intel.com> References: <1438392394-19653-1-git-send-email-xnhp0320@icloud.com> <6A0DE07E22DDAD4C9103DF62FEBC0909D1A508@shsmsx102.ccr.corp.intel.com> <179B898C-F03A-4250-8857-236CFC5274BA@icloud.com> <6A0DE07E22DDAD4C9103DF62FEBC0909D1A59D@shsmsx102.ccr.corp.intel.com> <470BDF91-6FAE-4605-885E-78F02F0F0FBF@icloud.com> In-Reply-To: <470BDF91-6FAE-4605-885E-78F02F0F0FBF@icloud.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="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] [new]ixgbe:set txep.mbuf to NULL when calling ixgbe_tx_free_bufs 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: Mon, 03 Aug 2015 08:10:08 -0000 Hi Peng, > -----Original Message----- > From: HePeng [mailto:xnhp0320@icloud.com] > Sent: Monday, August 3, 2015 3:09 PM > To: Lu, Wenzhuo > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] [new]ixgbe:set txep.mbuf to NULL when cal= ling > ixgbe_tx_free_bufs >=20 > Hi Wenzhuo, > The issue is in the function *ixgbe_dev_free_queues* called in the > *ixgbe_dev_close*. > The *ixgbe_dev_free_queues* will call *ixgbe_rx_queue_release_mbuf* > to recycle all the mbuf on the queues. If some mbufs have already been re= cycled > by the *ixgbe_tx_free_bufs*, their ref cnt is 0. >=20 > However, since the pointers are not set to NULL, > *ixgbe_rx_queue_release_mbuf* will also check the mbufs whose ref cnt is = 0, > then if one enables *CONFIG_RTE_MBUF_DEBUG*, the sanity checks will warn > that the ref cnt is bad, and the program will bail out. >=20 > As you said if this is a designed behavior, you need to fix the code in > *ixgbe_rx_queue_release_mbuf* to skip the mbuf that already been recycled= . But I think it's skipped, like this, if (rxq->sw_ring[i].mbuf !=3D NULL && rte_mbuf_refcnt_read(rxq->sw_ring[i].mbuf)) { rte_pktmbuf_free_seg(rxq->sw_ring[i].mbuf); >=20 >=20 > > =1B$B:_=1B(B 2015=1B$BG/=1B(B8=1B$B7n=1B(B3=1B$BF|!$2<8a=1B(B1:16=1B$B!= $=1B(BLu, Wenzhuo =1B$B =1B$BF;!'=1B(B > > > > Hi Peng, > > Would you like to tell me more details about the panic? > > I saw there's refcnt check in rte_mbuf_sanity_check. I'm not sure what = sanity > check you want to add. > > Thanks. > > > >> -----Original Message----- > >> From: HePeng [mailto:xnhp0320@icloud.com] > >> Sent: Monday, August 3, 2015 10:54 AM > >> To: Lu, Wenzhuo > >> Subject: Re: [dpdk-dev] [PATCH] [new]ixgbe:set txep.mbuf to NULL when > calling > >> ixgbe_tx_free_bufs > >> > >> Hi, Wenzhuo > >> It will cause panic if you enable *CONFIG_RTE_MBUF_DEBUG* in you > >> config file. So if it is a designed behavior, some code fix may need f= or > >> *mbuf_sanity_check*. > >> Thanks. > >> > >> > >>> =1B$B:_=1B(B 2015=1B$BG/=1B(B8=1B$B7n=1B(B3=1B$BF|!$>e8a=1B(B10:46=1B= $B!$=1B(BLu, Wenzhuo > =1B$B >> =1B$BF;!'=1B(B > >>> > >>> Hi Peng, > >>> > >>>> -----Original Message----- > >>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of hepeng > >>>> Sent: Saturday, August 1, 2015 9:27 AM > >>>> To: dev@dpdk.org > >>>> Subject: [dpdk-dev] [PATCH] [new]ixgbe:set txep.mbuf to NULL when > calling > >>>> ixgbe_tx_free_bufs > >>>> > >>>> In *ixgbe_tx_free_bufs*, after recycling some tx entries, one should= set > their > >>>> mbuf pointers to NULL. > >>>> > >>>> The first path is not correct, the txep->mbuf should be set to NULL = no > matter > >> if > >>>> it is recycled into mempool > >>>> Signed-off-by: hepeng > >>>> --- > >>>> drivers/net/ixgbe/ixgbe_rxtx_vec.c | 13 ++++++++++++- > >>>> 1 file changed, 12 insertions(+), 1 deletion(-) > >>>> > >>>> diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec.c > >>>> b/drivers/net/ixgbe/ixgbe_rxtx_vec.c > >>>> index 1c16dec..e7ce740 100644 > >>>> --- a/drivers/net/ixgbe/ixgbe_rxtx_vec.c > >>>> +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec.c > >>>> @@ -612,6 +612,7 @@ ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq) > >>>> */ > >>>> txep =3D &txq->sw_ring_v[txq->tx_next_dd - (n - 1)]; > >>>> m =3D __rte_pktmbuf_prefree_seg(txep[0].mbuf); > >>>> + txep[0].mbuf =3D NULL; > >>>> if (likely(m !=3D NULL)) { > >>>> free[0] =3D m; > >>>> nb_free =3D 1; > >>>> @@ -632,11 +633,21 @@ ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq) > >>>> } else { > >>>> for (i =3D 1; i < n; i++) { > >>>> m =3D __rte_pktmbuf_prefree_seg(txep[i].mbuf); > >>>> - if (m !=3D NULL) > >>>> + if (m !=3D NULL) { > >>>> rte_mempool_put(m->pool, m); > >>>> + } > >>>> } > >>>> } > >>>> > >>>> + /* > >>>> + * No matter the mbufs have been put back to mempool or not, > >>>> + * we should set the txep[i].mbuf to NULL > >>>> + */ > >>>> + > >>>> + for( i =3D 1; i < n; i++) { > >>>> + txep[i].mbuf =3D NULL; > >>>> + } > >>>> + > >>>> /* buffers were freed, update counters */ > >>>> txq->nb_tx_free =3D (uint16_t)(txq->nb_tx_free + txq->tx_rs_thresh)= ; > >>>> txq->tx_next_dd =3D (uint16_t)(txq->tx_next_dd + txq->tx_rs_thresh)= ; > >>>> -- > >>>> 1.9.1 > >>> > >>> NACK. > >>> Thanks for looking into this code. But it's designed behavior, not an= issue. > >>> BTW, if you want to send a new version, the tittle should be like thi= s [PATCH > v2] > >> ixgbe: ..., and add "--in-reply-to your original mail" when sending th= e mail, > and > >> add a v2 comments. You can reference the other's v2 patches for detail= . > >>> > >