From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAfHS-0005JV-4s for qemu-devel@nongnu.org; Wed, 08 Jun 2016 11:20:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAfHM-00025A-Mt for qemu-devel@nongnu.org; Wed, 08 Jun 2016 11:20:29 -0400 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:38861) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAfHM-000252-FQ for qemu-devel@nongnu.org; Wed, 08 Jun 2016 11:20:24 -0400 Received: by mail-wm0-x22c.google.com with SMTP id m124so22004710wme.1 for ; Wed, 08 Jun 2016 08:20:24 -0700 (PDT) From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <57583182.3090701@gmail.com> Date: Wed, 08 Jun 2016 16:20:40 +0100 Message-ID: <87a8ivhflj.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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: Sergey Fedorov Cc: alvise rigo , MTTCG Devel , QEMU Developers , Jani Kokkonen , Claudio Fontana , VirtualOpenSystems Technical Team , KONRAD =?utf-8?B?RnLDqWTDqXJpYw==?= , Paolo Bonzini , Richard Henderson , "Emilio G. Cota" , Peter Maydell 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ée