From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVBAG-0000tB-Oq for qemu-devel@nongnu.org; Fri, 28 Aug 2015 00:21:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZVBAD-0002CW-ME for qemu-devel@nongnu.org; Fri, 28 Aug 2015 00:21:20 -0400 Received: from mail-qg0-x232.google.com ([2607:f8b0:400d:c04::232]:33716) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVBAD-0002CQ-HZ for qemu-devel@nongnu.org; Fri, 28 Aug 2015 00:21:17 -0400 Received: by qgeh99 with SMTP id h99so25208213qge.0 for ; Thu, 27 Aug 2015 21:21:17 -0700 (PDT) Sender: Richard Henderson References: <1440548265-4755-1-git-send-email-pbonzini@redhat.com> From: Richard Henderson Message-ID: <55DFE1BA.9050306@twiddle.net> Date: Thu, 27 Aug 2015 21:21:14 -0700 MIME-Version: 1.0 In-Reply-To: <1440548265-4755-1-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 0/9] 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: mttcg@greensocs.com, cota@braap.org On 08/25/2015 05:17 PM, Paolo Bonzini wrote: > This version of the signal-free qemu_cpu_kick patches is, ehm, much > better. Variable are accessed either with Java-style volatiles or > protected by memory barriers, and the cleanups go further by removing > qemu/tls.h and C volatiles. > > The logic is relatively simple. The I/O thread does (letters in > parentheses indicates the synchronizes-with edges): > > run_on_cpu or similar > ... > seq_cst write 1 to exit_request (C) > seq_cst read tcg_current_cpu to cpu (B) > if not NULL > write 1 to cpu->exit_request > release barrier (A) > write 1 to cpu->tcg_exit_req > > The CPU thread does either this: > > (in generated code) read cpu->tcg_exit_req > acquire barrier (A) > read cpu->exit_request > exit from cpu_exec > seq_cst write 0 to exit_request > ... > flush_queued_work or similar > > or this: > > seq_cst write to tcg_current_cpu (B) > seq_cst read from exit_request (C) > exit from cpu_exec > seq_cst write 0 to exit_request > ... > flush_queued_work or similar > > The non-TLS tcg_current_cpu will go away with multi-threaded TCG. > > Paolo > > Paolo Bonzini (9): > i8257: rewrite DMA_schedule to avoid hooking into the CPU loop > i8257: remove cpu_request_exit irq > tcg: introduce tcg_current_cpu > remove qemu/tls.h > tcg: assign cpu->current_tb in a simpler place > tcg: synchronize cpu->exit_request and cpu->tcg_exit_req accesses > tcg: synchronize exit_request and tcg_current_cpu accesses > use qemu_cpu_kick instead of cpu_exit or qemu_cpu_kick_thread > tcg: signal-free qemu_cpu_kick Reviewed-by: Richard Henderson r~