From: Paolo Bonzini <pbonzini@redhat.com>
To: Artem Pisarenko <artem.k.pisarenko@gmail.com>, qemu-devel@nongnu.org
Cc: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>,
Samuel Thibault <samuel.thibault@ens-lyon.org>,
Jan Kiszka <jan.kiszka@siemens.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] Restores record/replay behavior related to special virtual clock processing for timers used in external subsystems.
Date: Mon, 15 Oct 2018 10:51:40 +0200 [thread overview]
Message-ID: <6b7ba6fc-a676-7535-0467-7433273ce8b0@redhat.com> (raw)
In-Reply-To: <f203d1b772f7e4087f8e64f5f23ae313835413d4.1539528213.git.artem.k.pisarenko@gmail.com>
On 14/10/2018 16:55, Artem Pisarenko wrote:
> + qemu_mutex_lock(&timer_list->active_timers_lock);
> + ts = timer_list->active_timers;
> + while (timer_expired_ns(ts, current_time)) {
> + if (!(ts->attributes & QEMU_TIMER_ATTR(EXTERNAL))) {
> + need_replay_checkpoint = true;
> + break;
> + }
> + ts = ts->next;
> + }
> + qemu_mutex_unlock(&timer_list->active_timers_lock);
This can be applied to all the timerlists, it doesn't have to be limited
to the "virtual" clock, something like (untested):
qemu_mutex_lock(&timer_list->active_timers_lock);
current_time = qemu_clock_get_ns(timer_list->clock->type);
ts = timer_list->active_timers;
if (replay_mode != REPLAY_MODE_NONE) {
while (timer_expired_ns(ts, current_time)) {
if (!(ts->attributes & QEMU_TIMER_ATTR(EXTERNAL))) {
qemu_mutex_unlock(&timer_list->active_timers_lock);
timerlist_checkpoint(timer_list);
qemu_mutex_lock(&timer_list->active_timers_lock);
break;
}
ts = ts->next;
}
ts = timer_list->active_timers;
}
while (timer_expired_ns(ts, current_time)) {
/* remove timer from the list before calling the callback */
timer_list->active_timers = ts->next;
ts->next = NULL;
ts->expire_time = -1;
cb = ts->cb;
opaque = ts->opaque;
/* run the callback (the timer list can be modified) */
qemu_mutex_unlock(&timer_list->active_timers_lock);
cb(opaque);
qemu_mutex_lock(&timer_list->active_timers_lock);
progress = true;
ts = timer_list->active_timers;
}
qemu_mutex_unlock(&timer_list->active_timers_lock);
Thanks,
Paolo
next prev parent reply other threads:[~2018-10-15 8:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-14 14:55 [Qemu-devel] [PATCH 0/3] Introduce attributes for timers subsystem and remove QEMU_CLOCK_VIRTUAL_EXT clock type Artem Pisarenko
2018-10-14 14:55 ` [Qemu-devel] [PATCH 1/3] Revert some patches from recent series [PATCH v6] "Fixing record/replay and adding reverse debugging", which introduced new virtual clock type for use in external subsystems. These changes breaks desired behavior in non-record/replay usage scenarios Artem Pisarenko
2018-10-14 14:55 ` [Qemu-devel] [PATCH 2/3] Introduce attributes to qemu timer subsystem Artem Pisarenko
2018-10-15 8:39 ` Paolo Bonzini
2018-10-16 13:03 ` [Qemu-devel] [PATCH v2] " Artem Pisarenko
2018-10-16 13:47 ` Paolo Bonzini
2018-10-14 14:55 ` [Qemu-devel] [PATCH 3/3] Restores record/replay behavior related to special virtual clock processing for timers used in external subsystems Artem Pisarenko
2018-10-15 6:41 ` Artem Pisarenko
2018-10-15 8:51 ` Paolo Bonzini [this message]
2018-10-15 8:54 ` [Qemu-devel] [PATCH 0/3] Introduce attributes for timers subsystem and remove QEMU_CLOCK_VIRTUAL_EXT clock type Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6b7ba6fc-a676-7535-0467-7433273ce8b0@redhat.com \
--to=pbonzini@redhat.com \
--cc=artem.k.pisarenko@gmail.com \
--cc=jan.kiszka@siemens.com \
--cc=kraxel@redhat.com \
--cc=pavel.dovgaluk@ispras.ru \
--cc=qemu-devel@nongnu.org \
--cc=samuel.thibault@ens-lyon.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).