Re: svn commit: r230201 - head/lib/libc/gen

2012-01-20 Thread David Chisnall
On 20 Jan 2012, at 00:46, David Xu wrote: It depends on hardware, if it is a large machine with lots of cpu, a small conflict on dual-core machine can become a large conflict on large machine because it is possible more cpus are now running same code which becomes a bottleneck. On a large

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-20 Thread John Baldwin
On Thursday, January 19, 2012 7:36:33 pm David Xu wrote: On 2012/1/19 23:23, John Baldwin wrote: On Thursday, January 19, 2012 12:57:50 am David Xu wrote: rdtsc() may not work on SMP, so I have updated it to use clock_gettime to get total time.

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-19 Thread John Baldwin
On Thursday, January 19, 2012 12:57:50 am David Xu wrote: rdtsc() may not work on SMP, so I have updated it to use clock_gettime to get total time. http://people.freebsd.org/~davidxu/bench/semaphore2/ http://people.freebsd.org/%7Edavidxu/bench/semaphore2/ Still, lfence is a lot faster

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-19 Thread Bruce Evans
On Thu, 19 Jan 2012, John Baldwin wrote: On Thursday, January 19, 2012 12:57:50 am David Xu wrote: rdtsc() may not work on SMP, so I have updated it to use clock_gettime to get total time. http://people.freebsd.org/~davidxu/bench/semaphore2/

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-19 Thread Bruce Evans
On Fri, 20 Jan 2012, Bruce Evans wrote: ... % + v = *p; \ % + __asm __volatile(lfence ::: memory);\ Style bug (missing spaces around binary operator `:') which becomes a syntax error for C++. Other places in this file use ` : : : '.

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-19 Thread Ed Schouten
Hi David, * David Xu listlog2...@gmail.com, 20120116 08:53: but since atomic.h does not have a full barrier atomic operation interface, I intend to add a rmb() here. In the very nearby future (after I switch SPARC64 and MIPS to libcompiler_rt), it should be possible to safely use C11's

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-19 Thread David Chisnall
On 19 Jan 2012, at 18:09, Ed Schouten wrote: In the very nearby future (after I switch SPARC64 and MIPS to libcompiler_rt), it should be possible to safely use C11's stdatomic.h on all supported architectures. The C11 interface allows any operation to be combined with any type of barrier.

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-19 Thread David Xu
On 2012/1/19 23:23, John Baldwin wrote: On Thursday, January 19, 2012 12:57:50 am David Xu wrote: rdtsc() may not work on SMP, so I have updated it to use clock_gettime to get total time. http://people.freebsd.org/~davidxu/bench/semaphore2/ http://people.freebsd.org/%7Edavidxu/bench/semaphore2/

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-19 Thread David Xu
On 2012/1/20 0:55, Bruce Evans wrote: On Thu, 19 Jan 2012, John Baldwin wrote: On Thursday, January 19, 2012 12:57:50 am David Xu wrote: rdtsc() may not work on SMP, so I have updated it to use clock_gettime to get total time. http://people.freebsd.org/~davidxu/bench/semaphore2/

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-18 Thread David Xu
On 2012/1/18 23:09, John Baldwin wrote: On Tuesday, January 17, 2012 9:09:25 pm David Xu wrote: On 2012/1/17 22:57, John Baldwin wrote: On Monday, January 16, 2012 1:15:14 am David Xu wrote: Author: davidxu Date: Mon Jan 16 06:15:14 2012 New Revision: 230201 URL:

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-18 Thread David Xu
On 2012/1/19 11:24, David Xu wrote: On 2012/1/18 23:09, John Baldwin wrote: On Tuesday, January 17, 2012 9:09:25 pm David Xu wrote: On 2012/1/17 22:57, John Baldwin wrote: On Monday, January 16, 2012 1:15:14 am David Xu wrote: Author: davidxu Date: Mon Jan 16 06:15:14 2012 New Revision:

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-17 Thread John Baldwin
On Monday, January 16, 2012 1:15:14 am David Xu wrote: Author: davidxu Date: Mon Jan 16 06:15:14 2012 New Revision: 230201 URL: http://svn.freebsd.org/changeset/base/230201 Log: Insert read memory barriers. I think using atomic_load_acq() on sem-nwaiters would be clearer as it would

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-17 Thread David Xu
On 2012/1/17 22:57, John Baldwin wrote: On Monday, January 16, 2012 1:15:14 am David Xu wrote: Author: davidxu Date: Mon Jan 16 06:15:14 2012 New Revision: 230201 URL: http://svn.freebsd.org/changeset/base/230201 Log: Insert read memory barriers. I think using atomic_load_acq() on

svn commit: r230201 - head/lib/libc/gen

2012-01-15 Thread David Xu
Author: davidxu Date: Mon Jan 16 06:15:14 2012 New Revision: 230201 URL: http://svn.freebsd.org/changeset/base/230201 Log: Insert read memory barriers. Modified: head/lib/libc/gen/sem.c head/lib/libc/gen/sem_new.c Modified: head/lib/libc/gen/sem.c

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-15 Thread Lawrence Stewart
On 01/16/12 17:15, David Xu wrote: Author: davidxu Date: Mon Jan 16 06:15:14 2012 New Revision: 230201 URL: http://svn.freebsd.org/changeset/base/230201 Log: Insert read memory barriers. Modified: head/lib/libc/gen/sem.c head/lib/libc/gen/sem_new.c Could you please provide a bit

Re: svn commit: r230201 - head/lib/libc/gen

2012-01-15 Thread David Xu
On 2012/1/16 15:39, Lawrence Stewart wrote: On 01/16/12 17:15, David Xu wrote: Author: davidxu Date: Mon Jan 16 06:15:14 2012 New Revision: 230201 URL: http://svn.freebsd.org/changeset/base/230201 Log: Insert read memory barriers. Modified: head/lib/libc/gen/sem.c