From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRPC7-0000ne-7l for qemu-devel@nongnu.org; Mon, 17 Aug 2015 14:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRPC2-00084n-4h for qemu-devel@nongnu.org; Mon, 17 Aug 2015 14:31:39 -0400 Received: from mail-qg0-x22c.google.com ([2607:f8b0:400d:c04::22c]:35546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRPC2-00084Y-1c for qemu-devel@nongnu.org; Mon, 17 Aug 2015 14:31:34 -0400 Received: by qgj62 with SMTP id 62so100259890qgj.2 for ; Mon, 17 Aug 2015 11:31:33 -0700 (PDT) Sender: Richard Henderson References: <1439558129-466-1-git-send-email-pbonzini@redhat.com> <1439558129-466-4-git-send-email-pbonzini@redhat.com> From: Richard Henderson Message-ID: <55D22882.1000200@twiddle.net> Date: Mon, 17 Aug 2015 11:31:30 -0700 MIME-Version: 1.0 In-Reply-To: <1439558129-466-4-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] tcg: signal-free qemu_cpu_kick List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org On 08/14/2015 06:15 AM, Paolo Bonzini wrote: > + atomic_mb_set(¤t_cpu, cpu); ... > + cpu_exit(atomic_rcu_read(¤t_cpu)); Mixing java and rcu style sync to the same data structure? > + * ensure tcg_exit_req is read before exit_request > + * or interrupt_request. > */ > + smp_rmb(); > next_tb = 0; This I don't understand, since we've just read exit_request above, and you're putting the barrier here? > + /* Ensure whatever caused the exit has reached the CPU threads before > + * writing exit_request. > + */ > + smp_wmb(); > + exit_request = 1; > + /* Ignore the CPU argument since all CPUs run in the same thread; > + * preempt the currently running one. The memory barriers ensures > + * that other CPUs will see the request if the current CPU is > + * preempted. > + */ > + smp_wmb(); > + cpu_exit(atomic_rcu_read(¤t_cpu)); ... > + /* Pairs with smp_wmb in qemu_cpu_kick. */ > + atomic_mb_set(&exit_request, 0); > } Bare barriers and java style sync to the same data structure? > cpu->exit_request = 1; > + /* Ensure cpu_exec will see the exit request after TCG has exited. */ > + smp_wmb(); > cpu->tcg_exit_req = 1; > } Likewise. I find this mixing highly confusing. I see no way to prove that it's going to be right for non-x86. r~