Skip to contentSkip to conversation

ppc: do not use get_clock_realtime()

PATCH Applied Paolo Bonzini 3 participants 5 messages Nov 26, 2014 – Dec 17, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc: do not use get_clock_realtime()

Use the external qemu-timer API instead.

---
 hw/ppc/ppc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/ppc.c +2 -2
index bec82cd..5ce565d 100644
@@ -844,7 +844,7 @@ static void timebase_pre_save(void *opaque)
         return;
     }
 
-    tb->time_of_the_day_ns = get_clock_realtime();
+    tb->time_of_the_day_ns = qemu_clock_get_ns(QEMU_CLOCK_HOST);
     /*
      * tb_offset is only expected to be changed by migration so
      * there is no need to update it from KVM here
@@ -873,7 +873,7 @@ static int timebase_post_load(void *opaque, int version_id)
      * We try to adjust timebase by downtime if host clocks are not
      * too much out of sync (1 second for now).
      */
-    host_ns = get_clock_realtime();
+    host_ns = qemu_clock_get_ns(QEMU_CLOCK_HOST);
     ns_diff = MAX(0, host_ns - tb_remote->time_of_the_day_ns);
     migration_duration_ns = MIN(NSEC_PER_SEC, ns_diff);
     migration_duration_tb = muldiv64(migration_duration_ns, freq, NSEC_PER_SEC);
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 1 line · Paolo Bonzini

Use the external qemu-timer API instead.

Perhaps it's obvious but is it reasonable to expand on why you're doign this in the commit message?

Yours Tony.

#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 5 lines · Tony Breeds
Quoted 1 line · Paolo Bonzini

Use the external qemu-timer API instead.

Perhaps it's obvious but is it reasonable to expand on why you're doign this in the commit message?

You're right. It's just that the API should be private to qemu-timer.c, it is not meant for external usage---and it is messy because get_clock_realtime() is for QEMU_CLOCK_HOST.

In addition, all uses of QEMU_CLOCK_HOST should probably use rtc_clock instead, and this patch makes it easier to track those places for a follow-up switch to rtc_clock.

Paolo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJUd1izAAoJEL/70l94x66D8ncH/jwc6oVfUjHvBau3GJy0Vi/I S5kMndpPKgepMlAWWSK67uoMZQWAyRwG4Bwyat3g8RnpevQTN1pLZG276c2f5t5o piB9nGmT7BPhxkEiWGGtxeX5ob1Ab8hhTm4Ai78fH8OnQexBT1B06Oz3zcYZKoGD ckbCzEeiAb8Jxm4wop/s+WApqcnWAsfriCJ0XWUQxtxIbt3esmfMzW+n2fxvhHI1 ookJgqn1ssHpZBYu5lnsPxY+kVTrf0dQaeiPApGSmHUJknmnAEXUGKl1jsdjLCE2 8h5sasf3a7xL+GmZrYjzyZbLYm6BqmjNSsBYCFHYVYVFl857b/S1azoxPC5EZc0= =4+yL
-----END PGP SIGNATURE-----

#3 lore raw
Quoted 3 lines · Paolo Bonzini

You're right. It's just that the API should be private to qemu-timer.c, it is not meant for external usage---and it is messy because get_clock_realtime() is for QEMU_CLOCK_HOST.

Somehow this got horrendously lost.

Quoted 3 lines

In addition, all uses of QEMU_CLOCK_HOST should probably use rtc_clock instead, and this patch makes it easier to track those places for a follow-up switch to rtc_clock.

Thanks for the explanation.

Yours Tony.