Date: Mon, 16 Jan 2012 15:53:12 +0800 From: David Xu <listlog2011@gmail.com> To: Lawrence Stewart <lstewart@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu <davidxu@freebsd.org> Subject: Re: svn commit: r230201 - head/lib/libc/gen Message-ID: <4F13D768.10307@gmail.com> In-Reply-To: <4F13D43C.2060207@freebsd.org> References: <201201160615.q0G6FE9r019542@svn.freebsd.org> <4F13D43C.2060207@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F13D768.10307>