Skip to contentSkip to conversation

vdpa/mlx5: improve portability of thread naming

PATCH Applied Thomas Monjalon 4 participants 5 messages Apr 21, 2021 – Apr 28, 2021

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

PATCH 1/1 vdpa/mlx5: improve portability of thread naming

The function pthread_setname_np is non-portable,
so it may be unavailable in old glibc or other systems. The function rte_thread_setname is workarounding portability issues.

---
 drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/mlx5/mlx5_vdpa_event.c +1 -1
index 404e135d5c..ca6e985336 100644
@@ -544,7 +544,7 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
 			goto error;
 		}
 		snprintf(name, sizeof(name), "vDPA-mlx5-%d", priv->vid);
-		ret = pthread_setname_np(priv->timer_tid, name);
+		ret = rte_thread_setname(priv->timer_tid, name);
 		if (ret) {
 			DRV_LOG(ERR, "Failed to set timer thread name.");
 			return -1;
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Thursday, April 22, 2021 1:59 AM
To: [email protected]
Cc: Matan Azrad <[email protected]>; Viacheslav Ovsiienko <[email protected]>
Subject: [dpdk-dev] [PATCH] vdpa/mlx5: improve portability of thread naming

The function pthread_setname_np is non-portable,
so it may be unavailable in old glibc or other systems. The function rte_thread_setname is workarounding portability issues.

---
 drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/mlx5/mlx5_vdpa_event.c +1 -2
index 404e135d5c..ca6e985336 100644
@@ -544,7 +544,7 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
 			goto error;
 		}
 		snprintf(name, sizeof(name), "vDPA-mlx5-%d", priv->vid);
-		ret = pthread_setname_np(priv->timer_tid, name);
+		ret = rte_thread_setname(priv->timer_tid, name);
 		if (ret) {
 			DRV_LOG(ERR, "Failed to set timer thread name.");
 			return -1;
--
Quoted 1 line

2.31.1

Applied
#4 lore raw
In reply to Thomas Monjalon
Quoted 32 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Thursday, April 22, 2021 1:59 AM
To: [email protected]
Cc: Matan Azrad <[email protected]>; Viacheslav Ovsiienko <[email protected]>
Subject: [dpdk-dev] [PATCH] vdpa/mlx5: improve portability of thread naming

The function pthread_setname_np is non-portable,
so it may be unavailable in old glibc or other systems. The function rte_thread_setname is workarounding portability issues.

---
 drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/mlx5/mlx5_vdpa_event.c +1 -2
index 404e135d5c..ca6e985336 100644
@@ -544,7 +544,7 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
 			goto error;
 		}
 		snprintf(name, sizeof(name), "vDPA-mlx5-%d", priv->vid);
-		ret = pthread_setname_np(priv->timer_tid, name);
+		ret = rte_thread_setname(priv->timer_tid, name);
 		if (ret) {
 			DRV_LOG(ERR, "Failed to set timer thread name.");
 			return -1;
--
Quoted 1 line

2.31.1

Applied to next-virtio/main, thanks