From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAgHx-0004sb-IK for qemu-devel@nongnu.org; Wed, 08 Jun 2016 12:25:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAgHu-0002lX-4r for qemu-devel@nongnu.org; Wed, 08 Jun 2016 12:25:05 -0400 Received: from mail-io0-x232.google.com ([2607:f8b0:4001:c06::232]:36483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAgHt-0002lQ-Uf for qemu-devel@nongnu.org; Wed, 08 Jun 2016 12:25:02 -0400 Received: by mail-io0-x232.google.com with SMTP id n127so13952419iof.3 for ; Wed, 08 Jun 2016 09:25:01 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <87a8ivhflj.fsf@linaro.org> References: <57583182.3090701@gmail.com> <87a8ivhflj.fsf@linaro.org> From: alvise rigo Date: Wed, 8 Jun 2016 18:24:46 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC 03/10] cpus: Introduce async_wait_run_on_cpu() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QWxleCBCZW5uw6ll?= Cc: Sergey Fedorov , MTTCG Devel , QEMU Developers , Jani Kokkonen , Claudio Fontana , VirtualOpenSystems Technical Team , =?UTF-8?B?S09OUkFEIEZyw6lkw6lyaWM=?= , Paolo Bonzini , Richard Henderson , "Emilio G. Cota" , Peter Maydell I think that async_safe_run_on_cpu() does a different thing: it queries a job to the target vCPU and wants all the other to "observe" the submitted task. However, we will have the certainty that only the target vCPU observed the task, the other might still be running in the guest code. alvise On Wed, Jun 8, 2016 at 5:20 PM, Alex Benn=C3=A9e w= rote: > > Sergey Fedorov writes: > >> On 08/06/16 17:10, alvise rigo wrote: >>> Using run_on_cpu() we might deadlock QEMU if other vCPUs are waiting >>> for the current vCPU. We need to exit from the vCPU loop in order to >>> avoid this. >> >> I see, we could deadlock indeed. Alternatively, we may want fix >> run_on_cpu() to avoid waiting for completion by itself when called from >> CPU loop. > > async_safe_run_on_cpu can't deadlock as all vCPUs are suspended (or > waiting) for the work to complete. The tasks are run in strict order so > if you queued async tasks for other vCPUs first you could ensure > everything is in the state you want it when you finally service the > calling vCPU. > >> >> Kind regards, >> Sergey > > > -- > Alex Benn=C3=A9e