From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMaum-0004ks-4e for qemu-devel@nongnu.org; Mon, 11 Jul 2016 09:06:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMauc-0004ng-Oa for qemu-devel@nongnu.org; Mon, 11 Jul 2016 09:06:18 -0400 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:32987) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMauc-0004na-GY for qemu-devel@nongnu.org; Mon, 11 Jul 2016 09:06:14 -0400 Received: by mail-lf0-x234.google.com with SMTP id f6so72500777lfg.0 for ; Mon, 11 Jul 2016 06:06:14 -0700 (PDT) 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> <0c04b00b-55d0-46e2-8a21-c364d2939198@redhat.com> From: Sergey Fedorov Message-ID: <578399C1.6090108@gmail.com> Date: Mon, 11 Jul 2016 16:06:09 +0300 MIME-Version: 1.0 In-Reply-To: <0c04b00b-55d0-46e2-8a21-c364d2939198@redhat.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: Paolo Bonzini 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/16 23:52, Paolo Bonzini wrote: > > 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. That could work, I think, if we re-check under tb_lock whether the TB is still valid before adding a direct jump to it. Kind regards, Sergey