From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBiZc-0006Aa-GJ for qemu-devel@nongnu.org; Thu, 15 Jan 2015 06:26:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBiZZ-0001Zk-3p for qemu-devel@nongnu.org; Thu, 15 Jan 2015 06:26:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38744) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBiZY-0001Za-Te for qemu-devel@nongnu.org; Thu, 15 Jan 2015 06:26:45 -0500 Message-ID: <54B7A3E8.4000300@redhat.com> Date: Thu, 15 Jan 2015 12:26:32 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <54B7958D.2040108@greensocs.com> <54B7A0B6.60903@redhat.com> <54B7A124.3020300@suse.de> In-Reply-To: <54B7A124.3020300@suse.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] global_mutex and multithread. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf , Frederic Konrad , mttcg@greensocs.com, qemu-devel Cc: Peter Maydell On 15/01/2015 12:14, Alexander Graf wrote: >> > >> > Once you have >1 VCPU thread you'll need the RCU work that I am slowly >> > polishing and sending out. That's because one device can change the >> > memory map, and that will cause a tlb_flush for all CPUs in tcg_commit, >> > and that's not thread-safe. > You'll have a similar problem for tb_flush() if you use a single tb > cache. Just introduce a big hammer function for now that IPIs all the > other threads, waits until they halted, do the atomic instruction (like > change the memory map or flush the tb cache), then let them continue. For the memory map I played with just using cpu_interrupt instead of waiting for the halt of the other CPUs. That's safe for 1 VCPU thread, but not for >1 thread. Perhaps we can exit the other CPUs with a signal and cpu_resume_from_signal. Paolo