From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw8wc-0003lJ-Ux for qemu-devel@nongnu.org; Fri, 29 Apr 2016 09:59:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aw8wQ-0002rS-Tr for qemu-devel@nongnu.org; Fri, 29 Apr 2016 09:58:53 -0400 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:33775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw8wO-0002me-T8 for qemu-devel@nongnu.org; Fri, 29 Apr 2016 09:58:46 -0400 Received: by mail-lf0-x242.google.com with SMTP id p64so19881874lfg.0 for ; Fri, 29 Apr 2016 06:58:30 -0700 (PDT) References: <1461881459-14297-1-git-send-email-sergey.fedorov@linaro.org> <1461881459-14297-7-git-send-email-sergey.fedorov@linaro.org> <87d1p8ed0w.fsf@linaro.org> From: Sergey Fedorov Message-ID: <57236881.9020906@gmail.com> Date: Fri, 29 Apr 2016 16:58:25 +0300 MIME-Version: 1.0 In-Reply-To: <87d1p8ed0w.fsf@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v6 6/6] cpu-exec: Move TB chaining into tb_find_fast() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= , Sergey Fedorov Cc: qemu-devel@nongnu.org, Paolo Bonzini , Peter Crosthwaite , Richard Henderson On 29/04/16 16:54, Alex Bennée wrote: > Sergey Fedorov writes: >> diff --git a/cpu-exec.c b/cpu-exec.c >> index f49a436e1a5a..5f23c0660d6e 100644 >> --- a/cpu-exec.c >> +++ b/cpu-exec.c >> @@ -320,7 +320,9 @@ found: >> return tb; >> } >> >> -static inline TranslationBlock *tb_find_fast(CPUState *cpu) >> +static inline TranslationBlock *tb_find_fast(CPUState *cpu, >> + TranslationBlock **last_tb, >> + int tb_exit) >> { >> CPUArchState *env = (CPUArchState *)cpu->env_ptr; >> TranslationBlock *tb; >> @@ -331,11 +333,24 @@ static inline TranslationBlock *tb_find_fast(CPUState *cpu) >> always be the same before a given translated block >> is executed. */ >> cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); >> + tb_lock(); >> tb = cpu->tb_jmp_cache[tb_jmp_cache_hash_func(pc)]; >> if (unlikely(!tb || tb->pc != pc || tb->cs_base != cs_base || >> tb->flags != flags)) { >> tb = tb_find_slow(cpu, pc, cs_base, flags); >> } >> + if (cpu->tb_flushed) { >> + /* Ensure that no TB jump will be modified as the >> + * translation buffer has been flushed. >> + */ >> + *last_tb = NULL; >> + cpu->tb_flushed = false; >> + } >> + /* See if we can patch the calling TB. */ >> + if (*last_tb && qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { > This should be !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN) Probably, it's mine rebase conflict resolution mistake. Nice catch, thanks! Kind regards, Sergey > >> + tb_add_jump(*last_tb, tb_exit, tb); >> + } >> + tb_unlock(); >> return tb; >> }