qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 04/22] tcg: fix corruption of code_time profilin


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH 04/22] tcg: fix corruption of code_time profiling counter upon tb_flush
Date: Wed, 12 Jul 2017 14:09:11 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/09/2017 04:49 AM, Emilio G. Cota wrote:
Whenever there is an overflow in code_gen_buffer (e.g. we run out
of space in it and have to flush it), the code_time profiling counter
ends up with an invalid value (that is, code_time -= profile_getclock(),
without later on getting += profile_getclock() due to the goto).
[...]

Signed-off-by: Emilio G. Cota <address@hidden>

Reviewed-by: Philippe Mathieu-Daudé <address@hidden>

---
  accel/tcg/translate-all.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index a936a5f..72ce445 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -1293,7 +1293,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
  #ifdef CONFIG_PROFILER
      tcg_ctx.tb_count++;
      tcg_ctx.interm_time += profile_getclock() - ti;
-    tcg_ctx.code_time -= profile_getclock();
+    ti = profile_getclock();
  #endif
/* ??? Overflow could be handled better here. In particular, we
@@ -1311,7 +1311,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
      }
#ifdef CONFIG_PROFILER
-    tcg_ctx.code_time += profile_getclock();
+    tcg_ctx.code_time += profile_getclock() - ti;
      tcg_ctx.code_in_len += tb->size;
      tcg_ctx.code_out_len += gen_code_size;
      tcg_ctx.search_out_len += search_size;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]