Current versions of ODP linux-generic use sched_getaffinity() and / or pthread_getaffinity_np() to obtain counts and sets of CPUs for use by ODP tasks. This method returns inappropriate results when the underlying kernel is compiled with NO_HZ_FULL support, as are the current LNG kernels. See Linaro BUG 2027 for details. https://bugs.linaro.org/show_bug.cgi?id=2027
Some of the validation and performance tests were using deprecated methods for determining counts of available CPUs. Fixing the linux-generic cpumask creation issues exposed the incorrect test code and caused these tests to hang up. Since these tests are used to validate ODP linux-generic code changes, fixing the tests became a prerequisite to submitting patches to address BUG 2027... so patch 1 in this series addresses the test faults. These test changes were confirmed to work properly whether the bug 2027 fix is in place or not - they do not depend on the bug fix. As to the bug fix itself, the 'getaffinity' CPU detection logic is replaced by code which mines the /sysfs pseudo-filesystem for info about the CPUs detected on the system at boot time. In this third revision the bug fix code has been modified to behave thusly: Per consensus based on discussions the new CPU detection logic by default includes all installed CPUs in both the control and worker cpumasks. Default cpumask generation is consistent with non-isolated operations. All thread sibling cpumask optimization has been removed and the added initialization stage marker for cpumasks has been removed as well. Per a suggestion by Petri S. the cpumask generation is moved from the odp_cpumask_default_control() and odp_cpumask_default_worker() functions into the odp_init_global() function. The odp_cpumask_default*() functions now use the cpumasks supplied by odp_init_global() without modification - except for returning a mask containing only the number of CPUs requested or the number available (whichever is fewer) - when asked to provide a default worker cpumask. As a bonus the bug fix cpumask generation logic also reduces the number of changes required in order to support an anticipated ODP API change which would allow ODP to accept and use control and worker cpumasks specified by an external entity such as a provisioning executive or a command-line argument parser. Gary S. Robertson (2): linux-generic: Correct worker count calculation in tests linux-generic: Make cpu detection work with NO_HZ_FULL platform/linux-generic/include/odp_internal.h | 6 ++ platform/linux-generic/odp_cpumask_task.c | 45 +++++++------- platform/linux-generic/odp_init.c | 90 ++++++++++++++++++++++++++- platform/linux-generic/odp_system_info.c | 14 ++--- test/performance/odp_atomic.c | 9 ++- test/validation/cpumask/cpumask.c | 2 +- test/validation/shmem/shmem.c | 5 +- test/validation/timer/timer.c | 16 ++--- 8 files changed, 139 insertions(+), 48 deletions(-) -- 1.9.1 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp