From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIJt4-00072t-3r for qemu-devel@nongnu.org; Mon, 02 Feb 2015 11:30:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIJsz-000132-Ei for qemu-devel@nongnu.org; Mon, 02 Feb 2015 11:30:10 -0500 Received: from mail-we0-x22b.google.com ([2a00:1450:400c:c03::22b]:41207) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIJsz-000111-4s for qemu-devel@nongnu.org; Mon, 02 Feb 2015 11:30:05 -0500 Received: by mail-we0-f171.google.com with SMTP id k11so37682666wes.2 for ; Mon, 02 Feb 2015 08:30:04 -0800 (PST) Received: from playground.station (net-93-66-105-136.cust.vodafonedsl.it. [93.66.105.136]) by mx.google.com with ESMTPSA id p6sm28588319wjf.39.2015.02.02.08.30.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Feb 2015 08:30:02 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 2 Feb 2015 17:29:57 +0100 Message-Id: <1422894597-15855-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL v2 00/12] RCU, scsi, modules, icount changes for 2015-01-30 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The following changes since commit 83761b9244ad2ed39d3cfabe8a0e901ab906f7bf: Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20150127' into staging (2015-01-27 22:25:56 +0000) are available in the git repository at: git://github.com/bonzini/qemu.git tags/for-upstream for you to fetch changes up to 42b5c7a09801805278e5ac40c0ccaf137981ecb6: configure: Default to enable module build (2015-02-02 16:55:11 +0100) ---------------------------------------------------------------- The important bits here are the first part of RCU and enabling modules by default. They have been tested with Travis for a few days now, and things seem okay. v1->v2 changes are the new qemu-thread patch to fix Mac OS X, and cleaning up warnings. ---------------------------------------------------------------- Fam Zheng (2): scsi: Fix scsi_req_cancel_async for no aiocb req configure: Default to enable module build Jan Kiszka (1): memory: remove assertion on memory_region_destroy Paolo Bonzini (9): qemu-thread: fix qemu_event without futexes rcu: add rcu library rcu: add rcutorture rcu: allow nesting of rcu_read_lock/rcu_read_unlock rcu: add call_rcu memory: protect current_map by RCU memory: avoid ref/unref in memory_region_find cpu-exec: simplify align_clocks cpu-exec: simplify init_delay_params .travis.yml | 2 +- configure | 95 +++++++--- cpu-exec.c | 9 +- cpus.c | 17 -- docs/rcu.txt | 387 +++++++++++++++++++++++++++++++++++++++ hw/9pfs/virtio-9p-synth.c | 1 + hw/scsi/scsi-bus.c | 2 + include/exec/memory.h | 5 + include/qemu/atomic.h | 61 +++++++ include/qemu/queue.h | 13 ++ include/qemu/rcu.h | 147 +++++++++++++++ include/qemu/thread.h | 3 - include/qemu/timer.h | 1 - memory.c | 65 +++---- tests/Makefile | 7 +- tests/rcutorture.c | 451 ++++++++++++++++++++++++++++++++++++++++++++++ util/Makefile.objs | 1 + util/qemu-thread-posix.c | 2 + util/rcu.c | 291 ++++++++++++++++++++++++++++++ 19 files changed, 1465 insertions(+), 95 deletions(-) create mode 100644 docs/rcu.txt create mode 100644 include/qemu/rcu.h create mode 100644 tests/rcutorture.c create mode 100644 util/rcu.c -- 1.8.3.1 diff --git a/configure b/configure index 2c3a444..a9ae57a 100755 --- a/configure +++ b/configure @@ -2733,8 +2733,8 @@ fi glib_pkg_config() { if $pkg_config --atleast-version=$glib_req_ver $1; then - local probe_cflags=$($pkg_config --cflags $1) - local probe_libs=$($pkg_config --libs $1) + local probe_cflags="$($pkg_config --cflags $1)" + local probe_libs="$($pkg_config --libs $1)" CFLAGS="$probe_cflags $CFLAGS" LIBS="$probe_libs $LIBS" libs_qga="$probe_libs $libs_qga" diff --git a/tests/rcutorture.c b/tests/rcutorture.c index 93ec1b3..60a2ccf 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(); printf("n_reads: %lld n_updates: %ld nreaders: %d nupdaters: %d duration: %d\n", @@ -241,7 +241,7 @@ static void *rcu_read_stress_test(void *arg) struct rcu_stress *p; int pc; long long n_reads_local = 0; - volatile int garbage; + volatile int garbage = 0; rcu_register_thread(); @@ -300,10 +300,11 @@ static void *rcu_update_stress_test(void *arg) p->mbtest = 1; atomic_rcu_set(&rcu_stress_current, p); rcu_stress_idx = i; - for (i = 0; i < RCU_STRESS_PIPE_LEN; i++) + for (i = 0; i < RCU_STRESS_PIPE_LEN; i++) { if (i != rcu_stress_idx) { rcu_stress_array[i].pipe_count++; } + } synchronize_rcu(); n_updates++; } @@ -344,7 +345,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 +375,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); diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 41cb23d..50a29d8 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -307,11 +307,13 @@ static inline void futex_wait(QemuEvent *ev, unsigned val) #else static inline void futex_wake(QemuEvent *ev, int n) { + pthread_mutex_lock(&ev->lock); if (n == 1) { pthread_cond_signal(&ev->cond); } else { pthread_cond_broadcast(&ev->cond); } + pthread_mutex_unlock(&ev->lock); } static inline void futex_wait(QemuEvent *ev, unsigned val)