From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bf2Sx-00054f-2x for qemu-devel@nongnu.org; Wed, 31 Aug 2016 06:09:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bf2Sr-0002Y2-Vs for qemu-devel@nongnu.org; Wed, 31 Aug 2016 06:09:53 -0400 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:36344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bf2Sq-0002Wx-MP for qemu-devel@nongnu.org; Wed, 31 Aug 2016 06:09:49 -0400 Received: by mail-wm0-x22e.google.com with SMTP id c133so25229729wmd.1 for ; Wed, 31 Aug 2016 03:09:47 -0700 (PDT) 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: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: Date: Wed, 31 Aug 2016 11:09:45 +0100 Message-ID: <87zintb66u.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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: Paolo Bonzini Cc: "Emilio G. Cota" , 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 Paolo Bonzini writes: >> 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. Good stuff, I look forward to seeing the patches. I'll see if I can come up with some better stress tests for linux-user in the meantime. > > Paolo -- Alex Bennée