Skip to content

Commit

Permalink
icount: document (future) locking rules for icount
Browse files Browse the repository at this point in the history
Reviewed-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
bonzini committed Oct 17, 2013
1 parent ce78d18 commit a3270e1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cpus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/* Protected by BQL. */
Expand Down Expand Up @@ -235,6 +240,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. */
Expand Down

0 comments on commit a3270e1

Please sign in to comment.