"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "softmmu/icount.c" between
qemu-6.0.0-rc1.tar.xz and qemu-6.0.0-rc2.tar.xz

About: QEMU is a generic machine/processor emulator and virtualizer. Release candidate.

icount.c  (qemu-6.0.0-rc1.tar.xz):icount.c  (qemu-6.0.0-rc2.tar.xz)
skipping to change at line 179 skipping to change at line 179
* the IO wait loop. * the IO wait loop.
*/ */
#define ICOUNT_WOBBLE (NANOSECONDS_PER_SECOND / 10) #define ICOUNT_WOBBLE (NANOSECONDS_PER_SECOND / 10)
static void icount_adjust(void) static void icount_adjust(void)
{ {
int64_t cur_time; int64_t cur_time;
int64_t cur_icount; int64_t cur_icount;
int64_t delta; int64_t delta;
/* Protected by TimersState mutex. */
static int64_t last_delta;
/* If the VM is not running, then do nothing. */ /* If the VM is not running, then do nothing. */
if (!runstate_is_running()) { if (!runstate_is_running()) {
return; return;
} }
seqlock_write_lock(&timers_state.vm_clock_seqlock, seqlock_write_lock(&timers_state.vm_clock_seqlock,
&timers_state.vm_clock_lock); &timers_state.vm_clock_lock);
cur_time = REPLAY_CLOCK_LOCKED(REPLAY_CLOCK_VIRTUAL_RT, cur_time = REPLAY_CLOCK_LOCKED(REPLAY_CLOCK_VIRTUAL_RT,
cpu_get_clock_locked()); cpu_get_clock_locked());
cur_icount = icount_get_locked(); cur_icount = icount_get_locked();
delta = cur_icount - cur_time; delta = cur_icount - cur_time;
/* FIXME: This is a very crude algorithm, somewhat prone to oscillation. */ /* FIXME: This is a very crude algorithm, somewhat prone to oscillation. */
if (delta > 0 if (delta > 0
&& last_delta + ICOUNT_WOBBLE < delta * 2 && timers_state.last_delta + ICOUNT_WOBBLE < delta * 2
&& timers_state.icount_time_shift > 0) { && timers_state.icount_time_shift > 0) {
/* The guest is getting too far ahead. Slow time down. */ /* The guest is getting too far ahead. Slow time down. */
qatomic_set(&timers_state.icount_time_shift, qatomic_set(&timers_state.icount_time_shift,
timers_state.icount_time_shift - 1); timers_state.icount_time_shift - 1);
} }
if (delta < 0 if (delta < 0
&& last_delta - ICOUNT_WOBBLE > delta * 2 && timers_state.last_delta - ICOUNT_WOBBLE > delta * 2
&& timers_state.icount_time_shift < MAX_ICOUNT_SHIFT) { && timers_state.icount_time_shift < MAX_ICOUNT_SHIFT) {
/* The guest is getting too far behind. Speed time up. */ /* The guest is getting too far behind. Speed time up. */
qatomic_set(&timers_state.icount_time_shift, qatomic_set(&timers_state.icount_time_shift,
timers_state.icount_time_shift + 1); timers_state.icount_time_shift + 1);
} }
last_delta = delta; timers_state.last_delta = delta;
qatomic_set_i64(&timers_state.qemu_icount_bias, qatomic_set_i64(&timers_state.qemu_icount_bias,
cur_icount - (timers_state.qemu_icount cur_icount - (timers_state.qemu_icount
<< timers_state.icount_time_shift)); << timers_state.icount_time_shift));
seqlock_write_unlock(&timers_state.vm_clock_seqlock, seqlock_write_unlock(&timers_state.vm_clock_seqlock,
&timers_state.vm_clock_lock); &timers_state.vm_clock_lock);
} }
static void icount_adjust_rt(void *opaque) static void icount_adjust_rt(void *opaque)
{ {
timer_mod(timers_state.icount_rt_timer, timer_mod(timers_state.icount_rt_timer,
 End of changes. 4 change blocks. 
6 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)