On 5 April 2018 at 18:07, Paolo Bonzini <pbonz...@redhat.com> wrote: > On 05/04/2018 18:01, Peter Maydell wrote: >> * however, if the guest reprograms the clock during the tcg_cpu_exec() >> run, we don't do anything to cause us to stop earlier > > Anything that does this from the vCPU thread should be between > gen_icount_start and gen_icount_end. (In fact, it's the entire reason > why cpu_io_recompile exists).
Yes, and this does cause us to do a cpu_io_recompile, which rebuilds the TB and does a longjmp. However: (1) that only takes us out to cpu_exec(), which will then just go ahead and execute the next TB, whereas the recalculation of deadlines happens at the next level out in tcg_cpu_exec() (2) the io_recompile happens *before* the guest writes to the timer register that reprograms the deadline, so even if we recomputed deadlines after this longjmp they wouldn't be correct thanks -- PMM