* [Qemu-devel] [PATCH] cpu-exec: fix cpu_exec_nocache
@ 2014-10-30 13:39 Pavel Dovgalyuk
0 siblings, 0 replies; only message in thread
From: Pavel Dovgalyuk @ 2014-10-30 13:39 UTC (permalink / raw)
To: qemu-devel
Cc: mark.burton, batuzovk, maria.klimushenkova, pavel.dovgaluk,
pbonzini, zealot351, fred.konrad
In icount mode cpu_exec_nocache function is used to execute part of the
existing TB. At the end of cpu_exec_nocache newly created TB is deleted.
Sometimes io_read function needs to recompile current TB and restart TB
lookup and execution. After that tb_find_fast function finds old (bigger)
TB again. This TB cannot be executed (because icount is not big enough)
and cpu_exec_nocache is called again. Such a loop continues over and over.
This patch deletes old TB and avoids finding it in the TB cache.
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
---
cpu-exec.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/cpu-exec.c b/cpu-exec.c
index 3913de0..8830255 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -202,13 +202,18 @@ static void cpu_exec_nocache(CPUArchState *env, int max_cycles,
{
CPUState *cpu = ENV_GET_CPU(env);
TranslationBlock *tb;
+ target_ulong pc = orig_tb->pc;
+ target_ulong cs_base = orig_tb->cs_base;
+ uint64_t flags = orig_tb->flags;
/* Should never happen.
We only end up here when an existing TB is too long. */
if (max_cycles > CF_COUNT_MASK)
max_cycles = CF_COUNT_MASK;
- tb = tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, orig_tb->flags,
+ /* tb_gen_code can flush our orig_tb, invalidate it now */
+ tb_phys_invalidate(orig_tb, -1);
+ tb = tb_gen_code(cpu, pc, cs_base, flags,
max_cycles);
cpu->current_tb = tb;
/* execute the generated code */
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-10-31 15:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-30 13:39 [Qemu-devel] [PATCH] cpu-exec: fix cpu_exec_nocache Pavel Dovgalyuk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).