Il 22/07/2014 16:02, Sebastian Tanase ha scritto:
> Yes, QEMU_CLOCK_VIRTUAL counts up from qemu_clock_get_ns(QEMU_CLOCK_REALTIME)
> on ARM (I have only tested with the versatilepb and vexpress boards).
That's a bug to fix indeed, then---it should count up from 0 without
icount, and icount shouldn't affect this. Thanks for investigating it.
> Supposing the patch that changes vm_clock_warp_start from 0 to -1 is accepted,
... which shouldn't be a problem,... :)
> I could use the information in timers_state.cpu_clock_offset instead of
> recalculating
> the offset. Besides, given that I only need this particular field from the
> whole
> structure, I think I don't have to make timers_state public; I could add a
> function
> in cpus.c, for example:
>
> int64_t cpu_get_clock_offset(void)
> {
> int64_t ti;
> unsigned start;
>
> do {
> start = seqlock_read_begin(&timers_state.vm_clock_seqlock);
> ti = -timers_state.cpu_clock_offset;
> } while (seqlock_read_retry(&timers_state.vm_clock_seqlock, start));
>
> return ti;
> }
>
> that will return the cpu_clock_offset field.
Indeed what I was proposing is a bit more sloppy. If you do that, you
have to make the function a bit more general:
ti = timers_state.cpu_clock_offset;
if (!timers_state.cpu_ticks_enabled) {
ti -= get_clock();
}
...
return -ti;
even though in cpus.c you'll only be using it when cpu_ticks_enabled is
true. See cpu_enable_ticks() and cpu_disable_ticks().
Paolo