service: fix service core launch
authorHarry van Haaren <harry.van.haaren@intel.com>
Tue, 9 Jan 2018 13:37:41 +0000 (13:37 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 11 Jan 2018 22:30:30 +0000 (23:30 +0100)
commit72e6d1b94bd7c173af0500369e5bc34be8e58ec1
treeed3ff46cff44fd19beded5bdc3ae8e55633a670a
parent54e7456a3bfdf2d7fe651ec25e951fe4b44be569
service: fix service core launch

This patch fixes a potential bug, which was not consistently
showing up in the unit tests. The issue was that the service-
lcore being started was not in a "WAIT" state, and hence EAL
would return -EBUSY instead of launching the lcore.

In order to ensure a core is in a launch-ready state, the application
must call rte_eal_wait_lcore, to ensure that the core has completed
its previous task, and that EAL is ready to re-launch it.

The call to rte_eal_wait_lcore() is explicitly not in the
service core function, to make it visible to the application.
Requiring an explicit function call ensures the developer sees
that a lcore could block in the rte_eal_wait_lcore() function
if the core hasn't returned from its previous function.

From a usability perspective, hiding the wait_lcore() inside
service cores would cause confusion.

This patch adds rte_eal_wait_lcore() calls to the unit tests,
to ensure that the lcores for testing functionality are ready
to run the test.

Fixes: 21698354c832 ("service: introduce service cores concept")
Cc: stable@dpdk.org
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
lib/librte_eal/common/include/rte_service.h
test/test/test_service_cores.c