diff mbox

[PULL,00/11] RCU, scsi, modules, icount changes for 2015-01-30

Message ID 54CF8FFA.8010207@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Feb. 2, 2015, 2:55 p.m. UTC
On 02/02/2015 15:36, Peter Maydell wrote:
> (Strictly speaking "local" isn't POSIX sh, but dash seems to cope
> with it, which is the major non-POSIX shell, and we have a couple
> of instances in configure already. Still, why do we need these
> variables to be local?)

Just for cleanliness; they aren't supposed to be used outside the function.

> Also some clang warnings:
>   CC    tests/rcutorture.o
> /Users/pm215/src/qemu/tests/rcutorture.c:260:13: warning: variable 'garbage' is
>       uninitialized when used here [-Wuninitialized]
>             garbage++;
>             ^~~~~~~
> /Users/pm215/src/qemu/tests/rcutorture.c:244:25: note: initialize the variable
>       'garbage' to silence this warning
>     volatile int garbage;
>                         ^
>                          = 0
> 1 warning generated.

Fixed.

> And the rcutorture test seems to hang on OSX, or at least take way
> longer than anything we put in 'make check' ought to take.

It should only take 2-3 seconds.

Can you try this:

     printf("n_reads: %lld  n_updates: %ld  nreaders: %d  nupdaters: %d
duration: %d\n",
@@ -344,7 +344,7 @@ static void stresstest(int nreaders, int duration)
         create_thread(rcu_fake_update_stress_test);
     }
     goflag = GOFLAG_RUN;
-    sleep(duration);
+    g_usleep(duration * G_USEC_PER_SEC);
     goflag = GOFLAG_STOP;
     wait_all_threads();
     printf("n_reads: %lld  n_updates: %ld  n_mberror: %d\n",
@@ -374,7 +374,7 @@ static void gtest_stress(int nreaders, int duration)
         create_thread(rcu_fake_update_stress_test);
     }
     goflag = GOFLAG_RUN;
-    sleep(duration);
+    g_usleep(duration * G_USEC_PER_SEC);
     goflag = GOFLAG_STOP;
     wait_all_threads();
     g_assert_cmpint(n_mberror, ==, 0);

(though I doubt it matters: tests/fdc-test uses sleep(3) already)
and if it still fails, catch a backtrace of all threads?

Thanks,

Paolo

Comments

Peter Maydell Feb. 2, 2015, 3:03 p.m. UTC | #1
On 2 February 2015 at 14:55, Paolo Bonzini <pbonzini@redhat.com> wrote:
> and if it still fails, catch a backtrace of all threads?

(gdb) thread apply all backtrace

Thread 9 (process 42110):
#0  0x00007fff94a94746 in __psynch_mutexwait ()
#1  0x00007fff968df779 in _pthread_mutex_lock ()
#2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
/Users/pm215/src/qemu/util/qemu-thread-posix.c:77
#3  0x000000010880b247 in synchronize_rcu () at
/Users/pm215/src/qemu/util/rcu.c:128
#4  0x000000010880a105 in rcu_fake_update_stress_test (arg=<value
temporarily unavailable, due to optimizations>) at
/Users/pm215/src/qemu/tests/rcutorture.c:324
#5  0x00007fff968dc899 in _pthread_body ()
#6  0x00007fff968dc72a in _pthread_start ()
#7  0x00007fff968e0fc9 in thread_start ()

Thread 8 (process 42110):
#0  0x00007fff94a94746 in __psynch_mutexwait ()
#1  0x00007fff968df779 in _pthread_mutex_lock ()
#2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
/Users/pm215/src/qemu/util/qemu-thread-posix.c:77
#3  0x000000010880b247 in synchronize_rcu () at
/Users/pm215/src/qemu/util/rcu.c:128
#4  0x000000010880a105 in rcu_fake_update_stress_test (arg=<value
temporarily unavailable, due to optimizations>) at
/Users/pm215/src/qemu/tests/rcutorture.c:324
#5  0x00007fff968dc899 in _pthread_body ()
#6  0x00007fff968dc72a in _pthread_start ()
#7  0x00007fff968e0fc9 in thread_start ()

Thread 7 (process 42110):
#0  0x00007fff94a94746 in __psynch_mutexwait ()
#1  0x00007fff968df779 in _pthread_mutex_lock ()
#2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
/Users/pm215/src/qemu/util/qemu-thread-posix.c:77
#3  0x000000010880b247 in synchronize_rcu () at
/Users/pm215/src/qemu/util/rcu.c:128
#4  0x000000010880a105 in rcu_fake_update_stress_test (arg=<value
temporarily unavailable, due to optimizations>) at
/Users/pm215/src/qemu/tests/rcutorture.c:324
#5  0x00007fff968dc899 in _pthread_body ()
#6  0x00007fff968dc72a in _pthread_start ()
#7  0x00007fff968e0fc9 in thread_start ()

Thread 6 (process 42110):
#0  0x00007fff94a94746 in __psynch_mutexwait ()
#1  0x00007fff968df779 in _pthread_mutex_lock ()
#2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
/Users/pm215/src/qemu/util/qemu-thread-posix.c:77
#3  0x000000010880b247 in synchronize_rcu () at
/Users/pm215/src/qemu/util/rcu.c:128
#4  0x000000010880a105 in rcu_fake_update_stress_test (arg=<value
temporarily unavailable, due to optimizations>) at
/Users/pm215/src/qemu/tests/rcutorture.c:324
#5  0x00007fff968dc899 in _pthread_body ()
#6  0x00007fff968dc72a in _pthread_start ()
#7  0x00007fff968e0fc9 in thread_start ()

Thread 5 (process 42110):
#0  0x00007fff94a94746 in __psynch_mutexwait ()
#1  0x00007fff968df779 in _pthread_mutex_lock ()
#2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
/Users/pm215/src/qemu/util/qemu-thread-posix.c:77
#3  0x000000010880b247 in synchronize_rcu () at
/Users/pm215/src/qemu/util/rcu.c:128
#4  0x000000010880a105 in rcu_fake_update_stress_test (arg=<value
temporarily unavailable, due to optimizations>) at
/Users/pm215/src/qemu/tests/rcutorture.c:324
#5  0x00007fff968dc899 in _pthread_body ()
#6  0x00007fff968dc72a in _pthread_start ()
#7  0x00007fff968e0fc9 in thread_start ()

Thread 4 (process 42110):
#0  0x00007fff94a94716 in __psynch_cvwait ()
#1  0x00007fff968dec3b in _pthread_cond_wait ()
#2  0x000000010880ac68 in futex_wait [inlined] () at
/Users/pm215/src/qemu/util/qemu-thread-posix.c:321
#3  0x000000010880ac68 in qemu_event_wait (ev=0x10880c2b8) at
/Users/pm215/src/qemu/util/qemu-thread-posix.c:401
#4  0x000000010880b288 in wait_for_readers [inlined] () at
/Users/pm215/src/qemu/util/rcu.c:119
#5  0x000000010880b288 in synchronize_rcu () at
/Users/pm215/src/qemu/util/rcu.c:148
#6  0x000000010880a06c in rcu_update_stress_test (arg=<value
temporarily unavailable, due to optimizations>) at
/Users/pm215/src/qemu/tests/rcutorture.c:307
#7  0x00007fff968dc899 in _pthread_body ()
#8  0x00007fff968dc72a in _pthread_start ()
#9  0x00007fff968e0fc9 in thread_start ()

Thread 3 (process 42110):
#0  0x00007fff94a94746 in __psynch_mutexwait ()
#1  0x00007fff968df779 in _pthread_mutex_lock ()
#2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
/Users/pm215/src/qemu/util/qemu-thread-posix.c:77
#3  0x000000010880b247 in synchronize_rcu () at
/Users/pm215/src/qemu/util/rcu.c:128
#4  0x0000000108809e70 in rcu_read_stress_test (arg=<value temporarily
unavailable, due to optimizations>) at
/Users/pm215/src/qemu/tests/rcutorture.c:271
#5  0x00007fff968dc899 in _pthread_body ()
#6  0x00007fff968dc72a in _pthread_start ()
#7  0x00007fff968e0fc9 in thread_start ()

Thread 2 (process 42110):
#0  0x00007fff94a94716 in __psynch_cvwait ()
#1  0x00007fff968dec3b in _pthread_cond_wait ()
#2  0x000000010880ac68 in futex_wait [inlined] () at
/Users/pm215/src/qemu/util/qemu-thread-posix.c:321
#3  0x000000010880ac68 in qemu_event_wait (ev=0x10880c9e0) at
/Users/pm215/src/qemu/util/qemu-thread-posix.c:401
#4  0x000000010880b6b0 in call_rcu_thread (opaque=<value temporarily
unavailable, due to optimizations>) at
/Users/pm215/src/qemu/util/rcu.c:231
#5  0x00007fff968dc899 in _pthread_body ()
#6  0x00007fff968dc72a in _pthread_start ()
#7  0x00007fff968e0fc9 in thread_start ()

Thread 1 (process 42110):
#0  0x00007fff94a94a3a in __semwait_signal ()
#1  0x00007fff968e07f3 in pthread_join ()
#2  0x000000010880af73 in qemu_thread_join (thread=<value temporarily
unavailable, due to optimizations>) at
/Users/pm215/src/qemu/util/qemu-thread-posix.c:506
#3  0x000000010880a2c8 in wait_all_threads [inlined] () at
/Users/pm215/src/qemu/tests/rcutorture.c:105
#4  0x000000010880a2c8 in gtest_stress (nreaders=<value temporarily
unavailable, due to optimizations>, duration=<value temporarily
unavailable, due to optimizations>) at
/Users/pm215/src/qemu/tests/rcutorture.c:379
#5  0x000000010886291d in g_test_run_suite_internal ()
#6  0x0000000108862ae1 in g_test_run_suite_internal ()
#7  0x0000000108862ae1 in g_test_run_suite_internal ()
#8  0x0000000108862198 in g_test_run_suite ()
#9  0x000000010880961e in main (argc=1, argv=0x7fff573f78c8) at
/Users/pm215/src/qemu/tests/rcutorture.c:430

-- PMM
Paolo Bonzini Feb. 2, 2015, 3:27 p.m. UTC | #2
On 02/02/2015 16:03, Peter Maydell wrote:
> On 2 February 2015 at 14:55, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> and if it still fails, catch a backtrace of all threads?

Whoa, this has been broken for a long, long time.

Paolo

> (gdb) thread apply all backtrace
> 
> Thread 9 (process 42110):
> #0  0x00007fff94a94746 in __psynch_mutexwait ()
> #1  0x00007fff968df779 in _pthread_mutex_lock ()
> #2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
> /Users/pm215/src/qemu/util/qemu-thread-posix.c:77
> #3  0x000000010880b247 in synchronize_rcu () at
> /Users/pm215/src/qemu/util/rcu.c:128
> #4  0x000000010880a105 in rcu_fake_update_stress_test (arg=<value
> temporarily unavailable, due to optimizations>) at
> /Users/pm215/src/qemu/tests/rcutorture.c:324
> #5  0x00007fff968dc899 in _pthread_body ()
> #6  0x00007fff968dc72a in _pthread_start ()
> #7  0x00007fff968e0fc9 in thread_start ()
> 
> Thread 8 (process 42110):
> #0  0x00007fff94a94746 in __psynch_mutexwait ()
> #1  0x00007fff968df779 in _pthread_mutex_lock ()
> #2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
> /Users/pm215/src/qemu/util/qemu-thread-posix.c:77
> #3  0x000000010880b247 in synchronize_rcu () at
> /Users/pm215/src/qemu/util/rcu.c:128
> #4  0x000000010880a105 in rcu_fake_update_stress_test (arg=<value
> temporarily unavailable, due to optimizations>) at
> /Users/pm215/src/qemu/tests/rcutorture.c:324
> #5  0x00007fff968dc899 in _pthread_body ()
> #6  0x00007fff968dc72a in _pthread_start ()
> #7  0x00007fff968e0fc9 in thread_start ()
> 
> Thread 7 (process 42110):
> #0  0x00007fff94a94746 in __psynch_mutexwait ()
> #1  0x00007fff968df779 in _pthread_mutex_lock ()
> #2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
> /Users/pm215/src/qemu/util/qemu-thread-posix.c:77
> #3  0x000000010880b247 in synchronize_rcu () at
> /Users/pm215/src/qemu/util/rcu.c:128
> #4  0x000000010880a105 in rcu_fake_update_stress_test (arg=<value
> temporarily unavailable, due to optimizations>) at
> /Users/pm215/src/qemu/tests/rcutorture.c:324
> #5  0x00007fff968dc899 in _pthread_body ()
> #6  0x00007fff968dc72a in _pthread_start ()
> #7  0x00007fff968e0fc9 in thread_start ()
> 
> Thread 6 (process 42110):
> #0  0x00007fff94a94746 in __psynch_mutexwait ()
> #1  0x00007fff968df779 in _pthread_mutex_lock ()
> #2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
> /Users/pm215/src/qemu/util/qemu-thread-posix.c:77
> #3  0x000000010880b247 in synchronize_rcu () at
> /Users/pm215/src/qemu/util/rcu.c:128
> #4  0x000000010880a105 in rcu_fake_update_stress_test (arg=<value
> temporarily unavailable, due to optimizations>) at
> /Users/pm215/src/qemu/tests/rcutorture.c:324
> #5  0x00007fff968dc899 in _pthread_body ()
> #6  0x00007fff968dc72a in _pthread_start ()
> #7  0x00007fff968e0fc9 in thread_start ()
> 
> Thread 5 (process 42110):
> #0  0x00007fff94a94746 in __psynch_mutexwait ()
> #1  0x00007fff968df779 in _pthread_mutex_lock ()
> #2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
> /Users/pm215/src/qemu/util/qemu-thread-posix.c:77
> #3  0x000000010880b247 in synchronize_rcu () at
> /Users/pm215/src/qemu/util/rcu.c:128
> #4  0x000000010880a105 in rcu_fake_update_stress_test (arg=<value
> temporarily unavailable, due to optimizations>) at
> /Users/pm215/src/qemu/tests/rcutorture.c:324
> #5  0x00007fff968dc899 in _pthread_body ()
> #6  0x00007fff968dc72a in _pthread_start ()
> #7  0x00007fff968e0fc9 in thread_start ()
> 
> Thread 4 (process 42110):
> #0  0x00007fff94a94716 in __psynch_cvwait ()
> #1  0x00007fff968dec3b in _pthread_cond_wait ()
> #2  0x000000010880ac68 in futex_wait [inlined] () at
> /Users/pm215/src/qemu/util/qemu-thread-posix.c:321
> #3  0x000000010880ac68 in qemu_event_wait (ev=0x10880c2b8) at
> /Users/pm215/src/qemu/util/qemu-thread-posix.c:401
> #4  0x000000010880b288 in wait_for_readers [inlined] () at
> /Users/pm215/src/qemu/util/rcu.c:119
> #5  0x000000010880b288 in synchronize_rcu () at
> /Users/pm215/src/qemu/util/rcu.c:148
> #6  0x000000010880a06c in rcu_update_stress_test (arg=<value
> temporarily unavailable, due to optimizations>) at
> /Users/pm215/src/qemu/tests/rcutorture.c:307
> #7  0x00007fff968dc899 in _pthread_body ()
> #8  0x00007fff968dc72a in _pthread_start ()
> #9  0x00007fff968e0fc9 in thread_start ()
> 
> Thread 3 (process 42110):
> #0  0x00007fff94a94746 in __psynch_mutexwait ()
> #1  0x00007fff968df779 in _pthread_mutex_lock ()
> #2  0x000000010880a589 in qemu_mutex_lock (mutex=0x10880c990) at
> /Users/pm215/src/qemu/util/qemu-thread-posix.c:77
> #3  0x000000010880b247 in synchronize_rcu () at
> /Users/pm215/src/qemu/util/rcu.c:128
> #4  0x0000000108809e70 in rcu_read_stress_test (arg=<value temporarily
> unavailable, due to optimizations>) at
> /Users/pm215/src/qemu/tests/rcutorture.c:271
> #5  0x00007fff968dc899 in _pthread_body ()
> #6  0x00007fff968dc72a in _pthread_start ()
> #7  0x00007fff968e0fc9 in thread_start ()
> 
> Thread 2 (process 42110):
> #0  0x00007fff94a94716 in __psynch_cvwait ()
> #1  0x00007fff968dec3b in _pthread_cond_wait ()
> #2  0x000000010880ac68 in futex_wait [inlined] () at
> /Users/pm215/src/qemu/util/qemu-thread-posix.c:321
> #3  0x000000010880ac68 in qemu_event_wait (ev=0x10880c9e0) at
> /Users/pm215/src/qemu/util/qemu-thread-posix.c:401
> #4  0x000000010880b6b0 in call_rcu_thread (opaque=<value temporarily
> unavailable, due to optimizations>) at
> /Users/pm215/src/qemu/util/rcu.c:231
> #5  0x00007fff968dc899 in _pthread_body ()
> #6  0x00007fff968dc72a in _pthread_start ()
> #7  0x00007fff968e0fc9 in thread_start ()
> 
> Thread 1 (process 42110):
> #0  0x00007fff94a94a3a in __semwait_signal ()
> #1  0x00007fff968e07f3 in pthread_join ()
> #2  0x000000010880af73 in qemu_thread_join (thread=<value temporarily
> unavailable, due to optimizations>) at
> /Users/pm215/src/qemu/util/qemu-thread-posix.c:506
> #3  0x000000010880a2c8 in wait_all_threads [inlined] () at
> /Users/pm215/src/qemu/tests/rcutorture.c:105
> #4  0x000000010880a2c8 in gtest_stress (nreaders=<value temporarily
> unavailable, due to optimizations>, duration=<value temporarily
> unavailable, due to optimizations>) at
> /Users/pm215/src/qemu/tests/rcutorture.c:379
> #5  0x000000010886291d in g_test_run_suite_internal ()
> #6  0x0000000108862ae1 in g_test_run_suite_internal ()
> #7  0x0000000108862ae1 in g_test_run_suite_internal ()
> #8  0x0000000108862198 in g_test_run_suite ()
> #9  0x000000010880961e in main (argc=1, argv=0x7fff573f78c8) at
> /Users/pm215/src/qemu/tests/rcutorture.c:430
> 
> -- PMM
>
diff mbox

Patch

diff --git a/tests/rcutorture.c b/tests/rcutorture.c
index e94caf2..b17b4a6 100644
--- a/tests/rcutorture.c
+++ b/tests/rcutorture.c
@@ -168,7 +168,7 @@  static void perftestrun(int nthreads, int duration,
int nreaders, int nupdaters)
         g_usleep(1000);
     }
     goflag = GOFLAG_RUN;
-    sleep(duration);
+    g_usleep(duration * G_USEC_PER_SEC);
     goflag = GOFLAG_STOP;
     wait_all_threads();