[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 3/4] cpu_exec: Add sleeping algorithm
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC PATCH 3/4] cpu_exec: Add sleeping algorithm |
Date: |
Tue, 27 May 2014 17:15:17 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
Il 27/05/2014 16:54, Sebastian Tanase ha scritto:
> if (insns_left > 0) {
> /* Execute remaining instructions. */
> cpu_exec_nocache(env, insns_left, tb);
> + if (icount_align_option) {
> + instr_exec_time = original_low -
> +
> cpu->icount_decr.u16.low;
> + instr_exec_time = instr_exec_time <<
> + icount_time_shift;
> + diff_clk += instr_exec_time;
> + if (diff_clk > VM_CLOCK_ADVANCE) {
> + delay_host();
> + }
> + }
Why doesn't it have to update original_low and original_extra, and
why doesn't it have to take into account original_extra (the new
cpu->icount_extra is zero, but what about the old one)?
> + case 1:
> + case 0:
> + if (icount_align_option) {
> + instr_exec_time = original_extra -
> + cpu->icount_extra +
> + original_low -
> + cpu->icount_decr.u16.low;
> + instr_exec_time = instr_exec_time <<
> + icount_time_shift;
I wonder if tracking cpu->icount_extra + cpu->icount_decr.u16.low
(instead of the two separately) will lead to nicer code overall.
int64_t current_icount = cpu->icount_extra + cpu->icount_decr.u16.low;
diff_clk += (current_icount - old_icount) << icount_time_shift;
old_icount = current_icount;
Paolo
> + diff_clk += instr_exec_time;
> + original_extra = cpu->icount_extra;
> + original_low = cpu->icount_decr.u16.low;
> + }
> + break;
This can go in the "default" label.
> default:
[Qemu-devel] [RFC PATCH 4/4] cpu_exec: Print to console if the guest is late, Sebastian Tanase, 2014/05/27
[Qemu-devel] [RFC PATCH 1/4] icount: Add 'align' and 'icount' options, Sebastian Tanase, 2014/05/27