-/* $OpenBSD: lapic.c,v 1.69 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: lapic.c,v 1.70 2023/09/14 19:39:47 cheloha Exp $ */
/* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */
/*-
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
}
-/* $OpenBSD: agtimer.c,v 1.19 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: agtimer.c,v 1.20 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
if (sc->sc_ticks_per_second != agtimer_frequency) {
agtimer_set_clockrate(agtimer_frequency);
-/* $OpenBSD: amptimer.c,v 1.18 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: amptimer.c,v 1.19 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
*
stathz = hz;
profhz = hz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
if (sc->sc_ticks_per_second != amptimer_frequency) {
amptimer_set_clockrate(amptimer_frequency);
-/* $OpenBSD: agtimer.c,v 1.26 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: agtimer.c,v 1.27 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
if (sc->sc_ticks_per_second != agtimer_frequency) {
agtimer_set_clockrate(agtimer_frequency);
-/* $OpenBSD: dmtimer.c,v 1.20 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: dmtimer.c,v 1.21 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
sc->sc_ticks_per_second = TIMER_FREQUENCY; /* 32768 */
sc->sc_nsec_cycle_ratio =
-/* $OpenBSD: gptimer.c,v 1.21 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: gptimer.c,v 1.22 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
{
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
gptimer_nsec_cycle_ratio = TIMER_FREQUENCY * (1ULL << 32) / 1000000000;
gptimer_nsec_max = UINT64_MAX / gptimer_nsec_cycle_ratio;
-/* $OpenBSD: sxitimer.c,v 1.22 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: sxitimer.c,v 1.23 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
/* stop timer, and set clk src */
bus_space_write_4(sxitimer_iot, sxitimer_ioh,
-/* $OpenBSD: clock.c,v 1.37 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.38 2023/09/14 19:39:48 cheloha Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
itmr_nsec_cycle_ratio = itmr_freq * (1ULL << 32) / 1000000000;
itmr_nsec_max = UINT64_MAX / itmr_nsec_cycle_ratio;
-/* $OpenBSD: lapic.c,v 1.56 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: lapic.c,v 1.57 2023/09/14 19:39:48 cheloha Exp $ */
/* $NetBSD: lapic.c,v 1.1.2.8 2000/02/23 06:10:50 sommerfeld Exp $ */
/*-
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
}
extern int gettick(void); /* XXX put in header file */
-/* $OpenBSD: glxclk.c,v 1.9 2023/08/26 09:37:43 visa Exp $ */
+/* $OpenBSD: glxclk.c,v 1.10 2023/09/14 19:39:48 cheloha Exp $ */
/*
* Copyright (c) 2013 Paul Irofti.
*/
stathz = hz = 128;
profhz = hz * 10;
+ statclock_is_randomized = 1;
tick = 1000000 / hz;
tick_nsec = 1000000000 / hz;
- clockintr_init(CL_RNDSTAT);
+ clockintr_init(0);
}
void
-/* $OpenBSD: clock.c,v 1.56 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.57 2023/09/14 19:39:48 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */
/*
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
dec_nsec_cycle_ratio = ticks_per_sec * (1ULL << 32) / 1000000000;
dec_nsec_max = UINT64_MAX / dec_nsec_cycle_ratio;
-/* $OpenBSD: clock.c,v 1.51 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.52 2023/09/14 19:39:48 cheloha Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
}
/*
-/* $OpenBSD: clock.c,v 1.12 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.13 2023/09/14 19:39:48 cheloha Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
evcount_attach(&clock_count, "clock", NULL);
}
-/* $OpenBSD: clock.c,v 1.11 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.12 2023/09/14 19:39:48 cheloha Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
riscv_intc_intr_establish(IRQ_TIMER_SUPERVISOR, 0,
clock_intr, NULL, NULL);
-/* $OpenBSD: clock.c,v 1.80 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.81 2023/09/14 19:39:48 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */
/*
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
/* Make sure we have a sane cpu_clockrate -- we'll need it */
if (!cpu_clockrate)
-/* $OpenBSD: kern_clock.c,v 1.116 2023/09/09 18:19:03 cheloha Exp $ */
+/* $OpenBSD: kern_clock.c,v 1.117 2023/09/14 19:39:47 cheloha Exp $ */
/* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */
/*-
/* Don't force early wrap around, triggers bug in inteldrm */
volatile unsigned long jiffies;
+int statclock_is_randomized; /* [I] fixed or pseudorandom period? */
+
/*
* Initialize clock frequencies and start both clocks running.
*/
-/* $OpenBSD: kern_clockintr.c,v 1.47 2023/09/10 03:08:05 cheloha Exp $ */
+/* $OpenBSD: kern_clockintr.c,v 1.48 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
* We can always advance the statclock. There is no reason to
* stagger a randomized statclock.
*/
- if (!ISSET(clockintr_flags, CL_RNDSTAT)) {
+ if (!statclock_is_randomized) {
if (cq->cq_statclock->cl_expiration == 0) {
clockintr_stagger(cq->cq_statclock, statclock_avg,
multiplier, MAXCPUS);
{
uint64_t count, i;
- if (ISSET(clockintr_flags, CL_RNDSTAT)) {
+ if (statclock_is_randomized) {
count = clockintr_advance_random(cl, statclock_min,
statclock_mask);
} else {
-/* $OpenBSD: clockintr.h,v 1.13 2023/09/10 03:08:05 cheloha Exp $ */
+/* $OpenBSD: clockintr.h,v 1.14 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2020-2022 Scott Cheloha <cheloha@openbsd.org>
*
#define CL_STATE_MASK 0x00000001
/* Global behavior flags. */
-#define CL_RNDSTAT 0x80000000 /* randomized statclock */
-#define CL_FLAG_MASK 0x80000000
+#define CL_FLAG_MASK 0x00000000
void clockintr_cpu_init(const struct intrclock *);
int clockintr_dispatch(void *);
-/* $OpenBSD: systm.h,v 1.165 2023/08/23 01:55:45 cheloha Exp $ */
+/* $OpenBSD: systm.h,v 1.166 2023/09/14 19:39:47 cheloha Exp $ */
/* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */
/*-
void realitexpire(void *);
extern uint32_t hardclock_period;
+extern int statclock_is_randomized;
struct clockframe;
void hardclock(struct clockframe *);