numam-dpdk/test
Harry van Haaren 8d39d3e237 service: fix race in service on app lcore function
This commit fixes a possible race condition if an application
uses the service-cores infrastructure and the function to run
a service on an application lcore at the same time.

The fix is to change the num_mapped_cores variable to be an
atomic variable. This causes concurrent accesses by multiple
threads to a service using rte_service_run_iter_on_app_lcore()
to detect if another core is currently mapped to the service,
and refuses to run if it is not multi-thread safe.

The run iteration on app lcore function has two arguments, the
service id to run, and if atomics should be used to serialize access
to multi-thread unsafe services. This allows applications to choose
if they wish to use use the service-cores feature, or if they
take responsibility themselves for serializing invoking a service.
See doxygen documentation for more details.

Two unit tests were added to verify the behaviour of the
function to run a service on an application core, testing both
a multi-thread safe service, and a multi-thread unsafe service.

The doxygen API documentation for the function has been updated
to reflect the current and correct behaviour.

Fixes: e9139a32f6 ("service: add function to run on app lcore")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-11-07 01:42:04 +01:00
..
cmdline_test mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
test service: fix race in service on app lcore function 2017-11-07 01:42:04 +01:00
test-acl mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
test-pipeline remove useless memzone includes 2017-11-06 22:12:08 +01:00
Makefile test: move unit tests to separate directory 2017-02-28 16:04:18 +01:00