From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bII3L-000398-VQ for qemu-devel@nongnu.org; Wed, 29 Jun 2016 12:09:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bII3I-0000O0-Fr for qemu-devel@nongnu.org; Wed, 29 Jun 2016 12:09:27 -0400 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:36913) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bII3I-0000N3-8O for qemu-devel@nongnu.org; Wed, 29 Jun 2016 12:09:24 -0400 Received: by mail-wm0-x233.google.com with SMTP id a66so80949168wme.0 for ; Wed, 29 Jun 2016 09:09:24 -0700 (PDT) References: <87h9cfdlcd.fsf@linaro.org> <5773E339.6020702@gmail.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <5773E339.6020702@gmail.com> Date: Wed, 29 Jun 2016 17:09:29 +0100 Message-ID: <87mvm40yfa.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC 7/8] cpu-exec-common: Introduce async_safe_run_on_cpu() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Fedorov Cc: Sergey Fedorov , qemu-devel@nongnu.org, Riku Voipio , Peter Crosthwaite , patches@linaro.org, Paolo Bonzini , Richard Henderson Sergey Fedorov writes: > On 27/06/16 12:36, Alex Bennée wrote: >> Sergey Fedorov writes: >> >>> From: Sergey Fedorov >>> > (snip) >>> diff --git a/cpus.c b/cpus.c >>> index 98f60f6f98f5..bb6bd8615cfc 100644 >>> --- a/cpus.c >>> +++ b/cpus.c >>> @@ -932,6 +932,18 @@ static void qemu_tcg_destroy_vcpu(CPUState *cpu) >>> { >>> } >>> >>> +static void tcg_cpu_exec_start(CPUState *cpu) >>> +{ >>> + tcg_pending_cpus++; >>> +} >>> + >>> +static void tcg_cpu_exec_end(CPUState *cpu) >>> +{ >>> + if (--tcg_pending_cpus) { >>> + signal_cpu_work(); >>> + } >>> +} >> Don't these need to be atomic? > > 'tcg_pending_cpus' is protected by BQL. A quick comment above the function would help then. > >> >>> + >>> static void qemu_wait_io_event_common(CPUState *cpu) >>> { >>> if (cpu->stop) { >>> > (snip) > > Thanks, > Sergey -- Alex Bennée