From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLO2w-0007BW-00 for qemu-devel@nongnu.org; Tue, 10 Feb 2015 22:33:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLO2s-000667-RH for qemu-devel@nongnu.org; Tue, 10 Feb 2015 22:33:01 -0500 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:60698 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLO2s-00065x-Lg for qemu-devel@nongnu.org; Tue, 10 Feb 2015 22:32:58 -0500 References: <54D885A0.3080609@greensocs.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <54D885A0.3080609@greensocs.com> Date: Wed, 11 Feb 2015 03:33:22 +0000 Message-ID: <87pp9hrukd.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] CPU TLB flush with multithread TCG. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Frederic Konrad Cc: mttcg@listserver.greensocs.com, Peter Maydell , Jan Kiszka , Alexander Graf , qemu-devel , Paolo Bonzini Frederic Konrad writes: > 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? Does this imply deferring the work? Surely if we don't flush when instructed things could break down very quickly? > > Thanks, > Fred -- Alex Bennée