Message ID | 1381222058-16701-8-git-send-email-pbonzini@redhat.com |
---|---|
State | New |
Headers | show |
On 8 Oct 2013, at 09:47, Paolo Bonzini wrote: > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Alex Bligh <alex@alex.org.uk> > --- > cpus.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/cpus.c b/cpus.c > index 01acce2..bc675a4 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -98,17 +98,22 @@ static bool all_cpu_threads_idle(void) > /***********************************************************/ > /* guest cycle counter */ > > +/* Protected by TimersState seqlock */ > + > +/* Compensate for varying guest execution speed. */ > +static int64_t qemu_icount_bias; > +static int64_t vm_clock_warp_start; > /* Conversion factor from emulated instructions to virtual clock ticks. */ > static int icount_time_shift; > /* Arbitrarily pick 1MIPS as the minimum allowable speed. */ > #define MAX_ICOUNT_SHIFT 10 > -/* Compensate for varying guest execution speed. */ > -static int64_t qemu_icount_bias; > + > +/* Only written by TCG thread */ > +static int64_t qemu_icount; > + > static QEMUTimer *icount_rt_timer; > static QEMUTimer *icount_vm_timer; > static QEMUTimer *icount_warp_timer; > -static int64_t vm_clock_warp_start; > -static int64_t qemu_icount; > > typedef struct TimersState { > int64_t cpu_ticks_prev; > @@ -232,6 +237,8 @@ static void icount_adjust(void) > int64_t cur_time; > int64_t cur_icount; > int64_t delta; > + > + /* Protected by TimersState mutex. */ > static int64_t last_delta; > > /* If the VM is not running, then do nothing. */ > -- > 1.8.3.1 > > > >
diff --git a/cpus.c b/cpus.c index 01acce2..bc675a4 100644 --- a/cpus.c +++ b/cpus.c @@ -98,17 +98,22 @@ static bool all_cpu_threads_idle(void) /***********************************************************/ /* guest cycle counter */ +/* Protected by TimersState seqlock */ + +/* Compensate for varying guest execution speed. */ +static int64_t qemu_icount_bias; +static int64_t vm_clock_warp_start; /* Conversion factor from emulated instructions to virtual clock ticks. */ static int icount_time_shift; /* Arbitrarily pick 1MIPS as the minimum allowable speed. */ #define MAX_ICOUNT_SHIFT 10 -/* Compensate for varying guest execution speed. */ -static int64_t qemu_icount_bias; + +/* Only written by TCG thread */ +static int64_t qemu_icount; + static QEMUTimer *icount_rt_timer; static QEMUTimer *icount_vm_timer; static QEMUTimer *icount_warp_timer; -static int64_t vm_clock_warp_start; -static int64_t qemu_icount; typedef struct TimersState { int64_t cpu_ticks_prev; @@ -232,6 +237,8 @@ static void icount_adjust(void) int64_t cur_time; int64_t cur_icount; int64_t delta; + + /* Protected by TimersState mutex. */ static int64_t last_delta; /* If the VM is not running, then do nothing. */
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- cpus.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)