From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aldFR-0000JG-Pb for qemu-devel@nongnu.org; Thu, 31 Mar 2016 10:07:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aldFO-0000bQ-HE for qemu-devel@nongnu.org; Thu, 31 Mar 2016 10:06:57 -0400 Received: from mail-lb0-x230.google.com ([2a00:1450:4010:c04::230]:34386) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aldFO-0000aF-8p for qemu-devel@nongnu.org; Thu, 31 Mar 2016 10:06:54 -0400 Received: by mail-lb0-x230.google.com with SMTP id vo2so53305472lbb.1 for ; Thu, 31 Mar 2016 07:06:54 -0700 (PDT) References: <56FC0818.10002@linaro.org> <56FC174A.6070906@redhat.com> <56FD22A5.10501@gmail.com> <87wpoig44r.fsf@linaro.org> From: Sergey Fedorov Message-ID: <56FD2EFB.3060302@gmail.com> Date: Thu, 31 Mar 2016 17:06:51 +0300 MIME-Version: 1.0 In-Reply-To: <87wpoig44r.fsf@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] tcg: reworking tb_invalidated_flag List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= Cc: Paolo Bonzini , Peter Crosthwaite , QEMU Developers , Sergey Fedorov , Richard Henderson On 31/03/16 16:37, Alex Bennée wrote: > Sergey Fedorov writes: >> Looks like no matter which approach we use, it's ultimately necessary to >> ensure all CPUs have exited from translated code before the translation >> buffer may be safely flushed. > One approach would be to have multiple translation contexts with their > own buffers and then you can safely flush TBs if no vCPUs are currently > executing in those regions. But I suspect that is a much more complex > future optimisation. Yes, this is much more complex and its performance impact should be investigated. > Having said that is it safe to flush TBs from a given page if we know > no vCPUs are currently executing in that page? As the execution loop has > to exit the chained TBs as we cross page boundaries we could just keep > account of which vCPUs are currently in which page. It should be safe to invalidate a TB while some other CPU is executing its translated code. But it should be guaranteed that no CPU execute any old TB after tb_flush() since we're going to start reusing those TBs. I see how TB cannot be patched if it spans two pages, is there any on when TCG goto_tb can be generated? Kind regards, Sergey