Received: from eggs.gnu.org ([2001:4830:134:3::10]:41002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM1xq-0008Dj-Hf for qemu-devel@nongnu.org; Thu, 12 Feb 2015 17:10:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YM1xn-0005uv-0K for qemu-devel@nongnu.org; Thu, 12 Feb 2015 17:10:26 -0500 Received: from roura.ac.upc.es ([147.83.33.10]:52971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM1xm-0005ue-LS for qemu-devel@nongnu.org; Thu, 12 Feb 2015 17:10:22 -0500 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <31B94C07-29A9-4595-95ED-FA860B527BD8@suse.de> <54DCC8FF.7000609@suse.de> Date: Thu, 12 Feb 2015 23:10:18 +0100 In-Reply-To: (Mark Burton's message of "Thu, 12 Feb 2015 17:02:44 +0100") Message-ID: <87oaoy233p.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Help on TLB Flush List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark Burton Cc: mttcg@greensocs.com, Peter Maydell , Alexander Graf , qemu-devel Mark Burton writes: >> On 12 Feb 2015, at 16:38, Alexander Graf wrote: >>=20 >>=20 >>=20 >> On 12.02.15 15:58, Peter Maydell wrote: >>> On 12 February 2015 at 14:45, Alexander Graf wrote: >>>> almost nobody except x86 does global flushes >>>=20 >>> All ARM TLB maintenance operations have both "this CPU only" >>> and "all TLBs in the Inner Shareable domain" [that's ARM-speak >>> for "every CPU core in the cluster"] variants (the latter >>> being the TLB *IS operations). Looking at Linux's >>> arch/arm64/mm/tlb.S and arch/arm64/include/asm/tlbflush.h >>> most of the operations defined there use the IS variants. >>=20 >> Wow, did anyone benchmark this? I know that PPC switched away from >> global flushes and instead tracks the CPUs a task was running on to >> limit the scope of CPUs that need to flush. > Doesn=E2=80=99t that mean you have to signal a specific CPU to cause it t= o flush itself=E2=80=A6. Isn=E2=80=99t that in itself expensive? Do you hav= e to organise some sort of atomicity yourself around that too? Yup. AFAIR, Linux in x86-64 queues a request to a per-CPU request list, and= uses IPIs to signal these types of operations to the target CPU: http://lxr.free-electrons.com/source/kernel/smp.c?v=3D2.6.32#L386 Waiting for completion is implemented on top by incrementing some counter f= rom each CPU, and waiting for it to have the correct final value. If something were implemented on these lines, it could be used as a generic cross-CPU event messaging infrastructure (plus some interrupt bit in the CPU structure that TCG would check to break away from guest code; I believe something similar is already being used - icount? -). PS: To be honest, I still don't know which TLBs we're talking about here, a= nd which cases trigger these TLB flush operations. Cheers, Lluis --=20 "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth