Skip to contentSkip to conversation

adjust mlx debug logs

PATCH Superseded Thomas Monjalon 4 participants 19 messages Mar 8, 2021 – Mar 18, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover adjust mlx debug logs

Few adjustments of debug log usage in mlx4/mlx5.

Thomas Monjalon (3):
net/mlx4: enable debug logs dynamically
common/mlx5: enable debug logs dynamically
net/mlx5: reduce log level of alignment message

 drivers/common/mlx5/mlx5_common.h     |  2 --
 drivers/common/mlx5/mlx5_common_mr.c  | 45 ++++++++++++++-------------
 drivers/common/mlx5/mlx5_common_pci.c |  4 +--
 drivers/net/mlx4/mlx4_utils.h         |  5 ++-
 drivers/net/mlx5/linux/mlx5_verbs.c   | 13 ++++----
 drivers/net/mlx5/mlx5_mr.c            | 12 +++----
 drivers/net/mlx5/mlx5_rxq.c           | 11 ++++---
 drivers/net/mlx5/mlx5_utils.c         |  4 +--
 8 files changed, 50 insertions(+), 46 deletions(-)
Signature · 1 line
2.30.1
#1 lore raw

PATCH 1/3 net/mlx4: enable debug logs dynamically

The macro DEBUG was doing nothing if not compiled with RTE_LIBRTE_MLX4_DEBUG.

As it is not used in the data path, it can be always enabled at compilation time. Then it can be enabled at runtime with:
--log-level pmd.net.mlx4:debug

---
 drivers/net/mlx4/mlx4_utils.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/mlx4/mlx4_utils.h +2 -3
index b8769562ab..fca21fd79c 100644
@@ -52,14 +52,13 @@ pmd_drv_log_basename(const char *s)
 			__LINE__, \
 			__func__, \
 			RTE_FMT_TAIL(__VA_ARGS__,)))
-#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
 #define MLX4_ASSERT(exp) RTE_VERIFY(exp)
 #define claim_zero(...) MLX4_ASSERT((__VA_ARGS__) == 0)
 
 #else /* RTE_LIBRTE_MLX4_DEBUG */
 
 /*
- * Like MLX4_ASSERT(), DEBUG() becomes a no-op and claim_zero() does not perform
+ * Like MLX4_ASSERT(), claim_zero() does not perform
  * any check when debugging is disabled.
  */
 
@@ -68,12 +67,12 @@ pmd_drv_log_basename(const char *s)
 		RTE_FMT(MLX4_DRIVER_NAME ": " \
 			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
 		RTE_FMT_TAIL(__VA_ARGS__,)))
-#define DEBUG(...) (void)0
 #define MLX4_ASSERT(exp) RTE_ASSERT(exp)
 #define claim_zero(...) (__VA_ARGS__)
 
 #endif /* RTE_LIBRTE_MLX4_DEBUG */
 
+#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
 #define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
 #define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
 #define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)
Signature · 1 line
2.30.1
#2 lore raw

PATCH 2/3 common/mlx5: enable debug logs dynamically

In reply to Thomas Monjalon

Most debug logs are using DRV_LOG(DEBUG,)
but some were using DEBUG().
The macro DEBUG is doing nothing if not compiled with RTE_LIBRTE_MLX5_DEBUG.

As it is not used in the data path, the macro DEBUG can be replaced with DRV_LOG.
Then all debug logs can be enabled at runtime with:
--log-level pmd.net.mlx5:debug

---
 drivers/common/mlx5/mlx5_common.h     |  2 --
 drivers/common/mlx5/mlx5_common_mr.c  | 45 ++++++++++++++-------------
 drivers/common/mlx5/mlx5_common_pci.c |  4 +--
 drivers/net/mlx5/linux/mlx5_verbs.c   | 13 ++++----
 drivers/net/mlx5/mlx5_mr.c            | 12 +++----
 drivers/net/mlx5/mlx5_rxq.c           | 11 ++++---
 6 files changed, 46 insertions(+), 41 deletions(-)
drivers/common/mlx5/mlx5_common.h +0 -2
index 3855582d0d..5028a05b49 100644
@@ -92,14 +92,12 @@ pmd_drv_log_basename(const char *s)
 /* claim_zero() does not perform any check when debugging is disabled. */
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 
-#define DEBUG(...) DRV_LOG(DEBUG, __VA_ARGS__)
 #define MLX5_ASSERT(exp) RTE_VERIFY(exp)
 #define claim_zero(...) MLX5_ASSERT((__VA_ARGS__) == 0)
 #define claim_nonzero(...) MLX5_ASSERT((__VA_ARGS__) != 0)
 
 #else /* RTE_LIBRTE_MLX5_DEBUG */
 
-#define DEBUG(...) (void)0
 #define MLX5_ASSERT(exp) RTE_ASSERT(exp)
 #define claim_zero(...) (__VA_ARGS__)
 #define claim_nonzero(...) (__VA_ARGS__)
drivers/common/mlx5/mlx5_common_mr.c +24 -21

140 lines not on this page · raw message

drivers/common/mlx5/mlx5_common_pci.c +2 -2
index 2b657686d1..a7f541a90c 100644
@@ -245,14 +245,14 @@ drivers_probe(struct mlx5_pci_device *dev, struct rte_pci_driver *pci_drv,
 		already_loaded = dev->classes_loaded & driver->driver_class;
 		if (already_loaded &&
 		    !(driver->pci_driver.drv_flags & RTE_PCI_DRV_PROBE_AGAIN)) {
-			DRV_LOG(ERR, "Device %s is already probed\n",
+			DRV_LOG(ERR, "Device %s is already probed",
 				pci_dev->device.name);
 			ret = -EEXIST;
 			goto probe_err;
 		}
 		ret = driver->pci_driver.probe(pci_drv, pci_dev);
 		if (ret < 0) {
-			DRV_LOG(ERR, "Failed to load driver = %s.\n",
+			DRV_LOG(ERR, "Failed to load driver %s",
 				driver->pci_driver.driver.name);
 			goto probe_err;
 		}
drivers/net/mlx5/linux/mlx5_verbs.c +7 -6
index ade241b806..c7d4b177a0 100644
@@ -721,7 +721,7 @@ mlx5_rxq_ibv_obj_drop_create(struct rte_eth_dev *dev)
 		return 0;
 	rxq = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*rxq), 0, SOCKET_ID_ANY);
 	if (!rxq) {
-		DEBUG("Port %u cannot allocate drop Rx queue memory.",
+		DRV_LOG(DEBUG, "Port %u cannot allocate drop Rx queue memory.",
 		      dev->data->port_id);
 		rte_errno = ENOMEM;
 		return -rte_errno;
@@ -729,7 +729,7 @@ mlx5_rxq_ibv_obj_drop_create(struct rte_eth_dev *dev)
 	priv->drop_queue.rxq = rxq;
 	rxq->ibv_cq = mlx5_glue->create_cq(ctx, 1, NULL, NULL, 0);
 	if (!rxq->ibv_cq) {
-		DEBUG("Port %u cannot allocate CQ for drop queue.",
+		DRV_LOG(DEBUG, "Port %u cannot allocate CQ for drop queue.",
 		      dev->data->port_id);
 		rte_errno = errno;
 		goto error;
@@ -742,7 +742,7 @@ mlx5_rxq_ibv_obj_drop_create(struct rte_eth_dev *dev)
 						    .cq = rxq->ibv_cq,
 					      });
 	if (!rxq->wq) {
-		DEBUG("Port %u cannot allocate WQ for drop queue.",
+		DRV_LOG(DEBUG, "Port %u cannot allocate WQ for drop queue.",
 		      dev->data->port_id);
 		rte_errno = errno;
 		goto error;
@@ -785,8 +785,9 @@ mlx5_ibv_drop_action_create(struct rte_eth_dev *dev)
 					.comp_mask = 0,
 				 });
 	if (!ind_tbl) {
-		DEBUG("Port %u cannot allocate indirection table for drop"
-		      " queue.", dev->data->port_id);
+		DRV_LOG(DEBUG, "Port %u"
+			" cannot allocate indirection table for drop queue.",
+			dev->data->port_id);
 		rte_errno = errno;
 		goto error;
 	}
@@ -806,7 +807,7 @@ mlx5_ibv_drop_action_create(struct rte_eth_dev *dev)
 			.pd = priv->sh->pd
 		 });
 	if (!hrxq->qp) {
-		DEBUG("Port %u cannot allocate QP for drop queue.",
+		DRV_LOG(DEBUG, "Port %u cannot allocate QP for drop queue.",
 		      dev->data->port_id);
 		rte_errno = errno;
 		goto error;
drivers/net/mlx5/mlx5_mr.c +6 -6
index da4e91fc24..3255393ca2 100644
@@ -57,7 +57,7 @@ mlx5_mr_mem_event_free_cb(struct mlx5_dev_ctx_shared *sh,
 	int i;
 	int rebuild = 0;
 
-	DEBUG("device %s free callback: addr=%p, len=%zu",
+	DRV_LOG(DEBUG, "device %s free callback: addr=%p, len=%zu",
 	      sh->ibdev_name, addr, len);
 	msl = rte_mem_virt2memseg_list(addr);
 	/* addr and len must be page-aligned. */
@@ -87,13 +87,13 @@ mlx5_mr_mem_event_free_cb(struct mlx5_dev_ctx_shared *sh,
 		pos = ms_idx - mr->ms_base_idx;
 		MLX5_ASSERT(rte_bitmap_get(mr->ms_bmp, pos));
 		MLX5_ASSERT(pos < mr->ms_bmp_n);
-		DEBUG("device %s MR(%p): clear bitmap[%u] for addr %p",
+		DRV_LOG(DEBUG, "device %s MR(%p): clear bitmap[%u] for addr %p",
 		      sh->ibdev_name, (void *)mr, pos, (void *)start);
 		rte_bitmap_clear(mr->ms_bmp, pos);
 		if (--mr->ms_n == 0) {
 			LIST_REMOVE(mr, mr);
 			LIST_INSERT_HEAD(&sh->share_cache.mr_free_list, mr, mr);
-			DEBUG("device %s remove MR(%p) from list",
+			DRV_LOG(DEBUG, "device %s remove MR(%p) from list",
 			      sh->ibdev_name, (void *)mr);
 		}
 		/*
@@ -114,7 +114,7 @@ mlx5_mr_mem_event_free_cb(struct mlx5_dev_ctx_shared *sh,
 		 * before the core sees the newly allocated memory.
 		 */
 		++sh->share_cache.dev_gen;
-		DEBUG("broadcasting local cache flush, gen=%d",
+		DRV_LOG(DEBUG, "broadcasting local cache flush, gen=%d",
 		      sh->share_cache.dev_gen);
 		rte_smp_wmb();
 	}
@@ -405,7 +405,7 @@ mlx5_dma_unmap(struct rte_pci_device *pdev, void *addr,
 	}
 	LIST_REMOVE(mr, mr);
 	mlx5_mr_free(mr, sh->share_cache.dereg_mr_cb);
-	DEBUG("port %u remove MR(%p) from list", dev->data->port_id,
+	DRV_LOG(DEBUG, "port %u remove MR(%p) from list", dev->data->port_id,
 	      (void *)mr);
 	mlx5_mr_rebuild_cache(&sh->share_cache);
 	/*
@@ -418,7 +418,7 @@ mlx5_dma_unmap(struct rte_pci_device *pdev, void *addr,
 	 * before the core sees the newly allocated memory.
 	 */
 	++sh->share_cache.dev_gen;
-	DEBUG("broadcasting local cache flush, gen=%d",
+	DRV_LOG(DEBUG, "broadcasting local cache flush, gen=%d",
 	      sh->share_cache.dev_gen);
 	rte_smp_wmb();
 	rte_rwlock_read_unlock(&sh->share_cache.rwlock);
drivers/net/mlx5/mlx5_rxq.c +7 -4
index 8f9ee97f7a..9009eb8d18 100644
@@ -1972,7 +1972,8 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev,
 	for (j = 0; j < i; j++)
 		mlx5_rxq_release(dev, ind_tbl->queues[j]);
 	rte_errno = err;
-	DEBUG("Port %u cannot setup indirection table.", dev->data->port_id);
+	DRV_LOG(DEBUG, "Port %u cannot setup indirection table.",
+		dev->data->port_id);
 	return ret;
 }
 
@@ -2056,8 +2057,9 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,
 		 * reference unsupported. Intended for standalone indirection
 		 * tables only.
 		 */
-		DEBUG("Port %u cannot modify indirection table (refcnt> 1).",
-		      dev->data->port_id);
+		DRV_LOG(DEBUG,
+			"Port %u cannot modify indirection table (refcnt> 1).",
+			dev->data->port_id);
 		rte_errno = EINVAL;
 		return -rte_errno;
 	}
@@ -2081,7 +2083,8 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,
 	for (j = 0; j < i; j++)
 		mlx5_rxq_release(dev, ind_tbl->queues[j]);
 	rte_errno = err;
-	DEBUG("Port %u cannot setup indirection table.", dev->data->port_id);
+	DRV_LOG(DEBUG, "Port %u cannot setup indirection table.",
+		dev->data->port_id);
 	return ret;
 }
 
Signature · 1 line
2.30.1
#3 lore raw

PATCH 3/3 net/mlx5: reduce log level of alignment message

In reply to Thomas Monjalon

Having to force an alignment does not impact the user, so it should not be a warning.
The log level is reduced from warning to debug.

---
 drivers/net/mlx5/mlx5_utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_utils.c +2 -2
index 07373bff02..a39b5edddc 100644
@@ -40,8 +40,8 @@ mlx5_hlist_create(const char *name, uint32_t size, uint32_t entry_size,
 	/* Align to the next power of 2, 32bits integer is enough now. */
 	if (!rte_is_power_of_2(size)) {
 		act_size = rte_align32pow2(size);
-		DRV_LOG(WARNING, "Size 0x%" PRIX32 " is not power of 2, will "
-			"be aligned to 0x%" PRIX32 ".", size, act_size);
+		DRV_LOG(DEBUG, "Size 0x%" PRIX32 " is not power of 2, "
+			"will be aligned to 0x%" PRIX32 ".", size, act_size);
 	} else {
 		act_size = size;
 	}
Signature · 1 line
2.30.1
#4 lore raw

v2 cover adjust mlx debug logs

In reply to Thomas Monjalon

Few adjustments of debug log usage in mlx4/mlx5.

v2:
- fix a typo in an old log
- separate commit for line feed fixes (and fix more)

Thomas Monjalon (4):
net/mlx4: enable debug logs dynamically common/mlx5: enable debug logs dynamically common/mlx5: remove extra line feed in log messages net/mlx5: reduce log level of alignment message

 drivers/common/mlx5/mlx5_common.h     |  2 --
 drivers/common/mlx5/mlx5_common_mr.c  | 45 ++++++++++++++-------------
 drivers/common/mlx5/mlx5_common_pci.c |  4 +--
 drivers/common/mlx5/mlx5_devx_cmds.c  |  2 +-
 drivers/compress/mlx5/mlx5_compress.c |  2 +-
 drivers/net/mlx4/mlx4_utils.h         |  5 ++-
 drivers/net/mlx5/linux/mlx5_os.c      |  8 ++---
 drivers/net/mlx5/linux/mlx5_verbs.c   | 13 ++++----
 drivers/net/mlx5/mlx5_flow.c          |  2 +-
 drivers/net/mlx5/mlx5_mr.c            | 12 +++----
 drivers/net/mlx5/mlx5_rxq.c           | 11 ++++---
 drivers/net/mlx5/mlx5_utils.c         |  4 +--
 drivers/net/mlx5/windows/mlx5_os.c    |  2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c         |  2 +-
 14 files changed, 59 insertions(+), 55 deletions(-)
Signature · 1 line
2.30.1
#5 lore raw

PATCH v2 1/4 net/mlx4: enable debug logs dynamically

The macro DEBUG was doing nothing if not compiled with RTE_LIBRTE_MLX4_DEBUG.

As it is not used in the data path, it can be always enabled at compilation time. Then it can be enabled at runtime with:
--log-level pmd.net.mlx4:debug

---
 drivers/net/mlx4/mlx4_utils.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/mlx4/mlx4_utils.h +2 -3
index b8769562ab..fca21fd79c 100644
@@ -52,14 +52,13 @@ pmd_drv_log_basename(const char *s)
 			__LINE__, \
 			__func__, \
 			RTE_FMT_TAIL(__VA_ARGS__,)))
-#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
 #define MLX4_ASSERT(exp) RTE_VERIFY(exp)
 #define claim_zero(...) MLX4_ASSERT((__VA_ARGS__) == 0)
 
 #else /* RTE_LIBRTE_MLX4_DEBUG */
 
 /*
- * Like MLX4_ASSERT(), DEBUG() becomes a no-op and claim_zero() does not perform
+ * Like MLX4_ASSERT(), claim_zero() does not perform
  * any check when debugging is disabled.
  */
 
@@ -68,12 +67,12 @@ pmd_drv_log_basename(const char *s)
 		RTE_FMT(MLX4_DRIVER_NAME ": " \
 			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
 		RTE_FMT_TAIL(__VA_ARGS__,)))
-#define DEBUG(...) (void)0
 #define MLX4_ASSERT(exp) RTE_ASSERT(exp)
 #define claim_zero(...) (__VA_ARGS__)
 
 #endif /* RTE_LIBRTE_MLX4_DEBUG */
 
+#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
 #define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
 #define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
 #define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)
Signature · 1 line
2.30.1
Acked-by on v2 1/4
#6 lore raw

Re: [dpdk-dev] [PATCH v2 1/4] net/mlx4: enable debug logs dynamically

From: Thomas Monjalon

Quoted 8 lines

The macro DEBUG was doing nothing if not compiled with RTE_LIBRTE_MLX4_DEBUG.

As it is not used in the data path, it can be always enabled at compilation time. Then it can be enabled at runtime with:
--log-level pmd.net.mlx4:debug

#7 lore raw

Re: [dpdk-dev] [PATCH v2 1/4] net/mlx4: enable debug logs dynamically

In reply to Thomas Monjalon
Quoted 8 lines · Thomas Monjalon

The macro DEBUG was doing nothing if not compiled with RTE_LIBRTE_MLX4_DEBUG.

As it is not used in the data path, it can be always enabled at compilation time. Then it can be enabled at runtime with:
--log-level pmd.net.mlx4:debug

+1 to change, but why 'RTE_LIBRTE_MLX4_DEBUG' exists at first place?

It seems is is used both for data and control path, can you extend the patch for:
1- Remove #ifdef from control path
2- Replace with 'RTE_ETHDEV_DEBUG_RX' & 'RTE_ETHDEV_DEBUG_TX' for data path,
please see: https://patches.dpdk.org/project/dpdk/list/?series=15738
3- Remove 'RTE_LIBRTE_MLX4_DEBUG' completely, if not removed document it in the
driver documentation as supported config file

#8 lore raw

Re: [dpdk-dev] [PATCH v2 1/4] net/mlx4: enable debug logs dynamically

17/03/2021 18:29, Ferruh Yigit:

Quoted 10 lines · Thomas Monjalon
Quoted 8 lines

The macro DEBUG was doing nothing if not compiled with RTE_LIBRTE_MLX4_DEBUG.

As it is not used in the data path, it can be always enabled at compilation time. Then it can be enabled at runtime with:
--log-level pmd.net.mlx4:debug

Quoted 8 lines

+1 to change, but why 'RTE_LIBRTE_MLX4_DEBUG' exists at first place?

It seems is is used both for data and control path, can you extend the patch for:
1- Remove #ifdef from control path
2- Replace with 'RTE_ETHDEV_DEBUG_RX' & 'RTE_ETHDEV_DEBUG_TX' for data path,
please see: https://patches.dpdk.org/project/dpdk/list/?series=15738
3- Remove 'RTE_LIBRTE_MLX4_DEBUG' completely, if not removed document it in the
driver documentation as supported config file

To me using ETHDEV config macro in PMDs is new, and I think it is out of scope for this patch. But yes I agree it would be a nice improvement. Matan, please could you do this change during next month?

#9 lore raw

PATCH v2 2/4 common/mlx5: enable debug logs dynamically

In reply to Thomas Monjalon

Most debug logs are using DRV_LOG(DEBUG,)
but some were using DEBUG().
The macro DEBUG is doing nothing if not compiled with RTE_LIBRTE_MLX5_DEBUG.

As it is not used in the data path, the macro DEBUG can be replaced with DRV_LOG.
Then all debug logs can be enabled at runtime with:
--log-level pmd.net.mlx5:debug

---
 drivers/common/mlx5/mlx5_common.h    |  2 --
 drivers/common/mlx5/mlx5_common_mr.c | 45 +++++++++++++++-------------
 drivers/net/mlx5/linux/mlx5_verbs.c  | 13 ++++----
 drivers/net/mlx5/mlx5_mr.c           | 12 ++++----
 drivers/net/mlx5/mlx5_rxq.c          | 11 ++++---
 5 files changed, 44 insertions(+), 39 deletions(-)
drivers/common/mlx5/mlx5_common.h +0 -2
index 3855582d0d..5028a05b49 100644
@@ -92,14 +92,12 @@ pmd_drv_log_basename(const char *s)
 /* claim_zero() does not perform any check when debugging is disabled. */
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 
-#define DEBUG(...) DRV_LOG(DEBUG, __VA_ARGS__)
 #define MLX5_ASSERT(exp) RTE_VERIFY(exp)
 #define claim_zero(...) MLX5_ASSERT((__VA_ARGS__) == 0)
 #define claim_nonzero(...) MLX5_ASSERT((__VA_ARGS__) != 0)
 
 #else /* RTE_LIBRTE_MLX5_DEBUG */
 
-#define DEBUG(...) (void)0
 #define MLX5_ASSERT(exp) RTE_ASSERT(exp)
 #define claim_zero(...) (__VA_ARGS__)
 #define claim_nonzero(...) (__VA_ARGS__)
drivers/common/mlx5/mlx5_common_mr.c +24 -21

140 lines not on this page · raw message

drivers/net/mlx5/linux/mlx5_verbs.c +7 -6
index ade241b806..c7d4b177a0 100644
@@ -721,7 +721,7 @@ mlx5_rxq_ibv_obj_drop_create(struct rte_eth_dev *dev)
 		return 0;
 	rxq = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*rxq), 0, SOCKET_ID_ANY);
 	if (!rxq) {
-		DEBUG("Port %u cannot allocate drop Rx queue memory.",
+		DRV_LOG(DEBUG, "Port %u cannot allocate drop Rx queue memory.",
 		      dev->data->port_id);
 		rte_errno = ENOMEM;
 		return -rte_errno;
@@ -729,7 +729,7 @@ mlx5_rxq_ibv_obj_drop_create(struct rte_eth_dev *dev)
 	priv->drop_queue.rxq = rxq;
 	rxq->ibv_cq = mlx5_glue->create_cq(ctx, 1, NULL, NULL, 0);
 	if (!rxq->ibv_cq) {
-		DEBUG("Port %u cannot allocate CQ for drop queue.",
+		DRV_LOG(DEBUG, "Port %u cannot allocate CQ for drop queue.",
 		      dev->data->port_id);
 		rte_errno = errno;
 		goto error;
@@ -742,7 +742,7 @@ mlx5_rxq_ibv_obj_drop_create(struct rte_eth_dev *dev)
 						    .cq = rxq->ibv_cq,
 					      });
 	if (!rxq->wq) {
-		DEBUG("Port %u cannot allocate WQ for drop queue.",
+		DRV_LOG(DEBUG, "Port %u cannot allocate WQ for drop queue.",
 		      dev->data->port_id);
 		rte_errno = errno;
 		goto error;
@@ -785,8 +785,9 @@ mlx5_ibv_drop_action_create(struct rte_eth_dev *dev)
 					.comp_mask = 0,
 				 });
 	if (!ind_tbl) {
-		DEBUG("Port %u cannot allocate indirection table for drop"
-		      " queue.", dev->data->port_id);
+		DRV_LOG(DEBUG, "Port %u"
+			" cannot allocate indirection table for drop queue.",
+			dev->data->port_id);
 		rte_errno = errno;
 		goto error;
 	}
@@ -806,7 +807,7 @@ mlx5_ibv_drop_action_create(struct rte_eth_dev *dev)
 			.pd = priv->sh->pd
 		 });
 	if (!hrxq->qp) {
-		DEBUG("Port %u cannot allocate QP for drop queue.",
+		DRV_LOG(DEBUG, "Port %u cannot allocate QP for drop queue.",
 		      dev->data->port_id);
 		rte_errno = errno;
 		goto error;
drivers/net/mlx5/mlx5_mr.c +6 -6
index da4e91fc24..3255393ca2 100644
@@ -57,7 +57,7 @@ mlx5_mr_mem_event_free_cb(struct mlx5_dev_ctx_shared *sh,
 	int i;
 	int rebuild = 0;
 
-	DEBUG("device %s free callback: addr=%p, len=%zu",
+	DRV_LOG(DEBUG, "device %s free callback: addr=%p, len=%zu",
 	      sh->ibdev_name, addr, len);
 	msl = rte_mem_virt2memseg_list(addr);
 	/* addr and len must be page-aligned. */
@@ -87,13 +87,13 @@ mlx5_mr_mem_event_free_cb(struct mlx5_dev_ctx_shared *sh,
 		pos = ms_idx - mr->ms_base_idx;
 		MLX5_ASSERT(rte_bitmap_get(mr->ms_bmp, pos));
 		MLX5_ASSERT(pos < mr->ms_bmp_n);
-		DEBUG("device %s MR(%p): clear bitmap[%u] for addr %p",
+		DRV_LOG(DEBUG, "device %s MR(%p): clear bitmap[%u] for addr %p",
 		      sh->ibdev_name, (void *)mr, pos, (void *)start);
 		rte_bitmap_clear(mr->ms_bmp, pos);
 		if (--mr->ms_n == 0) {
 			LIST_REMOVE(mr, mr);
 			LIST_INSERT_HEAD(&sh->share_cache.mr_free_list, mr, mr);
-			DEBUG("device %s remove MR(%p) from list",
+			DRV_LOG(DEBUG, "device %s remove MR(%p) from list",
 			      sh->ibdev_name, (void *)mr);
 		}
 		/*
@@ -114,7 +114,7 @@ mlx5_mr_mem_event_free_cb(struct mlx5_dev_ctx_shared *sh,
 		 * before the core sees the newly allocated memory.
 		 */
 		++sh->share_cache.dev_gen;
-		DEBUG("broadcasting local cache flush, gen=%d",
+		DRV_LOG(DEBUG, "broadcasting local cache flush, gen=%d",
 		      sh->share_cache.dev_gen);
 		rte_smp_wmb();
 	}
@@ -405,7 +405,7 @@ mlx5_dma_unmap(struct rte_pci_device *pdev, void *addr,
 	}
 	LIST_REMOVE(mr, mr);
 	mlx5_mr_free(mr, sh->share_cache.dereg_mr_cb);
-	DEBUG("port %u remove MR(%p) from list", dev->data->port_id,
+	DRV_LOG(DEBUG, "port %u remove MR(%p) from list", dev->data->port_id,
 	      (void *)mr);
 	mlx5_mr_rebuild_cache(&sh->share_cache);
 	/*
@@ -418,7 +418,7 @@ mlx5_dma_unmap(struct rte_pci_device *pdev, void *addr,
 	 * before the core sees the newly allocated memory.
 	 */
 	++sh->share_cache.dev_gen;
-	DEBUG("broadcasting local cache flush, gen=%d",
+	DRV_LOG(DEBUG, "broadcasting local cache flush, gen=%d",
 	      sh->share_cache.dev_gen);
 	rte_smp_wmb();
 	rte_rwlock_read_unlock(&sh->share_cache.rwlock);
drivers/net/mlx5/mlx5_rxq.c +7 -4
index 8f9ee97f7a..9009eb8d18 100644
@@ -1972,7 +1972,8 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev,
 	for (j = 0; j < i; j++)
 		mlx5_rxq_release(dev, ind_tbl->queues[j]);
 	rte_errno = err;
-	DEBUG("Port %u cannot setup indirection table.", dev->data->port_id);
+	DRV_LOG(DEBUG, "Port %u cannot setup indirection table.",
+		dev->data->port_id);
 	return ret;
 }
 
@@ -2056,8 +2057,9 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,
 		 * reference unsupported. Intended for standalone indirection
 		 * tables only.
 		 */
-		DEBUG("Port %u cannot modify indirection table (refcnt> 1).",
-		      dev->data->port_id);
+		DRV_LOG(DEBUG,
+			"Port %u cannot modify indirection table (refcnt> 1).",
+			dev->data->port_id);
 		rte_errno = EINVAL;
 		return -rte_errno;
 	}
@@ -2081,7 +2083,8 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,
 	for (j = 0; j < i; j++)
 		mlx5_rxq_release(dev, ind_tbl->queues[j]);
 	rte_errno = err;
-	DEBUG("Port %u cannot setup indirection table.", dev->data->port_id);
+	DRV_LOG(DEBUG, "Port %u cannot setup indirection table.",
+		dev->data->port_id);
 	return ret;
 }
 
Signature · 1 line
2.30.1
Acked-by on v2 2/4
#10 lore raw

Re: [dpdk-dev] [PATCH v2 2/4] common/mlx5: enable debug logs dynamically

From: Thomas Monjalon

Quoted 10 lines

Most debug logs are using DRV_LOG(DEBUG,) but some were using DEBUG(). The macro DEBUG is doing nothing if not compiled with RTE_LIBRTE_MLX5_DEBUG.

As it is not used in the data path, the macro DEBUG can be replaced with DRV_LOG.
Then all debug logs can be enabled at runtime with:
--log-level pmd.net.mlx5:debug

#11 lore raw

Re: [dpdk-dev] [PATCH v2 2/4] common/mlx5: enable debug logs dynamically

In reply to Thomas Monjalon
Quoted 11 lines · Thomas Monjalon

Most debug logs are using DRV_LOG(DEBUG,)
but some were using DEBUG().
The macro DEBUG is doing nothing if not compiled with RTE_LIBRTE_MLX5_DEBUG.

As it is not used in the data path, the macro DEBUG can be replaced with DRV_LOG.
Then all debug logs can be enabled at runtime with:
--log-level pmd.net.mlx5:debug

Similar comment for the mlx4 one, copying here:

Why 'RTE_LIBRTE_MLX5_DEBUG' exists at first place?

It seems is is used both for data and control path, can you extend the patch for:
1- Remove #ifdef from control path
2- Replace with 'RTE_ETHDEV_DEBUG_RX' & 'RTE_ETHDEV_DEBUG_TX' for data path,
please see: https://patches.dpdk.org/project/dpdk/list/?series=15738
3- Remove 'RTE_LIBRTE_MLX5_DEBUG' completely, if not removed document it in the
driver documentation as supported config file

Both for 'mlx4' and 'mlx5', I will continue with existing patch, but can it be possible to make additional patches to address above issues?

#12 lore raw

Re: [dpdk-dev] [PATCH v2 2/4] common/mlx5: enable debug logs dynamically

17/03/2021 18:39, Ferruh Yigit:

Quoted 24 lines · Thomas Monjalon
Quoted 11 lines

Most debug logs are using DRV_LOG(DEBUG,)
but some were using DEBUG().
The macro DEBUG is doing nothing if not compiled with RTE_LIBRTE_MLX5_DEBUG.

As it is not used in the data path, the macro DEBUG can be replaced with DRV_LOG.
Then all debug logs can be enabled at runtime with:
--log-level pmd.net.mlx5:debug

Similar comment for the mlx4 one, copying here:

Why 'RTE_LIBRTE_MLX5_DEBUG' exists at first place?

It seems is is used both for data and control path, can you extend the patch for:
1- Remove #ifdef from control path
2- Replace with 'RTE_ETHDEV_DEBUG_RX' & 'RTE_ETHDEV_DEBUG_TX' for data path,
please see: https://patches.dpdk.org/project/dpdk/list/?series=15738
3- Remove 'RTE_LIBRTE_MLX5_DEBUG' completely, if not removed document it in the
driver documentation as supported config file

Quoted 2 lines

Both for 'mlx4' and 'mlx5', I will continue with existing patch, but can it be possible to make additional patches to address above issues?

Same answer as for mlx4 :)
To me using ETHDEV config macro in PMDs is new,
and I think it is out of scope for this patch.
But yes I agree it would be a nice improvement.
Matan, Slave, please could you do this change during next month?

#13 lore raw

Re: [dpdk-dev] [PATCH v2 2/4] common/mlx5: enable debug logs dynamically

From: Thomas Monjalon

Quoted 29 lines

17/03/2021 18:39, Ferruh Yigit:

Quoted 11 lines · Thomas Monjalon
Quoted 10 lines

Most debug logs are using DRV_LOG(DEBUG,) but some were using DEBUG().
The macro DEBUG is doing nothing if not compiled with RTE_LIBRTE_MLX5_DEBUG.

As it is not used in the data path, the macro DEBUG can be replaced with DRV_LOG.
Then all debug logs can be enabled at runtime with:
--log-level pmd.net.mlx5:debug

Quoted 7 lines
Quoted 1 line

Similar comment for the mlx4 one, copying here:

Why 'RTE_LIBRTE_MLX5_DEBUG' exists at first place?

It seems is is used both for data and control path, can you extend the patch

for:

Quoted 2 lines

1- Remove #ifdef from control path
2- Replace with 'RTE_ETHDEV_DEBUG_RX' & 'RTE_ETHDEV_DEBUG_TX' for

data path,

Quoted 3 lines

please see:
https://patches.dpdk.org/project/dpdk/list/?series=15738
3- Remove 'RTE_LIBRTE_MLX5_DEBUG' completely, if not removed

document it in the

Quoted 2 lines

driver documentation as supported config file

Quoted 8 lines
Quoted 2 lines

Both for 'mlx4' and 'mlx5', I will continue with existing patch, but can it be possible to make additional patches to address above issues?

Same answer as for mlx4 :)
To me using ETHDEV config macro in PMDs is new, and I think it is out of scope for this patch.
But yes I agree it would be a nice improvement.
Matan, Slave, please could you do this change during next month?

Yes, good suggestion, will add to our tasks.
Thanks Thomas\Ferruh.

Matan

#14 lore raw

PATCH v2 3/4 common/mlx5: remove extra line feed in log messages

In reply to Thomas Monjalon

The macro DRV_LOG already includes a terminating line feed character defined in PMD_DRV_LOG_.
The extra line feeds added in some messages are removed.

---
 drivers/common/mlx5/mlx5_common_pci.c | 4 ++--
 drivers/common/mlx5/mlx5_devx_cmds.c  | 2 +-
 drivers/compress/mlx5/mlx5_compress.c | 2 +-
 drivers/net/mlx5/linux/mlx5_os.c      | 8 ++++----
 drivers/net/mlx5/mlx5_flow.c          | 2 +-
 drivers/net/mlx5/windows/mlx5_os.c    | 2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c         | 2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)
drivers/common/mlx5/mlx5_common_pci.c +2 -2
index 2b657686d1..a7f541a90c 100644
@@ -245,14 +245,14 @@ drivers_probe(struct mlx5_pci_device *dev, struct rte_pci_driver *pci_drv,
 		already_loaded = dev->classes_loaded & driver->driver_class;
 		if (already_loaded &&
 		    !(driver->pci_driver.drv_flags & RTE_PCI_DRV_PROBE_AGAIN)) {
-			DRV_LOG(ERR, "Device %s is already probed\n",
+			DRV_LOG(ERR, "Device %s is already probed",
 				pci_dev->device.name);
 			ret = -EEXIST;
 			goto probe_err;
 		}
 		ret = driver->pci_driver.probe(pci_drv, pci_dev);
 		if (ret < 0) {
-			DRV_LOG(ERR, "Failed to load driver = %s.\n",
+			DRV_LOG(ERR, "Failed to load driver %s",
 				driver->pci_driver.driver.name);
 			goto probe_err;
 		}
drivers/common/mlx5/mlx5_devx_cmds.c +1 -1
index 0060c37fc0..8df14f5b7d 100644
@@ -275,7 +275,7 @@ mlx5_devx_cmd_mkey_create(void *ctx,
 	mkey->obj = mlx5_glue->devx_obj_create(ctx, in, in_size_dw * 4, out,
 					       sizeof(out));
 	if (!mkey->obj) {
-		DRV_LOG(ERR, "Can't create %sdirect mkey - error %d\n",
+		DRV_LOG(ERR, "Can't create %sdirect mkey - error %d",
 			klm_num ? "an in" : "a ", errno);
 		rte_errno = errno;
 		mlx5_free(mkey);
drivers/compress/mlx5/mlx5_compress.c +1 -1
index 46255ab5e0..85238accff 100644
@@ -257,7 +257,7 @@ mlx5_compress_qp_setup(struct rte_compressdev *dev, uint16_t qp_id,
 		DRV_LOG(ERR, "Can't change SQ state to ready.");
 		goto err;
 	}
-	DRV_LOG(INFO, "QP %u: SQN=0x%X CQN=0x%X entries num = %u\n",
+	DRV_LOG(INFO, "QP %u: SQN=0x%X CQN=0x%X entries num = %u",
 		(uint32_t)qp_id, qp->sq.sq->id, qp->cq.cq->id, qp->entries_n);
 	return 0;
 err:
drivers/net/mlx5/linux/mlx5_os.c +4 -4
index 81eb2e4b05..b03cafda6a 100644
@@ -1233,14 +1233,14 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		if (config->hca_attr.log_max_ft_sampler_num > 0  &&
 		    config->dv_flow_en) {
 			priv->sampler_en = 1;
-			DRV_LOG(DEBUG, "The Sampler enabled!\n");
+			DRV_LOG(DEBUG, "Sampler enabled!");
 		} else {
 			priv->sampler_en = 0;
 			if (!config->hca_attr.log_max_ft_sampler_num)
-				DRV_LOG(WARNING, "No available register for"
-						" Sampler.");
+				DRV_LOG(WARNING,
+					"No available register for sampler.");
 			else
-				DRV_LOG(DEBUG, "DV flow is not supported!\n");
+				DRV_LOG(DEBUG, "DV flow is not supported!");
 		}
 #endif
 	}
drivers/net/mlx5/mlx5_flow.c +1 -1
index ab5be3dacc..773f3e63f4 100644
@@ -7924,7 +7924,7 @@ void mlx5_release_tunnel_hub(struct mlx5_dev_ctx_shared *sh, uint16_t port_id)
 	if (!thub)
 		return;
 	if (!LIST_EMPTY(&thub->tunnels))
-		DRV_LOG(WARNING, "port %u tunnels present\n", port_id);
+		DRV_LOG(WARNING, "port %u tunnels present", port_id);
 	mlx5_hlist_destroy(thub->groups);
 	mlx5_free(thub);
 }
drivers/net/mlx5/windows/mlx5_os.c +1 -1
index e37cc65c17..e7db85b757 100644
@@ -165,7 +165,7 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv)
 	if (!sh->flow_tbls)
 		err = mlx5_alloc_table_hash_list(priv);
 	else
-		DRV_LOG(DEBUG, "sh->flow_tbls[%p] already created, reuse\n",
+		DRV_LOG(DEBUG, "sh->flow_tbls[%p] already created, reuse",
 			(void *)sh->flow_tbls);
 	return err;
 }
drivers/vdpa/mlx5/mlx5_vdpa.c +1 -1
index 4c2d886bd7..5755a68ec4 100644
@@ -751,7 +751,7 @@ mlx5_vdpa_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	priv->pci_dev = pci_dev;
 	priv->var = mlx5_glue->dv_alloc_var(ctx, 0);
 	if (!priv->var) {
-		DRV_LOG(ERR, "Failed to allocate VAR %u.\n", errno);
+		DRV_LOG(ERR, "Failed to allocate VAR %u.", errno);
 		goto error;
 	}
 	priv->vdev = rte_vdpa_register_device(&pci_dev->device,
Signature · 1 line
2.30.1
#16 lore raw

PATCH v2 4/4 net/mlx5: reduce log level of alignment message

In reply to Thomas Monjalon

Having to force an alignment does not impact the user, so it should not be a warning.
The log level is reduced from warning to debug.

---
 drivers/net/mlx5/mlx5_utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_utils.c +2 -2
index 07373bff02..a39b5edddc 100644
@@ -40,8 +40,8 @@ mlx5_hlist_create(const char *name, uint32_t size, uint32_t entry_size,
 	/* Align to the next power of 2, 32bits integer is enough now. */
 	if (!rte_is_power_of_2(size)) {
 		act_size = rte_align32pow2(size);
-		DRV_LOG(WARNING, "Size 0x%" PRIX32 " is not power of 2, will "
-			"be aligned to 0x%" PRIX32 ".", size, act_size);
+		DRV_LOG(DEBUG, "Size 0x%" PRIX32 " is not power of 2, "
+			"will be aligned to 0x%" PRIX32 ".", size, act_size);
 	} else {
 		act_size = size;
 	}
Signature · 1 line
2.30.1
#18 lore raw
In reply to Thomas Monjalon

Hi,

Quoted 35 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Tuesday, March 9, 2021 11:49 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 0/4] adjust mlx debug logs

Few adjustments of debug log usage in mlx4/mlx5.

v2:
- fix a typo in an old log
- separate commit for line feed fixes (and fix more)

Thomas Monjalon (4):
net/mlx4: enable debug logs dynamically common/mlx5: enable debug logs dynamically common/mlx5: remove extra line feed in log messages net/mlx5: reduce log level of alignment message

 drivers/common/mlx5/mlx5_common.h     |  2 --
 drivers/common/mlx5/mlx5_common_mr.c  | 45 ++++++++++++++----------
---
 drivers/common/mlx5/mlx5_common_pci.c |  4 +--
 drivers/common/mlx5/mlx5_devx_cmds.c  |  2 +-
 drivers/compress/mlx5/mlx5_compress.c |  2 +-
 drivers/net/mlx4/mlx4_utils.h         |  5 ++-
 drivers/net/mlx5/linux/mlx5_os.c      |  8 ++---
 drivers/net/mlx5/linux/mlx5_verbs.c   | 13 ++++----
 drivers/net/mlx5/mlx5_flow.c          |  2 +-
 drivers/net/mlx5/mlx5_mr.c            | 12 +++----
 drivers/net/mlx5/mlx5_rxq.c           | 11 ++++---
 drivers/net/mlx5/mlx5_utils.c         |  4 +--
 drivers/net/mlx5/windows/mlx5_os.c    |  2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c         |  2 +-
 14 files changed, 59 insertions(+), 55 deletions(-)
Quoted 2 lines

--
2.30.1

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh