Index: sys/arch/sparc64/include/cpu.h =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/include/cpu.h,v retrieving revision 1.125 diff -u -r1.125 cpu.h --- sys/arch/sparc64/include/cpu.h 22 Aug 2018 01:05:23 -0000 1.125 +++ sys/arch/sparc64/include/cpu.h 3 Nov 2018 18:51:06 -0000 @@ -434,6 +434,7 @@ void switchtoctx_usiii(int); void next_tick(long); void next_stick(long); +void next_stick_init(void); /* trap.c */ void cpu_vmspace_exec(struct lwp *, vaddr_t, vaddr_t); int rwindow_save(struct lwp *); Index: sys/arch/sparc64/sparc64/clock.c =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/clock.c,v retrieving revision 1.120 diff -u -r1.120 clock.c --- sys/arch/sparc64/sparc64/clock.c 7 Jul 2016 06:55:38 -0000 1.120 +++ sys/arch/sparc64/sparc64/clock.c 3 Nov 2018 18:51:07 -0000 @@ -406,6 +406,7 @@ ci->ci_tick_increment = ci->ci_system_clockrate[0] / hz; s = intr_disable(); + next_stick_init(); next_stick(ci->ci_tick_increment); intr_restore(s); } Index: sys/arch/sparc64/sparc64/locore.s =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/locore.s,v retrieving revision 1.414 diff -u -r1.414 locore.s --- sys/arch/sparc64/sparc64/locore.s 26 May 2018 19:20:21 -0000 1.414 +++ sys/arch/sparc64/sparc64/locore.s 3 Nov 2018 18:51:07 -0000 @@ -7495,6 +7495,21 @@ retl wr %o2, STICK_CMPR +/* + * next_stick_init() + * + * Sets the %stick_cmpr register to the value retrieved from %stick so + * next_stick() does not spend too much time in the function when called + * for the first time. + */ +ENTRY(next_stick_init) + rd STICK, %o0 + mov 1, %o1 ! Mask off high bits of the register + sllx %o1, 63, %o1 + andn %o0, %o1, %o0 + retl + wr %o0, STICK_CMPR + ENTRY(setjmp) save %sp, -CC64FSZ, %sp ! Need a frame to return to. flushw