On 2015-06-18 10:16, Aurelien Jarno wrote: > On x86, this patch brings a 5% boot time improvement on MIPS. One of the > reason is that the TCG code generator has a good knowledge about which > TCG ops or helpers can trigger an exception, so it can optimize out part > of the instructions saving the CPU state. I guess that the host CPUs have > also evolved over the time, now being superscalar and out-of-order so > that saving the CPU state can be done "in background". Also it's just a > quick and dirty patch, we can probably even do better. > > All of that to say that I am worried for the performances to see more > paths through the retranslation code, especially on MIPS as it seems to > be costly. That said I haven't really look in details at other targets, > nor hosts.
For an i386 guest still on an x86 host, I get a 4% slower boot time by not using retranslation (see patch below). This is not that much compared to the complexity retranslation bring us. diff --git a/target-i386/translate.c b/target-i386/translate.c index 58b1959..de65bba 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -8001,6 +8001,9 @@ static inline void gen_intermediate_code_internal(X86CPU *cpu, gen_tb_start(tb); for(;;) { + gen_update_cc_op(dc); + gen_jmp_im(pc_ptr - dc->cs_base); + if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (bp->pc == pc_ptr && diff --git a/translate-all.c b/translate-all.c index b6b0e1c..3d4c017 100644 --- a/translate-all.c +++ b/translate-all.c @@ -212,6 +212,8 @@ static int cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, int64_t ti; #endif + return -1; + #ifdef CONFIG_PROFILER ti = profile_getclock(); #endif -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurel...@aurel32.net http://www.aurel32.net