Bug 96638

Summary: once-test fails
Product: PulseAudio Reporter: than <than>
Component: build-systemAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart, rdieter
Version: unspecified   
Hardware: PowerPC   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description than 2016-06-22 16:03:45 UTC
The once-test fails for 8.99 versions

Version-Release number of selected component (if applicable):
pulseaudio-8.99.2-1.fc25

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)

imo it's a bug in the check which just run the threads on all CPUs even some CPUS are on active, for example on ppc64/ppc64le in koji (fedora build enviroment)

i did a patch which resolves this issue for me.

diff -up pulseaudio-8.99.2/src/tests/once-test.c.than pulseaudio-8.99.2/src/tests/once-test.c
--- pulseaudio-8.99.2/src/tests/once-test.c.than        2016-06-22 10:20:57.127583628 -0400
+++ pulseaudio-8.99.2/src/tests/once-test.c     2016-06-22 10:59:38.905573634 -0400
@@ -70,7 +70,7 @@ static void thread_func(void *data) {
 #endif
 
     CPU_ZERO(&mask);
-    CPU_SET((size_t) (pa_atomic_inc(&i_cpu) % n_cpu), &mask);
+    CPU_SET(pthread_getaffinity_np(pthread_self(), sizeof(mask), &mask), &mask);
     fail_unless(pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) == 0);
 #endif
Comment 1 than 2017-01-17 12:25:25 UTC
could someone please review the patch? it would be great if it can be merged into next update.

Thannks
Comment 2 Tanu Kaskinen 2017-01-24 05:19:55 UTC
Sorry for late reply. The current code indeed does bad assumptions about the availability of cpus. The fix doesn't seem quite right, however. Unless I'm mistaken, your patch is equivalent to just removing the setaffinity call, because you set the affinity to the same value that is already set for the thread.

Note also that we have another fix applied for pa_ncpus():
https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=1df21e6ab6cd42e2f7601a6c5577c20b7e3d1046

That changes things so that we don't try to use more cpus than what are online. That might or might not fix the problem that you're seeing. The once-test code still makes the assumption that the cpus that are online are numbered 0, 1, 2, etc. which may be incorrect.
Comment 3 GitLab Migration User 2018-07-30 10:30:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/475.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.