From owner-svn-src-head@FreeBSD.ORG Fri Jan 20 00:36:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D2F8106564A; Fri, 20 Jan 2012 00:36:36 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id ECEF58FC1A; Fri, 20 Jan 2012 00:36:35 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q0K0aXcr037274; Fri, 20 Jan 2012 00:36:34 GMT (envelope-from listlog2011@gmail.com) Message-ID: <4F18B711.9000406@gmail.com> Date: Fri, 20 Jan 2012 08:36:33 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: John Baldwin References: <201201160615.q0G6FE9r019542@svn.freebsd.org> <4F178CDC.3030807@gmail.com> <4F17B0DE.3060008@gmail.com> <201201191023.28426.jhb@freebsd.org> In-Reply-To: <201201191023.28426.jhb@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, davidxu@freebsd.org Subject: Re: svn commit: r230201 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jan 2012 00:36:36 -0000 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/ >> >> >> Still, lfence is a lot faster than atomic lock. > http://www.freebsd.org/~jhb/patches/amd64_fence.patch > > This the patch I've had for quite a while. Can you retest with this? You'll > probably have to install the updated header in /usr/include as well. > The lines in atomic_load_acq() seem not what I want: + v = *p; \ + __asm __volatile("lfence" ::: "memory"); \ I think they should be swapped ? + __asm __volatile("lfence" ::: "memory"); \ + v = *p; \ What I need in the semaphore code is read can not pass write in such a special case.