From: Paolo Bonzini <pbonzini@redhat.com>
To: Artem Pisarenko <artem.k.pisarenko@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 3/4] Fixes RTC bug with base datetime shifts in clock=vm
Date: Thu, 18 Oct 2018 16:44:49 +0200 [thread overview]
Message-ID: <0bc338a1-70e8-8f38-86e0-f2e5a59d2403@redhat.com> (raw)
In-Reply-To: <1d963c3e013dfedafa1f6edb9fb219b7e49e39da.1539846575.git.artem.k.pisarenko@gmail.com>
On 18/10/2018 09:12, Artem Pisarenko wrote:
> + rtc_host_datetime_offset = rtc_ref_start_datetime - rtc_start_datetime;
> + rtc_ref_start_datetime = rtc_start_datetime;
Because of this, multiple rtc options have funny effects.
Can squash this instead:
diff --git a/vl.c b/vl.c
index 1b349b78bd..4c332a5469 100644
--- a/vl.c
+++ b/vl.c
@@ -249,6 +249,7 @@ static struct {
static QemuOptsList qemu_rtc_opts = {
.name = "rtc",
.head = QTAILQ_HEAD_INITIALIZER(qemu_rtc_opts.head),
+ .merge_lists = true,
.desc = {
{
.name = "base",
@@ -886,6 +887,11 @@ static void configure_rtc(QemuOpts *opts)
{
const char *value;
+ /* Set defaults */
+ rtc_clock = QEMU_CLOCK_HOST;
+ rtc_ref_start_datetime = qemu_clock_get_ms(QEMU_CLOCK_HOST) / 1000;
+ rtc_realtime_clock_offset = qemu_clock_get_ms(QEMU_CLOCK_REALTIME)
/ 1000;
+
value = qemu_opt_get(opts, "base");
if (value) {
if (!strcmp(value, "utc")) {
@@ -3048,9 +3054,6 @@ int main(int argc, char **argv, char **envp)
error_reportf_err(err, "cannot initialize crypto: ");
exit(1);
}
- rtc_clock = QEMU_CLOCK_HOST;
- rtc_ref_start_datetime = qemu_clock_get_ms(QEMU_CLOCK_HOST) / 1000;
- rtc_realtime_clock_offset = qemu_clock_get_ms(QEMU_CLOCK_REALTIME)
/ 1000;
QLIST_INIT (&vm_change_state_head);
os_setup_early_signal_handling();
@@ -3770,7 +3771,6 @@ int main(int argc, char **argv, char **envp)
if (!opts) {
exit(1);
}
- configure_rtc(opts);
break;
case QEMU_OPTION_tb_size:
#ifndef CONFIG_TCG
@@ -3988,6 +3988,8 @@ int main(int argc, char **argv, char **envp)
exit(EXIT_FAILURE);
}
+ configure_rtc(qemu_find_opts_singleton("rtc"));
+
machine_class = select_machine();
set_memory_options(&ram_slots, &maxram_size, machine_class);
next prev parent reply other threads:[~2018-10-18 14:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 7:12 [Qemu-devel] [PATCH v3 0/4] Fix and improve core RTC function and documentation Artem Pisarenko
2018-10-18 7:12 ` [Qemu-devel] [PATCH v3 1/4] vl: improve/fix documentation related to RTC function Artem Pisarenko
2018-10-18 14:36 ` Paolo Bonzini
2018-10-18 7:12 ` [Qemu-devel] [PATCH v3 2/4] vl: refactor -rtc option references Artem Pisarenko
2018-10-18 7:12 ` [Qemu-devel] [PATCH v3 3/4] Fixes RTC bug with base datetime shifts in clock=vm Artem Pisarenko
2018-10-18 14:44 ` Paolo Bonzini [this message]
2018-10-18 7:12 ` [Qemu-devel] [PATCH v3 4/4] vl, qapi: offset calculation in RTC_CHANGE event reverted Artem Pisarenko
2018-10-18 14:47 ` [Qemu-devel] [PATCH v3 0/4] Fix and improve core RTC function and documentation Paolo Bonzini
2018-10-19 5:24 ` Artem Pisarenko
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=0bc338a1-70e8-8f38-86e0-f2e5a59d2403@redhat.com \
--to=pbonzini@redhat.com \
--cc=artem.k.pisarenko@gmail.com \
--cc=qemu-devel@nongnu.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).