From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMZz9-0003bD-TB for qemu-devel@nongnu.org; Mon, 11 Jul 2016 08:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMZz6-000248-Na for qemu-devel@nongnu.org; Mon, 11 Jul 2016 08:06:51 -0400 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:36297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMZz5-00023z-EN for qemu-devel@nongnu.org; Mon, 11 Jul 2016 08:06:48 -0400 Received: by mail-wm0-x233.google.com with SMTP id f126so86880136wma.1 for ; Mon, 11 Jul 2016 05:06:47 -0700 (PDT) References: <1467839703-11733-1-git-send-email-sergey.fedorov@linaro.org> <1467839703-11733-5-git-send-email-sergey.fedorov@linaro.org> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1467839703-11733-5-git-send-email-sergey.fedorov@linaro.org> Date: Mon, 11 Jul 2016 13:06:46 +0100 Message-ID: <87oa649y5l.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC v2 04/11] cpus: Wrap mutex used to protect CPU work List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Fedorov Cc: qemu-devel@nongnu.org, MTTCG Devel , KONRAD =?utf-8?B?RnLDqWTDqXJpYw==?= , Alvise Rigo , "Emilio G. Cota" , Paolo Bonzini , Richard Henderson , Peter Maydell , Sergey Fedorov , Peter Crosthwaite Sergey Fedorov writes: > From: Sergey Fedorov > > This will be useful to enable CPU work on user mode emulation. > > Signed-off-by: Sergey Fedorov > Signed-off-by: Sergey Fedorov Reviewed-by: Alex Bennée > --- > cpus.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/cpus.c b/cpus.c > index 04687c85bcd4..f80ed2aeefdd 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -910,6 +910,11 @@ void qemu_init_cpu_loop(void) > qemu_thread_get_self(&io_thread); > } > > +static QemuMutex *qemu_get_cpu_work_mutex(void) > +{ > + return &qemu_global_mutex; > +} > + > static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) > { > qemu_mutex_lock(&cpu->work_mutex); > @@ -943,7 +948,7 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, void *data) > while (!atomic_mb_read(&wi.done)) { > CPUState *self_cpu = current_cpu; > > - qemu_cond_wait(&qemu_work_cond, &qemu_global_mutex); > + qemu_cond_wait(&qemu_work_cond, qemu_get_cpu_work_mutex()); > current_cpu = self_cpu; > } > } -- Alex Bennée