[v2,1/2] eal: fix potential incorrect pinning for ctrl threads

Message ID 1550151042-9764-1-git-send-email-david.marchand@redhat.com
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • [v2,1/2] eal: fix potential incorrect pinning for ctrl threads
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

David Marchand Feb. 14, 2019, 1:30 p.m.
pthread_setaffinity_np returns a >0 value on error.
We could end up letting the ctrl threads on the current process cpu
affinity.

Fixes: d651ee4919cd ("eal: set affinity for control threads")
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/librte_eal/common/eal_common_thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Burakov, Anatoly Feb. 14, 2019, 4:12 p.m. | #1
On 14-Feb-19 1:30 PM, David Marchand wrote:
> pthread_setaffinity_np returns a >0 value on error.
> We could end up letting the ctrl threads on the current process cpu
> affinity.
> 
> Fixes: d651ee4919cd ("eal: set affinity for control threads")
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>   lib/librte_eal/common/eal_common_thread.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c
> index 48ef4d6..a3985ce 100644
> --- a/lib/librte_eal/common/eal_common_thread.c
> +++ b/lib/librte_eal/common/eal_common_thread.c
> @@ -209,7 +209,7 @@ static void *rte_thread_init(void *arg)
>   		CPU_SET(rte_get_master_lcore(), &cpuset);
>   
>   	ret = pthread_setaffinity_np(*thread, sizeof(cpuset), &cpuset);
> -	if (ret < 0)
> +	if (ret)
>   		goto fail;
>   
>   	ret = pthread_barrier_wait(&params->configured);
> 

CC: stable?
David Marchand Feb. 14, 2019, 5:45 p.m. | #2
On Thu, Feb 14, 2019 at 5:12 PM Burakov, Anatoly <anatoly.burakov@intel.com>
wrote:

> On 14-Feb-19 1:30 PM, David Marchand wrote:
> > pthread_setaffinity_np returns a >0 value on error.
> > We could end up letting the ctrl threads on the current process cpu
> > affinity.
> >
> > Fixes: d651ee4919cd ("eal: set affinity for control threads")
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> >   lib/librte_eal/common/eal_common_thread.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/common/eal_common_thread.c
> b/lib/librte_eal/common/eal_common_thread.c
> > index 48ef4d6..a3985ce 100644
> > --- a/lib/librte_eal/common/eal_common_thread.c
> > +++ b/lib/librte_eal/common/eal_common_thread.c
> > @@ -209,7 +209,7 @@ static void *rte_thread_init(void *arg)
> >               CPU_SET(rte_get_master_lcore(), &cpuset);
> >
> >       ret = pthread_setaffinity_np(*thread, sizeof(cpuset), &cpuset);
> > -     if (ret < 0)
> > +     if (ret)
> >               goto fail;
> >
> >       ret = pthread_barrier_wait(&params->configured);
> >
>
> CC: stable?
>

Yes, I again forgot to check with check-git-log.sh...

Patch

diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c
index 48ef4d6..a3985ce 100644
--- a/lib/librte_eal/common/eal_common_thread.c
+++ b/lib/librte_eal/common/eal_common_thread.c
@@ -209,7 +209,7 @@  static void *rte_thread_init(void *arg)
 		CPU_SET(rte_get_master_lcore(), &cpuset);
 
 	ret = pthread_setaffinity_np(*thread, sizeof(cpuset), &cpuset);
-	if (ret < 0)
+	if (ret)
 		goto fail;
 
 	ret = pthread_barrier_wait(&params->configured);