powerpc64: cpu_initclocks: do tc_init(9) before cpu_startclock()
authorcheloha <cheloha@openbsd.org>
Thu, 11 Aug 2022 17:15:21 +0000 (17:15 +0000)
committercheloha <cheloha@openbsd.org>
Thu, 11 Aug 2022 17:15:21 +0000 (17:15 +0000)
In the future, the clock interrupt will need a working timecounter to
accurately reschedule itself.

Move tc_init(9) up before cpu_startclock().

kettenis@ notes several other platforms need this same change.  Maybe
we can do the rest all at once.

Tested by kettenis@.

Link: https://marc.info/?l=openbsd-tech&m=165343754512382&w=2
ok kettenis@

sys/arch/powerpc64/powerpc64/clock.c

index 31d1769..aef95e8 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: clock.c,v 1.4 2022/08/09 04:40:08 cheloha Exp $       */
+/*     $OpenBSD: clock.c,v 1.5 2022/08/11 17:15:21 cheloha Exp $       */
 
 /*
  * Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -57,6 +57,9 @@ tb_get_timecount(struct timecounter *tc)
 void
 cpu_initclocks(void)
 {
+       tb_timecounter.tc_frequency = tb_freq;
+       tc_init(&tb_timecounter);
+
        tick_increment = tb_freq / hz;
 
        stathz = 100;
@@ -68,9 +71,6 @@ cpu_initclocks(void)
        evcount_attach(&stat_count, "stat", NULL);
 
        cpu_startclock();
-
-       tb_timecounter.tc_frequency = tb_freq;
-       tc_init(&tb_timecounter);
 }
 
 void