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

Message ID 1550608871-5251-1-git-send-email-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v3,1/2] eal: fix potential incorrect pinning for ctrl threads |

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. 19, 2019, 8:41 p.m. UTC
  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")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changelog since v2:
- added missing Cc: stable@dpdk.org

---
 lib/librte_eal/common/eal_common_thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Anatoly Burakov Feb. 20, 2019, 4:01 p.m. UTC | #1
On 19-Feb-19 8:41 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")
> Cc: stable@dpdk.org
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
  
Olivier Matz Feb. 25, 2019, 8:33 a.m. UTC | #2
On Wed, Feb 20, 2019 at 04:01:12PM +0000, Burakov, Anatoly wrote:
> On 19-Feb-19 8:41 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")
> > Cc: stable@dpdk.org
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> 
> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>

Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
  

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);