[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 3/4] Fixes RTC bug with base datetime shifts
From: |
Paolo Bonzini |
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 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
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);
- [Qemu-devel] [PATCH v3 0/4] Fix and improve core RTC function and documentation, Artem Pisarenko, 2018/10/18
- [Qemu-devel] [PATCH v3 1/4] vl: improve/fix documentation related to RTC function, Artem Pisarenko, 2018/10/18
- [Qemu-devel] [PATCH v3 3/4] Fixes RTC bug with base datetime shifts in clock=vm, Artem Pisarenko, 2018/10/18
- Re: [Qemu-devel] [PATCH v3 3/4] Fixes RTC bug with base datetime shifts in clock=vm,
Paolo Bonzini <=
- [Qemu-devel] [PATCH v3 2/4] vl: refactor -rtc option references, Artem Pisarenko, 2018/10/18
- [Qemu-devel] [PATCH v3 4/4] vl, qapi: offset calculation in RTC_CHANGE event reverted, Artem Pisarenko, 2018/10/18
- Re: [Qemu-devel] [PATCH v3 0/4] Fix and improve core RTC function and documentation, Paolo Bonzini, 2018/10/18