From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKlAZ-0006c3-V2 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:02:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKlAW-0008OS-O1 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:02:19 -0500 Received: from greensocs.com ([193.104.36.180]:33202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKlAW-0008OG-Ep for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:02:16 -0500 Message-ID: <54D885A0.3080609@greensocs.com> Date: Mon, 09 Feb 2015 11:02:08 +0100 From: Frederic Konrad MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] CPU TLB flush with multithread TCG. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , mttcg@listserver.greensocs.com Cc: Peter Maydell , Jan Kiszka , Alexander Graf , Paolo Bonzini Hi everybody, In multithread tlb_flush is broken as CPUA can flush an other CPUB and CPUB can be executing code, and fixing this can be quite hard: * We need to exit the CPU which is flushed. * Makes sure the CPU is stopped. * Then we can flush tlb. The big issues are: * Two threads can be doing a flush at the same time. * Something can restart the CPU during the flush. A better idea I think is that instead of flushing tlb we can put a flag in CPUState such as flush_request and ask the cpu to exit. Then later once the CPU is exited we can flush tlbs if flush_request is set. It will ensure that the CPU won't execute code as it's associated thread will be flushing. Can this work? Thanks, Fred