[v7,3/5] eal: set thread name on Windows worker threads

Message ID 1674502774-20253-4-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series add rte_thread_set_name API for rte_thread_t |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff Jan. 23, 2023, 7:39 p.m. UTC
  Bring Windows EAL worker thread initialization in line with linux &
freebsd by setting the worker thread name using the new
platform agnostic rte_thread_set_name API.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Acked-by: Morten Brørup <mb@smartsharesystems.com>

---
 lib/eal/windows/eal.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Thomas Monjalon Jan. 24, 2023, 3:25 p.m. UTC | #1
23/01/2023 20:39, Tyler Retzlaff:
> Bring Windows EAL worker thread initialization in line with linux &
> freebsd by setting the worker thread name using the new
> platform agnostic rte_thread_set_name API.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> 
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> 
> ---
>  lib/eal/windows/eal.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
> index b9f95ed..e561f87 100644
> --- a/lib/eal/windows/eal.c
> +++ b/lib/eal/windows/eal.c
> @@ -282,6 +282,7 @@ enum rte_proc_type_t
>  	enum rte_iova_mode iova_mode;
>  	int ret;
>  	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
> +	char thread_name[RTE_MAX_THREAD_NAME_LEN];
>  
>  	eal_log_init(NULL, 0);
>  
> @@ -437,6 +438,12 @@ enum rte_proc_type_t
>  		if (rte_thread_create(&lcore_config[i].thread_id, NULL,
>  				eal_thread_loop, (void *)(uintptr_t)i) != 0)
>  			rte_panic("Cannot create thread\n");
> +
> +		/* Set thread_name for aid in debugging. */

No need of underscore in "thread name".

> +		snprintf(thread_name, sizeof(thread_name),
> +			"rte-worker-%d", i);
> +		rte_thread_set_name(lcore_config[i].thread_id, thread_name);

Thanks for making implementations more uniform.
  
Tyler Retzlaff Jan. 24, 2023, 3:33 p.m. UTC | #2
On Tue, Jan 24, 2023 at 04:25:34PM +0100, Thomas Monjalon wrote:
> 23/01/2023 20:39, Tyler Retzlaff:
> > Bring Windows EAL worker thread initialization in line with linux &
> > freebsd by setting the worker thread name using the new
> > platform agnostic rte_thread_set_name API.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > 
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > 
> > ---
> >  lib/eal/windows/eal.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
> > index b9f95ed..e561f87 100644
> > --- a/lib/eal/windows/eal.c
> > +++ b/lib/eal/windows/eal.c
> > @@ -282,6 +282,7 @@ enum rte_proc_type_t
> >  	enum rte_iova_mode iova_mode;
> >  	int ret;
> >  	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
> > +	char thread_name[RTE_MAX_THREAD_NAME_LEN];
> >  
> >  	eal_log_init(NULL, 0);
> >  
> > @@ -437,6 +438,12 @@ enum rte_proc_type_t
> >  		if (rte_thread_create(&lcore_config[i].thread_id, NULL,
> >  				eal_thread_loop, (void *)(uintptr_t)i) != 0)
> >  			rte_panic("Cannot create thread\n");
> > +
> > +		/* Set thread_name for aid in debugging. */
> 
> No need of underscore in "thread name".

The variable name was copied from linux/eal.c and matches freebsd/eal.c
do you still want me to remove the underscore?  It will require another
revision of the series.

> 
> > +		snprintf(thread_name, sizeof(thread_name),
> > +			"rte-worker-%d", i);
> > +		rte_thread_set_name(lcore_config[i].thread_id, thread_name);
> 
> Thanks for making implementations more uniform.

my pleasure.
  
Thomas Monjalon Jan. 24, 2023, 3:47 p.m. UTC | #3
24/01/2023 16:33, Tyler Retzlaff:
> On Tue, Jan 24, 2023 at 04:25:34PM +0100, Thomas Monjalon wrote:
> > 23/01/2023 20:39, Tyler Retzlaff:
> > > Bring Windows EAL worker thread initialization in line with linux &
> > > freebsd by setting the worker thread name using the new
> > > platform agnostic rte_thread_set_name API.
> > > 
> > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > 
> > > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > > 
> > > ---
> > >  lib/eal/windows/eal.c | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
> > > index b9f95ed..e561f87 100644
> > > --- a/lib/eal/windows/eal.c
> > > +++ b/lib/eal/windows/eal.c
> > > @@ -282,6 +282,7 @@ enum rte_proc_type_t
> > >  	enum rte_iova_mode iova_mode;
> > >  	int ret;
> > >  	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
> > > +	char thread_name[RTE_MAX_THREAD_NAME_LEN];
> > >  
> > >  	eal_log_init(NULL, 0);
> > >  
> > > @@ -437,6 +438,12 @@ enum rte_proc_type_t
> > >  		if (rte_thread_create(&lcore_config[i].thread_id, NULL,
> > >  				eal_thread_loop, (void *)(uintptr_t)i) != 0)
> > >  			rte_panic("Cannot create thread\n");
> > > +
> > > +		/* Set thread_name for aid in debugging. */
> > 
> > No need of underscore in "thread name".
> 
> The variable name was copied from linux/eal.c and matches freebsd/eal.c
> do you still want me to remove the underscore?  It will require another
> revision of the series.

I mean in the comment, you want to use natural language,
not the variable name.

Before making a new revision, let me check all patches.
  

Patch

diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index b9f95ed..e561f87 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -282,6 +282,7 @@  enum rte_proc_type_t
 	enum rte_iova_mode iova_mode;
 	int ret;
 	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
+	char thread_name[RTE_MAX_THREAD_NAME_LEN];
 
 	eal_log_init(NULL, 0);
 
@@ -437,6 +438,12 @@  enum rte_proc_type_t
 		if (rte_thread_create(&lcore_config[i].thread_id, NULL,
 				eal_thread_loop, (void *)(uintptr_t)i) != 0)
 			rte_panic("Cannot create thread\n");
+
+		/* Set thread_name for aid in debugging. */
+		snprintf(thread_name, sizeof(thread_name),
+			"rte-worker-%d", i);
+		rte_thread_set_name(lcore_config[i].thread_id, thread_name);
+
 		ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,
 			&lcore_config[i].cpuset);
 		if (ret != 0)