From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b32eJ-0006JM-OC for qemu-devel@nongnu.org; Wed, 18 May 2016 10:40:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b32eD-0006Ft-PW for qemu-devel@nongnu.org; Wed, 18 May 2016 10:40:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b32eD-0006Fn-Jh for qemu-devel@nongnu.org; Wed, 18 May 2016 10:40:29 -0400 References: <1463196873-17737-1-git-send-email-cota@braap.org> <1463196873-17737-8-git-send-email-cota@braap.org> <573B5134.8060104@gmail.com> <20160517193842.GB30174@flamenco> <573B80AD.50503@gmail.com> <20160517231809.GA17517@flamenco> <573C7536.7080104@gmail.com> <3c729264-24c0-e3f4-2cdd-62afb47f80e1@redhat.com> <573C77CB.1010508@gmail.com> From: Paolo Bonzini Message-ID: <1f6310c5-3773-66c5-7f8b-e2f06beb12f8@redhat.com> Date: Wed, 18 May 2016 16:40:16 +0200 MIME-Version: 1.0 In-Reply-To: <573C77CB.1010508@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 07/18] qemu-thread: add simple test-and-set spinlock List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Fedorov , "Emilio G. Cota" Cc: QEMU Developers , MTTCG Devel , =?UTF-8?Q?Alex_Benn=c3=a9e?= , Peter Crosthwaite , Richard Henderson On 18/05/2016 16:10, Sergey Fedorov wrote: > On 18/05/16 17:05, Paolo Bonzini wrote: >> this: >> >> if (atomic_read(&x) != 1) { >> atomic_set(&x, 1); >> } >> >> couldn't become an unconditional >> >> atomic_set(&x, 1); > > Sorry, I can't figure out why it couldn't... Because atomics cannot create new unconditional writes (and neither can volatile). Thanks, paolo