From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alwzB-0002nO-CD for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:11:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alwz8-0000Q3-5z for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:11:29 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:38533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alwz7-0000Pm-V0 for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:11:26 -0400 Received: by mail-wm0-x22b.google.com with SMTP id 20so18658260wmh.1 for ; Fri, 01 Apr 2016 04:11:25 -0700 (PDT) References: <56FC0818.10002@linaro.org> <56FC174A.6070906@redhat.com> <56FD22A5.10501@gmail.com> <87wpoig44r.fsf@linaro.org> <56FD2EFB.3060302@gmail.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <56FD2EFB.3060302@gmail.com> Date: Fri, 01 Apr 2016 12:11:28 +0100 Message-ID: <87shz5fusf.fsf@linaro.org> MIME-Version: 1.0 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: Sergey Fedorov Cc: Paolo Bonzini , Peter Crosthwaite , QEMU Developers , Sergey Fedorov , Richard Henderson 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. -- Alex Bennée