From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmkFC-0004To-Iy for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:19:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmkF9-0006hR-3b for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:19:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmkF8-0006hK-Tm for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:19:31 -0400 References: <1474289459-15242-1-git-send-email-pbonzini@redhat.com> <1474289459-15242-16-git-send-email-pbonzini@redhat.com> <20160921160559.GA13385@flamenco> From: Paolo Bonzini Message-ID: <30d082bc-663c-d267-a844-e03c961da043@redhat.com> Date: Wed, 21 Sep 2016 18:19:26 +0200 MIME-Version: 1.0 In-Reply-To: <20160921160559.GA13385@flamenco> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" Cc: qemu-devel@nongnu.org, serge.fdrv@gmail.com, alex.bennee@linaro.org, sergey.fedorov@linaro.org On 21/09/2016 18:05, Emilio G. Cota wrote: >> > + tb_lock(); >> > + >> > + /* If it's already been done on request of another CPU, >> > + * just retry. >> > + */ >> > + if (atomic_read(&tcg_ctx.tb_ctx.tb_flush_count) != tb_flush_req) { >> > + goto done; > tb_flush_count is always accessed with tb_lock held, right? If so, I don't > see a reason to access it with atomic_read/set. tb_flush accesses it outside tb_lock. Technically this one you're quoting need not use atomic_read, but others need to. >> + cpu_fprintf(f, "TB flush count %d\n", >> + atomic_read(&tcg_ctx.tb_ctx.tb_flush_count)); > > s/%d/%u/ would be more appropriate given the type change. Ok. Paolo