From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00080.outbound.protection.outlook.com [40.107.0.80]) by dpdk.org (Postfix) with ESMTP id 47A5C23A for ; Sun, 6 May 2018 08:37:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=0ZjOOpQH9vWDRDnPuK3fjzwh+9dz7meKZZcYV1k2fN4=; b=QNsjZ/eg8F7YgTGrFZsw3Yi3UWltxZ472L8kDviPdcUOEusjPYcC4C1y+q0fEoD1nKic8+3x1GUOX5+HALEKtxysdPJ595/vEibA4QGsHEA9hBTSBo7WTs7OB432TPpWYnlULdqtuEja5f3J/hvqAVhDYH+s5WQND8+2cH3X52U= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4459.eurprd05.prod.outlook.com (52.134.109.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.18; Sun, 6 May 2018 06:37:33 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::f116:5be4:ba29:fed8]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::f116:5be4:ba29:fed8%13]) with mapi id 15.20.0735.018; Sun, 6 May 2018 06:37:33 +0000 From: Shahaf Shuler To: Yongseok Koh , Adrien Mazarguil , =?iso-8859-1?Q?N=E9lio_Laranjeiro?= CC: "dev@dpdk.org" , Yongseok Koh Thread-Topic: [dpdk-dev] [PATCH 1/5] net/mlx5: trim debug messages for reference counters Thread-Index: AQHT4mvA7V4tIf/EFUi/BvKEKxhRD6QiQcbA Date: Sun, 6 May 2018 06:37:33 +0000 Message-ID: References: <20180502231654.7596-1-yskoh@mellanox.com> <20180502231654.7596-2-yskoh@mellanox.com> In-Reply-To: <20180502231654.7596-2-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [31.154.10.107] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4459; 7:+T4ogeU5+k10+XlgFMGrsUjS1Spt3uVTomI2E2/ZJYkn0nF7tGaCzGIJbT91qN5qxLASWJ0cakApwhLWEk8WQ6w9BgQZ8trcILw2YIs9jQHu/XIaINnRB+wqm6pWDmHTOD+SdWPNAVTXM7DwVQFZkoa5t2nKSWYTCOjVnjvtjpI7546KL//S/wibaIsueMO8ZC7R391Slyl0XiitmhwlFTDO0iKr0EceeV01aGYYYnpf+8E48e6TxK2iBXp3V7QW x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4459; x-ms-traffictypediagnostic: DB7PR05MB4459: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(3002001)(6055026)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB7PR05MB4459; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4459; x-forefront-prvs: 06640999CA x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39380400002)(39860400002)(396003)(366004)(199004)(189003)(110136005)(14454004)(81156014)(81166006)(66066001)(54906003)(2900100001)(25786009)(5660300001)(97736004)(6436002)(99286004)(6246003)(316002)(107886003)(305945005)(5250100002)(9686003)(55016002)(7736002)(478600001)(8936002)(53936002)(74316002)(6116002)(3846002)(68736007)(15650500001)(3280700002)(59450400001)(102836004)(86362001)(3660700001)(4326008)(575784001)(7696005)(486006)(2906002)(229853002)(11346002)(76176011)(33656002)(106356001)(476003)(105586002)(6506007)(26005)(446003)(87944003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4459; H:DB7PR05MB4426.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: vVxLx0CngQ/ppzyC0LWUbPj5lu0cqHeXCQb6Cgvk/ixYZoITgTWULPVKseX6HYhwOKOQKO/zv/S4/mQVhZfbz1QCM1RFtiN0drPS5Y7w0n6nyUdozg5S0Gn+CG0vEXtrRQpNryE2KnKEI7zbFwEPLOGQqRnzLfMkn+Q8G9mj60qSWq8Wa2pjc8DnjDoVlGx9 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: b468e02b-2fc4-4bf7-c1b6-08d5b31bd939 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b468e02b-2fc4-4bf7-c1b6-08d5b31bd939 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 May 2018 06:37:33.1629 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4459 Subject: Re: [dpdk-dev] [PATCH 1/5] net/mlx5: trim debug messages for reference counters X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2018 06:37:34 -0000 Thursday, May 3, 2018 2:17 AM, Yongseok Koh: > Subject: [dpdk-dev] [PATCH 1/5] net/mlx5: trim debug messages for > reference counters >=20 > Remove debug messages when getting an object. When releasing an object, > debug message will be printed only if the object is really freed. >=20 > Signed-off-by: Yongseok Koh > --- Only one general comment as you are making some order here. I think it will be better to be explicit in the logging. Saying when new ob= ject is created: "port %u new ... .. for queue ... " No need for the refcnt as it is obviously 0.=20 And when object is destroyed: "port %u .. ... for queue... is destroyed" > drivers/net/mlx5/mlx5_mr.c | 7 ++----- drivers/net/mlx5/mlx5_rxq.c | = 36 > +++++++++++++----------------------- > drivers/net/mlx5/mlx5_txq.c | 21 ++++++++------------- > 3 files changed, 23 insertions(+), 41 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c inde= x > 7a337d0c3..6613bd6b9 100644 > --- a/drivers/net/mlx5/mlx5_mr.c > +++ b/drivers/net/mlx5/mlx5_mr.c > @@ -308,9 +308,6 @@ mlx5_mr_get(struct rte_eth_dev *dev, struct > rte_mempool *mp) > LIST_FOREACH(mr, &priv->mr, next) { > if (mr->mp =3D=3D mp) { > rte_atomic32_inc(&mr->refcnt); > - DRV_LOG(DEBUG, "port %u memory region %p > refcnt: %d", > - dev->data->port_id, (void *)mr, > - rte_atomic32_read(&mr->refcnt)); > return mr; > } > } > @@ -330,9 +327,9 @@ int > mlx5_mr_release(struct mlx5_mr *mr) > { > assert(mr); > - DRV_LOG(DEBUG, "memory region %p refcnt: %d", (void *)mr, > - rte_atomic32_read(&mr->refcnt)); > if (rte_atomic32_dec_and_test(&mr->refcnt)) { > + DRV_LOG(DEBUG, "memory region %p refcnt: %d", (void > *)mr, > + rte_atomic32_read(&mr->refcnt)); > claim_zero(mlx5_glue->dereg_mr(mr->mr)); > LIST_REMOVE(mr, next); > rte_free(mr); > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index a85b628fe..d993e3846 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -868,9 +868,6 @@ mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t > idx) > if (rxq_ctrl->ibv) { > mlx5_mr_get(dev, rxq_data->mp); > rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); > - DRV_LOG(DEBUG, "port %u Verbs Rx queue %u: refcnt %d", > - dev->data->port_id, rxq_ctrl->idx, > - rte_atomic32_read(&rxq_ctrl->ibv->refcnt)); > } > return rxq_ctrl->ibv; > } > @@ -896,10 +893,11 @@ mlx5_rxq_ibv_release(struct mlx5_rxq_ibv > *rxq_ibv) > ret =3D mlx5_mr_release(rxq_ibv->mr); > if (!ret) > rxq_ibv->mr =3D NULL; > - DRV_LOG(DEBUG, "port %u Verbs Rx queue %u: refcnt %d", > - port_id(rxq_ibv->rxq_ctrl->priv), > - rxq_ibv->rxq_ctrl->idx, rte_atomic32_read(&rxq_ibv- > >refcnt)); > if (rte_atomic32_dec_and_test(&rxq_ibv->refcnt)) { > + DRV_LOG(DEBUG, "port %u Verbs Rx queue %u: refcnt %d", > + port_id(rxq_ibv->rxq_ctrl->priv), > + rxq_ibv->rxq_ctrl->idx, > + rte_atomic32_read(&rxq_ibv->refcnt)); > rxq_free_elts(rxq_ibv->rxq_ctrl); > claim_zero(mlx5_glue->destroy_wq(rxq_ibv->wq)); > claim_zero(mlx5_glue->destroy_cq(rxq_ibv->cq)); > @@ -1111,9 +1109,6 @@ mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t > idx) > rxq); > mlx5_rxq_ibv_get(dev, idx); > rte_atomic32_inc(&rxq_ctrl->refcnt); > - DRV_LOG(DEBUG, "port %u Rx queue %u: refcnt %d", > - dev->data->port_id, rxq_ctrl->idx, > - rte_atomic32_read(&rxq_ctrl->refcnt)); > } > return rxq_ctrl; > } > @@ -1141,9 +1136,10 @@ mlx5_rxq_release(struct rte_eth_dev *dev, > uint16_t idx) > assert(rxq_ctrl->priv); > if (rxq_ctrl->ibv && !mlx5_rxq_ibv_release(rxq_ctrl->ibv)) > rxq_ctrl->ibv =3D NULL; > - DRV_LOG(DEBUG, "port %u Rx queue %u: refcnt %d", dev->data- > >port_id, > - rxq_ctrl->idx, rte_atomic32_read(&rxq_ctrl->refcnt)); > if (rte_atomic32_dec_and_test(&rxq_ctrl->refcnt)) { > + DRV_LOG(DEBUG, "port %u Rx queue %u: refcnt %d", > + dev->data->port_id, rxq_ctrl->idx, > + rte_atomic32_read(&rxq_ctrl->refcnt)); > LIST_REMOVE(rxq_ctrl, next); > rte_free(rxq_ctrl); > (*priv->rxqs)[idx] =3D NULL; > @@ -1301,9 +1297,6 @@ mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, > const uint16_t *queues, > unsigned int i; >=20 > rte_atomic32_inc(&ind_tbl->refcnt); > - DRV_LOG(DEBUG, "port %u indirection table %p: refcnt %d", > - dev->data->port_id, (void *)ind_tbl, > - rte_atomic32_read(&ind_tbl->refcnt)); > for (i =3D 0; i !=3D ind_tbl->queues_n; ++i) > mlx5_rxq_get(dev, ind_tbl->queues[i]); > } > @@ -1327,9 +1320,6 @@ mlx5_ind_table_ibv_release(struct rte_eth_dev > *dev, { > unsigned int i; >=20 > - DRV_LOG(DEBUG, "port %u indirection table %p: refcnt %d", > - ((struct priv *)dev->data->dev_private)->port, > - (void *)ind_tbl, rte_atomic32_read(&ind_tbl->refcnt)); > if (rte_atomic32_dec_and_test(&ind_tbl->refcnt)) { > claim_zero(mlx5_glue->destroy_rwq_ind_table > (ind_tbl->ind_table)); > @@ -1339,6 +1329,9 @@ mlx5_ind_table_ibv_release(struct rte_eth_dev > *dev, > for (i =3D 0; i !=3D ind_tbl->queues_n; ++i) > claim_nonzero(mlx5_rxq_release(dev, ind_tbl->queues[i])); > if (!rte_atomic32_read(&ind_tbl->refcnt)) { > + DRV_LOG(DEBUG, "port %u indirection table %p: refcnt %d", > + ((struct priv *)dev->data->dev_private)->port, > + (void *)ind_tbl, rte_atomic32_read(&ind_tbl- > >refcnt)); > LIST_REMOVE(ind_tbl, next); > rte_free(ind_tbl); > return 0; > @@ -1566,9 +1559,6 @@ mlx5_hrxq_get(struct rte_eth_dev *dev, > continue; > } > rte_atomic32_inc(&hrxq->refcnt); > - DRV_LOG(DEBUG, "port %u hash Rx queue %p: refcnt %d", > - dev->data->port_id, (void *)hrxq, > - rte_atomic32_read(&hrxq->refcnt)); > return hrxq; > } > return NULL; > @@ -1588,10 +1578,10 @@ mlx5_hrxq_get(struct rte_eth_dev *dev, int > mlx5_hrxq_release(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq) { > - DRV_LOG(DEBUG, "port %u hash Rx queue %p: refcnt %d", > - ((struct priv *)dev->data->dev_private)->port, > - (void *)hrxq, rte_atomic32_read(&hrxq->refcnt)); > if (rte_atomic32_dec_and_test(&hrxq->refcnt)) { > + DRV_LOG(DEBUG, "port %u hash Rx queue %p: refcnt %d", > + ((struct priv *)dev->data->dev_private)->port, > + (void *)hrxq, rte_atomic32_read(&hrxq->refcnt)); > claim_zero(mlx5_glue->destroy_qp(hrxq->qp)); > DEBUG("port %u delete QP %p: hash: 0x%" PRIx64 ", tunnel:" > " 0x%x, level: %u", > diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c > index 29959b4c7..3f4b5fea5 100644 > --- a/drivers/net/mlx5/mlx5_txq.c > +++ b/drivers/net/mlx5/mlx5_txq.c > @@ -595,12 +595,8 @@ mlx5_txq_ibv_get(struct rte_eth_dev *dev, > uint16_t idx) > if (!(*priv->txqs)[idx]) > return NULL; > txq_ctrl =3D container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq= ); > - if (txq_ctrl->ibv) { > + if (txq_ctrl->ibv) > rte_atomic32_inc(&txq_ctrl->ibv->refcnt); > - DRV_LOG(DEBUG, "port %u Verbs Tx queue %u: refcnt %d", > - dev->data->port_id, txq_ctrl->idx, > - rte_atomic32_read(&txq_ctrl->ibv->refcnt)); > - } > return txq_ctrl->ibv; > } >=20 > @@ -617,10 +613,11 @@ int > mlx5_txq_ibv_release(struct mlx5_txq_ibv *txq_ibv) { > assert(txq_ibv); > - DRV_LOG(DEBUG, "port %u Verbs Tx queue %u: refcnt %d", > - port_id(txq_ibv->txq_ctrl->priv), > - txq_ibv->txq_ctrl->idx, rte_atomic32_read(&txq_ibv- > >refcnt)); > if (rte_atomic32_dec_and_test(&txq_ibv->refcnt)) { > + DRV_LOG(DEBUG, "port %u Verbs Tx queue %u: refcnt %d", > + port_id(txq_ibv->txq_ctrl->priv), > + txq_ibv->txq_ctrl->idx, > + rte_atomic32_read(&txq_ibv->refcnt)); > claim_zero(mlx5_glue->destroy_qp(txq_ibv->qp)); > claim_zero(mlx5_glue->destroy_cq(txq_ibv->cq)); > LIST_REMOVE(txq_ibv, next); > @@ -860,9 +857,6 @@ mlx5_txq_get(struct rte_eth_dev *dev, uint16_t idx) > ctrl->txq.mp2mr[i]->mp)); > } > rte_atomic32_inc(&ctrl->refcnt); > - DRV_LOG(DEBUG, "port %u Tx queue %u refcnt %d", > - dev->data->port_id, > - ctrl->idx, rte_atomic32_read(&ctrl->refcnt)); > } > return ctrl; > } > @@ -889,8 +883,6 @@ mlx5_txq_release(struct rte_eth_dev *dev, uint16_t > idx) > if (!(*priv->txqs)[idx]) > return 0; > txq =3D container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq); > - DRV_LOG(DEBUG, "port %u Tx queue %u: refcnt %d", dev->data- > >port_id, > - txq->idx, rte_atomic32_read(&txq->refcnt)); > if (txq->ibv && !mlx5_txq_ibv_release(txq->ibv)) > txq->ibv =3D NULL; > for (i =3D 0; i !=3D MLX5_PMD_TX_MP_CACHE; ++i) { @@ -903,6 +895,9 > @@ mlx5_txq_release(struct rte_eth_dev *dev, uint16_t idx) > munmap((void *)RTE_ALIGN_FLOOR((uintptr_t)txq- > >txq.bf_reg, > page_size), page_size); > if (rte_atomic32_dec_and_test(&txq->refcnt)) { > + DRV_LOG(DEBUG, "port %u Tx queue %u: refcnt %d", > + dev->data->port_id, txq->idx, > + rte_atomic32_read(&txq->refcnt)); > txq_free_elts(txq); > LIST_REMOVE(txq, next); > rte_free(txq); > -- > 2.11.0