From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLcl0-0003BX-B1 for qemu-devel@nongnu.org; Fri, 08 Jul 2016 16:52:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLckx-0005ve-4X for qemu-devel@nongnu.org; Fri, 08 Jul 2016 16:52:18 -0400 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:37136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLckw-0005vZ-Ta for qemu-devel@nongnu.org; Fri, 08 Jul 2016 16:52:15 -0400 Received: by mail-wm0-x234.google.com with SMTP id k123so24530063wme.0 for ; Fri, 08 Jul 2016 13:52:14 -0700 (PDT) Sender: Paolo Bonzini References: <1467735496-16256-7-git-send-email-alex.bennee@linaro.org> <1467909880-18834-1-git-send-email-sergey.fedorov@linaro.org> <1467909880-18834-4-git-send-email-sergey.fedorov@linaro.org> <71295249.5198305.1467967205882.JavaMail.zimbra@redhat.com> <577F7F7D.4010207@gmail.com> <1711483720.5250530.1467975750519.JavaMail.zimbra@redhat.com> <577F9D69.3050600@gmail.com> <5677f192-7367-bf1a-353f-1b0678b1c8fb@redhat.com> <57800533.2070303@gmail.com> <75bb3f61-0b90-1805-1d21-8e83377e133f@redhat.com> <57800C09.30808@gmail.com> From: Paolo Bonzini Message-ID: <0c04b00b-55d0-46e2-8a21-c364d2939198@redhat.com> Date: Fri, 8 Jul 2016 22:52:11 +0200 MIME-Version: 1.0 In-Reply-To: <57800C09.30808@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] tcg: Avoid bouncing tb_lock between tb_gen_code() and tb_add_jump() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Fedorov Cc: mttcg@greensocs.com, peter maydell , claudio fontana , Sergey Fedorov , patches@linaro.org, jan kiszka , Peter Crosthwaite , mark burton , qemu-devel@nongnu.org, a rigo , cota@braap.org, bobby prani , rth@twiddle.net, =?UTF-8?Q?Alex_Benn=c3=a9e?= , fred konrad On 08/07/2016 22:24, Sergey Fedorov wrote: > I remember, I've just found that we discussed it in this thread: > > http://thread.gmane.org/gmane.comp.emulators.qemu/401723/focus=406852 > > I was thinking of just doing 'tb_jmp_cache' lookup out of the lock, not > tb_find_physical(). Now thanks to QHT, we could do tb_find_physical() > out of the lock, too. This changes things. But in my patch ("tcg: move tb_find_fast outside the tb_lock critical section", which originally was written by Fred---most of my contribution was getting the invalidation right, not the lock-free lookup) tb_find_physical was also done out of the lock. It was then retried inside the lock, if it failed. This is why I needed to fail all concurrent lookups as the first step in the invalidation. Emilio's QHT resulted in a rewrite of tb_find_physical, but the basic concepts are the same. Paolo