From owner-svn-src-all@FreeBSD.ORG Mon Jan 16 07:53:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDC37106564A; Mon, 16 Jan 2012 07:53:16 +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 908EC8FC0C; Mon, 16 Jan 2012 07:53:16 +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 q0G7rCsv076250; Mon, 16 Jan 2012 07:53:13 GMT (envelope-from listlog2011@gmail.com) Message-ID: <4F13D768.10307@gmail.com> Date: Mon, 16 Jan 2012 15:53:12 +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: Lawrence Stewart References: <201201160615.q0G6FE9r019542@svn.freebsd.org> <4F13D43C.2060207@freebsd.org> In-Reply-To: <4F13D43C.2060207@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, David Xu Subject: Re: svn commit: r230201 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@freebsd.org List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2012 07:53:17 -0000 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 >> head/lib/libc/gen/sem_new.c > > Could you please provide a bit more information about why these are > necessary and why they weren't there before (or how you figured out > that there was a problem without them)? I learn a lot by reading > commit mail, but only when the log message and any added code comments > explain the "what" *and* the "why". > > Cheers, > Lawrence > I know this is rather obscure and diffcult to understand, the problem is here we have two variables m, n, and two threads A, B. the A wants to set m, than looks n, while B is in reverse order, it should be in strict order, but since atomic.h does not have a full barrier atomic operation interface, I intend to add a rmb() here. though X86 may not need this, but other arches may not work in this way. Regards, David Xu