diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-10-07 17:18:15 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-10-17 17:31:00 +0200 |
commit | a3270e19ccf05603dfaf09e1f18510f7c93095e0 (patch) | |
tree | bb08116f3d61f62b3efe3ed64c76cd9fc15f78bf /cpus.c | |
parent | ce78d18ced118b03e821135e702ba1d513c8b2a7 (diff) | |
download | qemu-a3270e19ccf05603dfaf09e1f18510f7c93095e0.tar.gz qemu-a3270e19ccf05603dfaf09e1f18510f7c93095e0.tar.bz2 qemu-a3270e19ccf05603dfaf09e1f18510f7c93095e0.zip |
icount: document (future) locking rules for icount
Reviewed-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r-- | cpus.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -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. */ @@ -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. */ |