From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH for 5.1 3/3] rseq/selftests: Adapt number of threads to the number of detected cpus Date: Fri, 19 Apr 2019 12:38:47 +0200 Message-ID: <20190419103847.GA111210@gmail.com> References: <20190305194755.2602-1-mathieu.desnoyers@efficios.com> <20190305194755.2602-4-mathieu.desnoyers@efficios.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190305194755.2602-4-mathieu.desnoyers@efficios.com> Sender: linux-kernel-owner@vger.kernel.org To: Mathieu Desnoyers Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Peter Zijlstra , "Paul E . McKenney" , Boqun Feng , Andy Lutomirski , Dave Watson , Paul Turner , Andrew Morton , Russell King , Ingo Molnar , "H . Peter Anvin" , Andi Kleen , Chris Lameter , Ben Maurer , Steven Rostedt , Josh Triplett , Linus Torvalds , Catalin Marinas , Will Deacon List-Id: linux-api@vger.kernel.org * Mathieu Desnoyers wrote: > On smaller systems, running a test with 200 threads can take a long > time on machines with smaller number of CPUs. > > Detect the number of online cpus at test runtime, and multiply that > by 6 to have 6 rseq threads per cpu preempting each other. > > Signed-off-by: Mathieu Desnoyers > Cc: Shuah Khan > Cc: Thomas Gleixner > Cc: Joel Fernandes > Cc: Peter Zijlstra > Cc: Catalin Marinas > Cc: Dave Watson > Cc: Will Deacon > Cc: Andi Kleen > Cc: linux-kselftest@vger.kernel.org > Cc: "H . Peter Anvin" > Cc: Chris Lameter > Cc: Russell King > Cc: Michael Kerrisk > Cc: "Paul E . McKenney" > Cc: Paul Turner > Cc: Boqun Feng > Cc: Josh Triplett > Cc: Steven Rostedt > Cc: Ben Maurer > Cc: Andy Lutomirski > Cc: Andrew Morton > Cc: Linus Torvalds > --- > tools/testing/selftests/rseq/run_param_test.sh | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/rseq/run_param_test.sh b/tools/testing/selftests/rseq/run_param_test.sh > index 3acd6d75ff9f..e426304fd4a0 100755 > --- a/tools/testing/selftests/rseq/run_param_test.sh > +++ b/tools/testing/selftests/rseq/run_param_test.sh > @@ -1,6 +1,8 @@ > #!/bin/bash > # SPDX-License-Identifier: GPL-2.0+ or MIT > > +NR_CPUS=`grep '^processor' /proc/cpuinfo | wc -l` > + > EXTRA_ARGS=${@} > > OLDIFS="$IFS" > @@ -28,15 +30,16 @@ IFS="$OLDIFS" > > REPS=1000 > SLOW_REPS=100 > +NR_THREADS=$((6*${NR_CPUS})) > > function do_tests() > { > local i=0 > while [ "$i" -lt "${#TEST_LIST[@]}" ]; do > echo "Running test ${TEST_NAME[$i]}" > - ./param_test ${TEST_LIST[$i]} -r ${REPS} ${@} ${EXTRA_ARGS} || exit 1 > + ./param_test ${TEST_LIST[$i]} -r ${REPS} -t ${NR_THREADS} ${@} ${EXTRA_ARGS} || exit 1 > echo "Running compare-twice test ${TEST_NAME[$i]}" > - ./param_test_compare_twice ${TEST_LIST[$i]} -r ${REPS} ${@} ${EXTRA_ARGS} || exit 1 > + ./param_test_compare_twice ${TEST_LIST[$i]} -r ${REPS} -t ${NR_THREADS} ${@} ${EXTRA_ARGS} || exit 1 > let "i++" > done > } BTW., when trying to build the rseq self-tests I get this build failure: dagon:~/tip/tools/testing/selftests/rseq> make gcc -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./ -shared -fPIC rseq.c -lpthread -o /home/mingo/tip/tools/testing/selftests/rseq/librseq.so gcc -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./ basic_test.c -lpthread -lrseq -o /home/mingo/tip/tools/testing/selftests/rseq/basic_test gcc -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./ basic_percpu_ops_test.c -lpthread -lrseq -o /home/mingo/tip/tools/testing/selftests/rseq/basic_percpu_ops_test /usr/bin/ld: /tmp/ccuHTWnZ.o: in function `rseq_cmpeqv_storev': /home/mingo/tip/tools/testing/selftests/rseq/./rseq-x86.h:84: undefined reference to `.L8' /usr/bin/ld: /home/mingo/tip/tools/testing/selftests/rseq/./rseq-x86.h:84: undefined reference to `.L49' /usr/bin/ld: /tmp/ccuHTWnZ.o: in function `rseq_cmpnev_storeoffp_load': /home/mingo/tip/tools/testing/selftests/rseq/./rseq-x86.h:141: undefined reference to `.L57' /usr/bin/ld: /tmp/ccuHTWnZ.o:(__rseq_failure+0x8): undefined reference to `.L8' /usr/bin/ld: /tmp/ccuHTWnZ.o:(__rseq_failure+0x14): undefined reference to `.L49' /usr/bin/ld: /tmp/ccuHTWnZ.o:(__rseq_failure+0x20): undefined reference to `.L55' collect2: error: ld returned 1 exit status make: *** [Makefile:22: /home/mingo/tip/tools/testing/selftests/rseq/basic_percpu_ops_test] Error 1 Is this a known problem, or do I miss something from my build environment perhaps? Vanilla 64-bit Ubuntu 18.10 (Cosmic). Thanks, Ingo