Message ID | 20170403124524.10824-7-alex.bennee@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | MTTCG and record/replay fixes for rc3 | expand |
On 04/03/2017 09:45 AM, Alex Bennée wrote: > The lifetime of current_cpu is now the lifetime of the vCPU thread. > However get_icount_raw() can apply a fudge factor if called while code > is running to take into account the current executed instruction > count. > > To ensure this is always the case we also check cpu->running. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > cpus.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/cpus.c b/cpus.c > index 4e48b9c4ad..18b1746770 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -229,7 +229,7 @@ int64_t cpu_get_icount_raw(void) > CPUState *cpu = current_cpu; > > icount = timers_state.qemu_icount; > - if (cpu) { > + if (cpu && cpu->running) { > if (!cpu->can_do_io) { > fprintf(stderr, "Bad icount read\n"); > exit(1); >
On 04/03/2017 05:45 AM, Alex Bennée wrote: > The lifetime of current_cpu is now the lifetime of the vCPU thread. > However get_icount_raw() can apply a fudge factor if called while code > is running to take into account the current executed instruction > count. > > To ensure this is always the case we also check cpu->running. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > --- > cpus.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson <rth@twiddle.net> r~
diff --git a/cpus.c b/cpus.c index 4e48b9c4ad..18b1746770 100644 --- a/cpus.c +++ b/cpus.c @@ -229,7 +229,7 @@ int64_t cpu_get_icount_raw(void) CPUState *cpu = current_cpu; icount = timers_state.qemu_icount; - if (cpu) { + if (cpu && cpu->running) { if (!cpu->can_do_io) { fprintf(stderr, "Bad icount read\n"); exit(1);
The lifetime of current_cpu is now the lifetime of the vCPU thread. However get_icount_raw() can apply a fudge factor if called while code is running to take into account the current executed instruction count. To ensure this is always the case we also check cpu->running. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> --- cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0