[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-4.2 10/14] util/qemu-timer: refactor deadlin
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH for-4.2 10/14] util/qemu-timer: refactor deadline calculation for external timers |
Date: |
Wed, 24 Jul 2019 16:28:35 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 24/07/19 10:44, Pavel Dovgalyuk wrote:
> -int64_t qemu_clock_deadline_ns_all(QEMUClockType type)
> +int64_t virtual_clock_deadline_ns(void)
> {
> int64_t deadline = -1;
> + int64_t delta;
> + int64_t expire_time;
> + QEMUTimer *ts;
> QEMUTimerList *timer_list;
> - QEMUClock *clock = qemu_clock_ptr(type);
> + QEMUClock *clock = qemu_clock_ptr(QEMU_CLOCK_VIRTUAL);
> +
> + if (!clock->enabled) {
> + return -1;
> + }
> +
> QLIST_FOREACH(timer_list, &clock->timerlists, list) {
> - deadline = qemu_soonest_timeout(deadline,
> - timerlist_deadline_ns(timer_list));
> + qemu_mutex_lock(&timer_list->active_timers_lock);
> + ts = timer_list->active_timers;
> + /* Skip all external timers */
> + while (ts && (ts->attributes & QEMU_TIMER_ATTR_EXTERNAL)) {
> + ts = ts->next;
> + }
> + if (!ts) {
> + qemu_mutex_unlock(&timer_list->active_timers_lock);
> + continue;
> + }
> + expire_time = ts->expire_time;
> + qemu_mutex_unlock(&timer_list->active_timers_lock);
> +
> + delta = expire_time - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
> + if (delta <= 0) {
> + delta = 0;
> + }
> + deadline = qemu_soonest_timeout(deadline, delta);
> }
> return deadline;
> }
>
Why would this change be exclusive to QEMU_CLOCK_VIRTUAL? I don't think
it's useful to remove the argument. Otherwise, the patch makes sense.
Paolo
- [Qemu-devel] [PATCH for-4.2 01/14] replay: add missing fix for internal function, (continued)
- [Qemu-devel] [PATCH for-4.2 01/14] replay: add missing fix for internal function, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 02/14] block: implement bdrv_snapshot_goto for blkreplay, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 03/14] replay: disable default snapshot for record/replay, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 04/14] replay: update docs for record/replay with block devices, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 05/14] replay: don't drain/flush bdrv queue while RR is working, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 06/14] replay: finish record/replay before closing the disks, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 07/14] replay: provide an accessor for rr filename, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 08/14] replay: add BH oneshot event for block layer, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 09/14] replay: document development rules, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 10/14] util/qemu-timer: refactor deadline calculation for external timers, Pavel Dovgalyuk, 2019/07/24
- Re: [Qemu-devel] [PATCH for-4.2 10/14] util/qemu-timer: refactor deadline calculation for external timers,
Paolo Bonzini <=
- [Qemu-devel] [PATCH for-4.2 11/14] replay: fix replay shutdown, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 12/14] replay: refine replay-time module, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 13/14] replay: rename step-related variables and functions, Pavel Dovgalyuk, 2019/07/24
- [Qemu-devel] [PATCH for-4.2 14/14] icount: clean up cpu_can_io before jumping to the next block, Pavel Dovgalyuk, 2019/07/24
- Re: [Qemu-devel] [PATCH for-4.2 00/14] Some record/replay fixes, Paolo Bonzini, 2019/07/24