eal: fix hang in control thread creation
authorLuc Pelletier <lucp.at.work@gmail.com>
Wed, 7 Apr 2021 20:16:06 +0000 (16:16 -0400)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 9 Apr 2021 14:37:55 +0000 (16:37 +0200)
commitaf68c1d699be6c369e296b775bdbf13ae18b79cc
tree284823bc80f0bcf1e47c9871c8f9e7e40e4a487f
parent34cc55cce6b180a6c3ee3fcf70a0fd56927f240d
eal: fix hang in control thread creation

The affinity of a control thread is set after it has been launched. If
setting the affinity fails, pthread_cancel is called followed by a call
to pthread_join, which can hang forever if the thread's start routine
doesn't call a pthread cancellation point.

This patch modifies the logic so that the control thread exits
gracefully if the affinity cannot be set successfully and removes the
call to pthread_cancel.

Fixes: 6383d2642b62 ("eal: set name when creating a control thread")
Cc: stable@dpdk.org
Signed-off-by: Luc Pelletier <lucp.at.work@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
lib/librte_eal/common/eal_common_thread.c