From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alxBF-00014T-65 for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:24:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alxBA-0003ES-6D for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:23:57 -0400 Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]:35040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alxB9-0003EO-Ug for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:23:52 -0400 Received: by mail-lf0-x22e.google.com with SMTP id k79so79543946lfb.2 for ; Fri, 01 Apr 2016 04:23:51 -0700 (PDT) References: <56FC0818.10002@linaro.org> <56FC174A.6070906@redhat.com> <56FD22A5.10501@gmail.com> <87wpoig44r.fsf@linaro.org> <56FD2EFB.3060302@gmail.com> <87shz5fusf.fsf@linaro.org> From: Sergey Fedorov Message-ID: <56FE5A45.70509@gmail.com> Date: Fri, 1 Apr 2016 14:23:49 +0300 MIME-Version: 1.0 In-Reply-To: <87shz5fusf.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 01/04/16 14:11, Alex Bennée wrote: > Sergey Fedorov writes: > >> 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? > Do you mean tcg_gen_goto_tb? > > AFAIUI all blocks end with goto_tb post-ambles but they should only > directly jump to another TB if they are in the same page. Thanks, I see the checks. Regards, Sergey