Hello community, here is the log from the commit of package userspace-rcu for openSUSE:Factory checked in at 2014-12-03 22:48:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/userspace-rcu (Old) and /work/SRC/openSUSE:Factory/.userspace-rcu.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "userspace-rcu" Changes: -------- --- /work/SRC/openSUSE:Factory/userspace-rcu/userspace-rcu.changes 2014-03-28 16:28:37.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.userspace-rcu.new/userspace-rcu.changes 2014-12-03 22:49:23.000000000 +0100 @@ -1,0 +2,18 @@ +Mon Nov 24 15:56:46 UTC 2014 - mq@suse.cz + +- updated to 0.8.6: + * Fix: silence gcc -Wextra warning + * compiler: use __GNUC__ instead of the undefined __GNUC_MAJOR__ + * Fix: lfstack reversed empty/non-empty return value + * lfstack: fix: add missing __cds_lfs_init + * Fix: preserve example files' timestamps when copying + * rculfhash: remove duplicated code + * rculfhash: handle pthread_create failures + * rculfhash: fall back to single-threaded resize on calloc failure + * x86: drop extra semi-colon in caa_cpu_relax + * Fix: Use after free in rcu_barrier() + * Fix: rcu_barrier(): uninitialized futex field + * call_rcu threads should clear their PAUSED flag when they unpause + * Fix: bring back dummy rcu_bp_exit symbol + +------------------------------------------------------------------- Old: ---- userspace-rcu-0.8.4.tar.bz2 userspace-rcu-0.8.4.tar.bz2.asc New: ---- userspace-rcu-0.8.6.tar.bz2 userspace-rcu-0.8.6.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ userspace-rcu.spec ++++++ --- /var/tmp/diff_new_pack.uuUfzg/_old 2014-12-03 22:49:24.000000000 +0100 +++ /var/tmp/diff_new_pack.uuUfzg/_new 2014-12-03 22:49:24.000000000 +0100 @@ -19,7 +19,7 @@ Name: userspace-rcu -Version: 0.8.4 +Version: 0.8.6 Release: 0 %define soname 2 Summary: Userspace Read-Copy-Update Library ++++++ userspace-rcu-0.8.4.tar.bz2 -> userspace-rcu-0.8.6.tar.bz2 ++++++ ++++ 5138 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/userspace-rcu-0.8.4/ChangeLog new/userspace-rcu-0.8.6/ChangeLog --- old/userspace-rcu-0.8.4/ChangeLog 2014-03-08 14:46:23.000000000 +0100 +++ new/userspace-rcu-0.8.6/ChangeLog 2014-11-04 17:04:15.000000000 +0100 @@ -1,3 +1,20 @@ +2014-11-04 Userspace RCU 0.8.6 + * Fix: silence gcc -Wextra warning + * compiler: use __GNUC__ instead of the undefined __GNUC_MAJOR__ + * Fix: lfstack reversed empty/non-empty return value + * lfstack: fix: add missing __cds_lfs_init + +2014-10-21 Userspace RCU 0.8.5 + * Fix: preserve example files' timestamps when copying + * rculfhash: remove duplicated code + * rculfhash: handle pthread_create failures + * rculfhash: fall back to single-threaded resize on calloc failure + * x86: drop extra semi-colon in caa_cpu_relax + * Fix: Use after free in rcu_barrier() + * Fix: rcu_barrier(): uninitialized futex field + * call_rcu threads should clear their PAUSED flag when they unpause + * Fix: bring back dummy rcu_bp_exit symbol + 2014-03-08 Userspace RCU 0.8.4 * Fix: move wait loop increment before first conditional block diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/userspace-rcu-0.8.4/configure.ac new/userspace-rcu-0.8.6/configure.ac --- old/userspace-rcu-0.8.4/configure.ac 2014-03-08 14:46:23.000000000 +0100 +++ new/userspace-rcu-0.8.6/configure.ac 2014-11-04 17:04:28.000000000 +0100 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. -AC_INIT([userspace-rcu],[0.8.4],[mathieu dot desnoyers at efficios dot com]) +AC_INIT([userspace-rcu],[0.8.6],[mathieu dot desnoyers at efficios dot com]) # Following the numbering scheme proposed by libtool for the library version # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.h... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/userspace-rcu-0.8.4/doc/examples/Makefile.am new/userspace-rcu-0.8.6/doc/examples/Makefile.am --- old/userspace-rcu-0.8.4/doc/examples/Makefile.am 2014-03-08 14:46:23.000000000 +0100 +++ new/userspace-rcu-0.8.6/doc/examples/Makefile.am 2014-10-27 17:42:46.000000000 +0100 @@ -122,10 +122,10 @@ # Copies are for VPATH build support. all-local: @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ - cp -fR $(srcdir)/dist-files $(builddir); \ - cp -f $(srcdir)/Makefile.examples.template $(builddir); \ + cp -pfR $(srcdir)/dist-files $(builddir); \ + cp -pf $(srcdir)/Makefile.examples.template $(builddir); \ for subdir in $(SUBDIRS_PROXY); do \ - cp -fR $(srcdir)/$$subdir $(builddir); \ + cp -pfR $(srcdir)/$$subdir $(builddir); \ done; \ fi; \ if [ x"$(shell echo "$(top_srcdir)" | grep "^/" | wc -l)" = x"1" ]; then \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/userspace-rcu-0.8.4/rculfhash.c new/userspace-rcu-0.8.6/rculfhash.c --- old/userspace-rcu-0.8.4/rculfhash.c 2014-03-08 14:46:23.000000000 +0100 +++ new/userspace-rcu-0.8.6/rculfhash.c 2014-10-27 17:42:46.000000000 +0100 @@ -1171,11 +1171,15 @@ void (*fct)(struct cds_lfht *ht, unsigned long i, unsigned long start, unsigned long len)) { - unsigned long partition_len; + unsigned long partition_len, start = 0; struct partition_resize_work *work; int thread, ret; unsigned long nr_threads; + assert(nr_cpus_mask != -1); + if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD) + goto fallback; + /* * Note: nr_cpus_mask + 1 is always power of 2. * We spawn just the number of threads we need to satisfy the minimum @@ -1189,7 +1193,10 @@ } partition_len = len >> cds_lfht_get_count_order_ulong(nr_threads); work = calloc(nr_threads, sizeof(*work)); - assert(work); + if (!work) { + dbg_printf("error allocating for resize, single-threading\n"); + goto fallback; + } for (thread = 0; thread < nr_threads; thread++) { work[thread].ht = ht; work[thread].i = i; @@ -1198,6 +1205,17 @@ work[thread].fct = fct; ret = pthread_create(&(work[thread].thread_id), ht->resize_attr, partition_resize_thread, &work[thread]); + if (ret == EAGAIN) { + /* + * Out of resources: wait and join the threads + * we've created, then handle leftovers. + */ + dbg_printf("error spawning for resize, single-threading\n"); + start = work[thread].start; + len -= start; + nr_threads = thread; + break; + } assert(!ret); } for (thread = 0; thread < nr_threads; thread++) { @@ -1205,6 +1223,18 @@ assert(!ret); } free(work); + + /* + * A pthread_create failure above will either lead in us having + * no threads to join or starting at a non-zero offset, + * fallback to single thread processing of leftovers. + */ + if (start == 0 && nr_threads > 0) + return; +fallback: + ht->flavor->thread_online(); + fct(ht, i, start, len); + ht->flavor->thread_offline(); } /* @@ -1242,13 +1272,6 @@ void init_table_populate(struct cds_lfht *ht, unsigned long i, unsigned long len) { - assert(nr_cpus_mask != -1); - if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD) { - ht->flavor->thread_online(); - init_table_populate_partition(ht, i, 0, len); - ht->flavor->thread_offline(); - return; - } partition_resize_helper(ht, i, len, init_table_populate_partition); } @@ -1341,14 +1364,6 @@ static void remove_table(struct cds_lfht *ht, unsigned long i, unsigned long len) { - - assert(nr_cpus_mask != -1); - if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD) { - ht->flavor->thread_online(); - remove_table_partition(ht, i, 0, len); - ht->flavor->thread_offline(); - return; - } partition_resize_helper(ht, i, len, remove_table_partition); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/userspace-rcu-0.8.4/urcu/arch/x86.h new/userspace-rcu-0.8.6/urcu/arch/x86.h --- old/userspace-rcu-0.8.4/urcu/arch/x86.h 2014-03-08 14:41:22.000000000 +0100 +++ new/userspace-rcu-0.8.6/urcu/arch/x86.h 2014-11-04 17:02:31.000000000 +0100 @@ -60,7 +60,7 @@ #define cmm_wmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)"::: "memory") #endif -#define caa_cpu_relax() __asm__ __volatile__ ("rep; nop" : : : "memory"); +#define caa_cpu_relax() __asm__ __volatile__ ("rep; nop" : : : "memory") #define rdtscll(val) \ do { \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/userspace-rcu-0.8.4/urcu/compiler.h new/userspace-rcu-0.8.6/urcu/compiler.h --- old/userspace-rcu-0.8.4/urcu/compiler.h 2014-03-08 14:46:23.000000000 +0100 +++ new/userspace-rcu-0.8.6/urcu/compiler.h 2014-11-04 17:02:11.000000000 +0100 @@ -89,16 +89,15 @@ #define caa_is_signed_type(type) ((type) -1 < (type) 0) /* - * Sign-extend to long if needed, and output type is unsigned long. + * Cast to unsigned long, sign-extending if @v is signed. + * Note: casting to a larger type or to same type size keeps the sign of + * the expression being cast (see C99 6.3.1.3). */ -#define caa_cast_long_keep_sign(v) \ - (caa_is_signed_type(__typeof__(v)) ? \ - (unsigned long) (long) (v) : \ - (unsigned long) (v)) +#define caa_cast_long_keep_sign(v) ((unsigned long) (v)) #if defined (__GNUC__) \ - && ((__GNUC_MAJOR__ == 4) && (__GNUC_MINOR__ >= 5) \ - || __GNUC_MAJOR__ >= 5) + && ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) \ + || __GNUC__ >= 5) #define CDS_DEPRECATED(msg) \ __attribute__((deprecated(msg))) #else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/userspace-rcu-0.8.4/urcu/lfstack.h new/userspace-rcu-0.8.6/urcu/lfstack.h --- old/userspace-rcu-0.8.4/urcu/lfstack.h 2014-03-08 14:46:23.000000000 +0100 +++ new/userspace-rcu-0.8.6/urcu/lfstack.h 2014-11-04 17:02:31.000000000 +0100 @@ -81,6 +81,7 @@ #define cds_lfs_node_init _cds_lfs_node_init #define cds_lfs_init _cds_lfs_init +#define __cds_lfs_init ___cds_lfs_init #define cds_lfs_empty _cds_lfs_empty #define cds_lfs_push _cds_lfs_push diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/userspace-rcu-0.8.4/urcu/static/lfstack.h new/userspace-rcu-0.8.6/urcu/static/lfstack.h --- old/userspace-rcu-0.8.4/urcu/static/lfstack.h 2014-03-08 14:46:23.000000000 +0100 +++ new/userspace-rcu-0.8.6/urcu/static/lfstack.h 2014-11-04 17:02:31.000000000 +0100 @@ -148,7 +148,7 @@ if (old_head == head) break; } - return ___cds_lfs_empty_head(head); + return !___cds_lfs_empty_head(head); } /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/userspace-rcu-0.8.4/urcu-bp.c new/userspace-rcu-0.8.6/urcu-bp.c --- old/userspace-rcu-0.8.4/urcu-bp.c 2014-03-08 14:46:23.000000000 +0100 +++ new/userspace-rcu-0.8.6/urcu-bp.c 2014-11-04 17:02:31.000000000 +0100 @@ -97,7 +97,7 @@ static void __attribute__((constructor)) rcu_bp_init(void); static -void __attribute__((destructor)) rcu_bp_exit(void); +void __attribute__((destructor)) _rcu_bp_exit(void); static pthread_mutex_t rcu_gp_lock = PTHREAD_MUTEX_INITIALIZER; @@ -519,7 +519,7 @@ ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL); if (ret) abort(); - rcu_bp_exit(); + _rcu_bp_exit(); } /* @@ -549,7 +549,7 @@ } static -void rcu_bp_exit(void) +void _rcu_bp_exit(void) { mutex_lock(&init_lock); if (!--rcu_bp_refcount) { @@ -569,6 +569,15 @@ } /* + * Keep ABI compability within stable versions. This has never been + * exposed through a header, but needs to stay in the .so until the + * soname is bumped. + */ +void rcu_bp_exit(void) +{ +} + +/* * Holding the rcu_gp_lock across fork will make sure we fork() don't race with * a concurrent thread executing with this same lock held. This ensures that the * registry is in a coherent state in the child. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/userspace-rcu-0.8.4/urcu-call-rcu-impl.h new/userspace-rcu-0.8.6/urcu-call-rcu-impl.h --- old/userspace-rcu-0.8.4/urcu-call-rcu-impl.h 2014-03-08 14:46:23.000000000 +0100 +++ new/userspace-rcu-0.8.6/urcu-call-rcu-impl.h 2014-10-27 17:42:46.000000000 +0100 @@ -42,6 +42,7 @@ #include "urcu/list.h" #include "urcu/futex.h" #include "urcu/tls-compat.h" +#include "urcu/ref.h" #include "urcu-die.h" /* Data structure that identifies a call_rcu thread. */ @@ -67,6 +68,7 @@ struct call_rcu_completion { int barrier_count; int32_t futex; + struct urcu_ref ref; }; struct call_rcu_completion_work { @@ -308,6 +310,8 @@ uatomic_or(&crdp->flags, URCU_CALL_RCU_PAUSED); while ((uatomic_read(&crdp->flags) & URCU_CALL_RCU_PAUSE) != 0) poll(NULL, 0, 1); + uatomic_and(&crdp->flags, ~URCU_CALL_RCU_PAUSED); + cmm_smp_mb__after_uatomic_and(); rcu_register_thread(); } @@ -767,6 +771,15 @@ } static +void free_completion(struct urcu_ref *ref) +{ + struct call_rcu_completion *completion; + + completion = caa_container_of(ref, struct call_rcu_completion, ref); + free(completion); +} + +static void _rcu_barrier_complete(struct rcu_head *head) { struct call_rcu_completion_work *work; @@ -774,8 +787,9 @@ work = caa_container_of(head, struct call_rcu_completion_work, head); completion = work->completion; - uatomic_dec(&completion->barrier_count); - call_rcu_completion_wake_up(completion); + if (!uatomic_sub_return(&completion->barrier_count, 1)) + call_rcu_completion_wake_up(completion); + urcu_ref_put(&completion->ref, free_completion); free(work); } @@ -785,7 +799,7 @@ void rcu_barrier(void) { struct call_rcu_data *crdp; - struct call_rcu_completion completion; + struct call_rcu_completion *completion; int count = 0; int was_online; @@ -807,11 +821,17 @@ goto online; } + completion = calloc(sizeof(*completion), 1); + if (!completion) + urcu_die(errno); + call_rcu_lock(&call_rcu_mutex); cds_list_for_each_entry(crdp, &call_rcu_data_list, list) count++; - completion.barrier_count = count; + /* Referenced by rcu_barrier() and each call_rcu thread. */ + urcu_ref_set(&completion->ref, count + 1); + completion->barrier_count = count; cds_list_for_each_entry(crdp, &call_rcu_data_list, list) { struct call_rcu_completion_work *work; @@ -819,20 +839,23 @@ work = calloc(sizeof(*work), 1); if (!work) urcu_die(errno); - work->completion = &completion; + work->completion = completion; _call_rcu(&work->head, _rcu_barrier_complete, crdp); } call_rcu_unlock(&call_rcu_mutex); /* Wait for them */ for (;;) { - uatomic_dec(&completion.futex); + uatomic_dec(&completion->futex); /* Decrement futex before reading barrier_count */ cmm_smp_mb(); - if (!uatomic_read(&completion.barrier_count)) + if (!uatomic_read(&completion->barrier_count)) break; - call_rcu_completion_wait(&completion); + call_rcu_completion_wait(completion); } + + urcu_ref_put(&completion->ref, free_completion); + online: if (was_online) rcu_thread_online(); @@ -872,6 +895,10 @@ cds_list_for_each_entry(crdp, &call_rcu_data_list, list) uatomic_and(&crdp->flags, ~URCU_CALL_RCU_PAUSE); + cds_list_for_each_entry(crdp, &call_rcu_data_list, list) { + while ((uatomic_read(&crdp->flags) & URCU_CALL_RCU_PAUSED) != 0) + poll(NULL, 0, 1); + } call_rcu_unlock(&call_rcu_mutex); } -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org