From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beQLa-0005rC-03 for qemu-devel@nongnu.org; Mon, 29 Aug 2016 13:27:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1beQLU-0002rS-UC for qemu-devel@nongnu.org; Mon, 29 Aug 2016 13:27:45 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beQLU-0002rN-OR for qemu-devel@nongnu.org; Mon, 29 Aug 2016 13:27:40 -0400 Received: by mail-wm0-f66.google.com with SMTP id q128so10436539wma.1 for ; Mon, 29 Aug 2016 10:27:40 -0700 (PDT) Sender: Paolo Bonzini References: <1470158864-17651-1-git-send-email-alex.bennee@linaro.org> <1470158864-17651-12-git-send-email-alex.bennee@linaro.org> <20160802192242.GB18402@flamenco> <1d086cf1-5492-8645-6b19-aeaf525f6e48@redhat.com> From: Paolo Bonzini Message-ID: Date: Mon, 29 Aug 2016 19:26:36 +0200 MIME-Version: 1.0 In-Reply-To: <1d086cf1-5492-8645-6b19-aeaf525f6e48@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 11/13] cpu-exec-common: Introduce async_safe_run_on_cpu() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" , =?UTF-8?Q?Alex_Benn=c3=a9e?= Cc: mttcg@listserver.greensocs.com, peter.maydell@linaro.org, Sergey Fedorov , Peter Crosthwaite , jan.kiszka@siemens.com, Riku Voipio , claudio.fontana@huawei.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, mark.burton@greensocs.com, serge.fdrv@gmail.com, bobby.prani@gmail.com, fred.konrad@greensocs.com, rth@twiddle.net > The problem with CPUs coming up late is indeed present in this patch, > I'll review your patch on the flight. :) > > synchronize_rcu() is actually relatively cheap with URCU, so I guess > that's fine. An alternative to that could be a pthread_barrier_t, but > it can be added later. > > Another way to fix the issue with a variable number of waiters could be > to wrap safe work with rcu_read_lock and rcu_read_unlock, and put a > synchronize_rcu() at the beginning of the CPU thread function. But it > can be done later too. > > Your patch from a year ago, right now, seems to be the best to me. I'd > like to make it use regular work items instead of the special > cpu->tcg_work_func, but that's pretty much it. Ok, I think I have something. It only uses condition variables when there is a safe work in flight, to enter and leave the function at the right time. It also makes linux-user's start_exclusive/end_exclusive use the same synchronization logic. I'll test it and post; most preliminary patches are straight from this series. Paolo