vdpa/mlx5: improve portability of thread naming

Message ID 20210421175924.1541816-1-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series vdpa/mlx5: improve portability of thread naming |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues
ci/intel-Testing success Testing PASS
ci/github-robot success github build: passed
ci/iol-testing fail Testing issues
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS

Commit Message

Thomas Monjalon April 21, 2021, 5:59 p.m. UTC
  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.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Chenbo Xia April 26, 2021, 5:04 a.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Thomas Monjalon
> Sent: Thursday, April 22, 2021 1:59 AM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Viacheslav Ovsiienko
> <viacheslavo@nvidia.com>
> 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.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> index 404e135d5c..ca6e985336 100644
> --- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> +++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> @@ -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;
> --
> 2.31.1

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
  
Matan Azrad April 26, 2021, 7:59 a.m. UTC | #2
From: Thomas Monjalon
> 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.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@nvidia.com>

Thanks!
  
Chengwen Feng April 26, 2021, 9:04 a.m. UTC | #3
On 2021/4/22 1:59, Thomas Monjalon wrote:
> 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.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
  
Chenbo Xia April 28, 2021, 3:29 a.m. UTC | #4
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Thomas Monjalon
> Sent: Thursday, April 22, 2021 1:59 AM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Viacheslav Ovsiienko
> <viacheslavo@nvidia.com>
> 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.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> index 404e135d5c..ca6e985336 100644
> --- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> +++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> @@ -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;
> --
> 2.31.1

Applied to next-virtio/main, thanks
  

Patch

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index 404e135d5c..ca6e985336 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -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;