[pulseaudio-tickets] [Bug 96809] New: once-test fails on systems with dynamic CPU configurations

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jul 4 20:52:00 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=96809

            Bug ID: 96809
           Summary: once-test fails on systems with dynamic CPU
                    configurations
           Product: PulseAudio
           Version: unspecified
          Hardware: All
                OS: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: core
          Assignee: pulseaudio-bugs at lists.freedesktop.org
          Reporter: glaubitz at physik.fu-berlin.de
        QA Contact: pulseaudio-bugs at lists.freedesktop.org
                CC: lennart at poettering.net

Hello!

PulseAudio currently fails to build from source on sparc64 [1]:

FAIL: once-test
===============

Running suite(s): Once
0%: Checks: 1, Failures: 1, Errors: 0
tests/once-test.c:74:F:once:once_test:0: Assertion
'pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) == 0' failed
FAIL once-test (exit status: 1)

This happens because pthread_setaffinity_np() returned -EINVAL on the test
system. After some debugging, it became quickly obvious why this was happening,
the test tried to call the function on CPUs that were currently not present on
the test system, more precisely, it tried to set the affinity on CPU 64 and
higher while the machine had currently only 64 CPUs (index 0-63) online.

The reason for this is the improper use of sysconf(_SC_NPROCESSORS_CONF) in
pulsecore/core-util.c:pa_ncpus() to determine the number of available CPUs
which is not correct as the operating system may disable individual CPUs
without this number changing. Thus, the proper call to determine the number of
available CPUs is sysconf(_SC_NPROCESSORS_ONLN). This is also documented in the
glibc manual in [2].

After patching pulsecore/core-util.c with the attached patch, the number of
currently available CPUs is correctly detected and the once-test succeeds on
the test system.

I therefore suggest applying the attached patch.

It might also be advisable to change the code in the future to use CPU sets on
Linux as even the suggested change is not 100% safe but at least it improves
over the existing code. If PulseAudio was to be run in a CPU set [3], the
number of processors available to PulseAudio could be even less than the number
of CPUs currently online (_SC_NPROCESSORS_CONF).

Thanks,
Adrian

> [1] https://buildd.debian.org/status/fetch.php?pkg=pulseaudio&arch=sparc64&ver=9.0-1&stamp=1467572458
> [2] https://www.gnu.org/software/libc/manual/html_node/Processor-Resources.html
> [3] http://man7.org/linux/man-pages/man7/cpuset.7.html

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-bugs/attachments/20160704/9350eb30/attachment-0001.html>


More information about the pulseaudio-bugs mailing list