From: cheloha Date: Sun, 17 Sep 2023 14:50:50 +0000 (+0000) Subject: clockintr: remove clockintr_init(), clockintr_flags X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0ed1bf01ac7e45759b65902d0ab711deb359316d;p=openbsd clockintr: remove clockintr_init(), clockintr_flags All the state initialization once done in clockintr_init() has been moved to other parts of the kernel. It's a dead function. Remove it. Likewise, the clockintr_flags variable no longer sports any meaningful flags. Remove it. This frees up the CL_* flag namespace, which might be useful to the clockintr frontend if we ever need to add behavior flags to any of those functions. --- diff --git a/sys/arch/alpha/alpha/clock.c b/sys/arch/alpha/alpha/clock.c index dd3ad3f75b2..9bce384c652 100644 --- a/sys/arch/alpha/alpha/clock.c +++ b/sys/arch/alpha/alpha/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.30 2023/08/23 01:55:45 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.31 2023/09/17 14:50:50 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.29 2000/06/05 21:47:10 thorpej Exp $ */ /* @@ -191,7 +191,6 @@ cpu_initclocks(void) stathz = hz; profhz = stathz; - clockintr_init(0); } void diff --git a/sys/arch/amd64/amd64/lapic.c b/sys/arch/amd64/amd64/lapic.c index 6f9c2ace887..4232647c3f8 100644 --- a/sys/arch/amd64/amd64/lapic.c +++ b/sys/arch/amd64/amd64/lapic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lapic.c,v 1.70 2023/09/14 19:39:47 cheloha Exp $ */ +/* $OpenBSD: lapic.c,v 1.71 2023/09/17 14:50:50 cheloha Exp $ */ /* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */ /*- @@ -499,7 +499,6 @@ lapic_initclocks(void) stathz = hz; profhz = stathz * 10; statclock_is_randomized = 1; - clockintr_init(0); } diff --git a/sys/arch/amd64/isa/clock.c b/sys/arch/amd64/isa/clock.c index 3dd79b1769d..44e24d8d29f 100644 --- a/sys/arch/amd64/isa/clock.c +++ b/sys/arch/amd64/isa/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.41 2023/08/23 01:55:46 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.42 2023/09/17 14:50:50 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */ /*- @@ -283,7 +283,6 @@ i8254_initclocks(void) stathz = 128; profhz = 1024; /* XXX does not divide into 1 billion */ - clockintr_init(0); } void diff --git a/sys/arch/arm/cortex/agtimer.c b/sys/arch/arm/cortex/agtimer.c index 106cb4804c0..1d9804cc47f 100644 --- a/sys/arch/arm/cortex/agtimer.c +++ b/sys/arch/arm/cortex/agtimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agtimer.c,v 1.20 2023/09/14 19:39:47 cheloha Exp $ */ +/* $OpenBSD: agtimer.c,v 1.21 2023/09/17 14:50:51 cheloha Exp $ */ /* * Copyright (c) 2011 Dale Rahn * Copyright (c) 2013 Patrick Wildt @@ -231,7 +231,6 @@ agtimer_cpu_initclocks(void) stathz = hz; profhz = stathz * 10; statclock_is_randomized = 1; - clockintr_init(0); if (sc->sc_ticks_per_second != agtimer_frequency) { agtimer_set_clockrate(agtimer_frequency); diff --git a/sys/arch/arm/cortex/amptimer.c b/sys/arch/arm/cortex/amptimer.c index 1fb5695c00b..31a61e8aef9 100644 --- a/sys/arch/arm/cortex/amptimer.c +++ b/sys/arch/arm/cortex/amptimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: amptimer.c,v 1.19 2023/09/14 19:39:47 cheloha Exp $ */ +/* $OpenBSD: amptimer.c,v 1.20 2023/09/17 14:50:51 cheloha Exp $ */ /* * Copyright (c) 2011 Dale Rahn * @@ -288,7 +288,6 @@ amptimer_cpu_initclocks(void) stathz = hz; profhz = hz * 10; statclock_is_randomized = 1; - clockintr_init(0); if (sc->sc_ticks_per_second != amptimer_frequency) { amptimer_set_clockrate(amptimer_frequency); diff --git a/sys/arch/arm64/dev/agtimer.c b/sys/arch/arm64/dev/agtimer.c index 12b21c2a79b..fa4e175d8ba 100644 --- a/sys/arch/arm64/dev/agtimer.c +++ b/sys/arch/arm64/dev/agtimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agtimer.c,v 1.27 2023/09/14 19:39:47 cheloha Exp $ */ +/* $OpenBSD: agtimer.c,v 1.28 2023/09/17 14:50:51 cheloha Exp $ */ /* * Copyright (c) 2011 Dale Rahn * Copyright (c) 2013 Patrick Wildt @@ -294,7 +294,6 @@ agtimer_cpu_initclocks(void) stathz = hz; profhz = stathz * 10; statclock_is_randomized = 1; - clockintr_init(0); if (sc->sc_ticks_per_second != agtimer_frequency) { agtimer_set_clockrate(agtimer_frequency); diff --git a/sys/arch/armv7/omap/dmtimer.c b/sys/arch/armv7/omap/dmtimer.c index 5aaee39405c..273e3a358e8 100644 --- a/sys/arch/armv7/omap/dmtimer.c +++ b/sys/arch/armv7/omap/dmtimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dmtimer.c,v 1.21 2023/09/14 19:39:47 cheloha Exp $ */ +/* $OpenBSD: dmtimer.c,v 1.22 2023/09/17 14:50:51 cheloha Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * Copyright (c) 2013 Raphael Graf @@ -233,7 +233,6 @@ dmtimer_cpu_initclocks(void) stathz = hz; profhz = stathz * 10; statclock_is_randomized = 1; - clockintr_init(0); sc->sc_ticks_per_second = TIMER_FREQUENCY; /* 32768 */ sc->sc_nsec_cycle_ratio = diff --git a/sys/arch/armv7/omap/gptimer.c b/sys/arch/armv7/omap/gptimer.c index 8ca887098fd..3ac6353cc10 100644 --- a/sys/arch/armv7/omap/gptimer.c +++ b/sys/arch/armv7/omap/gptimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gptimer.c,v 1.22 2023/09/14 19:39:47 cheloha Exp $ */ +/* $OpenBSD: gptimer.c,v 1.23 2023/09/17 14:50:51 cheloha Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * @@ -199,7 +199,6 @@ gptimer_cpu_initclocks(void) stathz = hz; profhz = stathz * 10; 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; diff --git a/sys/arch/armv7/sunxi/sxitimer.c b/sys/arch/armv7/sunxi/sxitimer.c index 9bee18a9e19..6c4ec50c290 100644 --- a/sys/arch/armv7/sunxi/sxitimer.c +++ b/sys/arch/armv7/sunxi/sxitimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sxitimer.c,v 1.23 2023/09/14 19:39:47 cheloha Exp $ */ +/* $OpenBSD: sxitimer.c,v 1.24 2023/09/17 14:50:51 cheloha Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * Copyright (c) 2013 Raphael Graf @@ -181,7 +181,6 @@ sxitimer_attach(struct device *parent, struct device *self, void *aux) stathz = hz; profhz = stathz * 10; statclock_is_randomized = 1; - clockintr_init(0); /* stop timer, and set clk src */ bus_space_write_4(sxitimer_iot, sxitimer_ioh, diff --git a/sys/arch/hppa/dev/clock.c b/sys/arch/hppa/dev/clock.c index 3e54c5034ca..263c236d2d9 100644 --- a/sys/arch/hppa/dev/clock.c +++ b/sys/arch/hppa/dev/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.38 2023/09/14 19:39:48 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.39 2023/09/17 14:50:51 cheloha Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -117,7 +117,6 @@ cpu_initclocks(void) stathz = hz; profhz = stathz * 10; 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; diff --git a/sys/arch/i386/i386/lapic.c b/sys/arch/i386/i386/lapic.c index 97cfb45979a..477ed4938e7 100644 --- a/sys/arch/i386/i386/lapic.c +++ b/sys/arch/i386/i386/lapic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lapic.c,v 1.57 2023/09/14 19:39:48 cheloha Exp $ */ +/* $OpenBSD: lapic.c,v 1.58 2023/09/17 14:50:51 cheloha Exp $ */ /* $NetBSD: lapic.c,v 1.1.2.8 2000/02/23 06:10:50 sommerfeld Exp $ */ /*- @@ -327,7 +327,6 @@ lapic_initclocks(void) stathz = hz; profhz = stathz * 10; statclock_is_randomized = 1; - clockintr_init(0); } extern int gettick(void); /* XXX put in header file */ diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c index 630be7642a2..15dee6a3168 100644 --- a/sys/arch/i386/isa/clock.c +++ b/sys/arch/i386/isa/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.67 2023/08/23 01:55:46 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.68 2023/09/17 14:50:51 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.39 1996/05/12 23:11:54 mycroft Exp $ */ /*- @@ -426,7 +426,6 @@ i8254_initclocks(void) stathz = 128; profhz = 1024; /* XXX does not divide into 1 billion */ - clockintr_init(0); } void diff --git a/sys/arch/loongson/dev/glxclk.c b/sys/arch/loongson/dev/glxclk.c index d3df7cf941c..705044dc418 100644 --- a/sys/arch/loongson/dev/glxclk.c +++ b/sys/arch/loongson/dev/glxclk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glxclk.c,v 1.10 2023/09/14 19:39:48 cheloha Exp $ */ +/* $OpenBSD: glxclk.c,v 1.11 2023/09/17 14:50:51 cheloha Exp $ */ /* * Copyright (c) 2013 Paul Irofti. @@ -192,8 +192,6 @@ glxclk_initclock(void) statclock_is_randomized = 1; tick = 1000000 / hz; tick_nsec = 1000000000 / hz; - - clockintr_init(0); } void diff --git a/sys/arch/luna88k/luna88k/clock.c b/sys/arch/luna88k/luna88k/clock.c index 2dd6d91cae5..7dfaf85a3d5 100644 --- a/sys/arch/luna88k/luna88k/clock.c +++ b/sys/arch/luna88k/luna88k/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.18 2023/08/23 01:55:47 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.19 2023/09/17 14:50:51 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.2 2000/01/11 10:29:35 nisimura Exp $ */ /* @@ -138,7 +138,6 @@ cpu_initclocks() stathz = hz; profhz = stathz; - clockintr_init(0); } void diff --git a/sys/arch/macppc/macppc/clock.c b/sys/arch/macppc/macppc/clock.c index a9bed56a627..68f269d22f8 100644 --- a/sys/arch/macppc/macppc/clock.c +++ b/sys/arch/macppc/macppc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.57 2023/09/14 19:39:48 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.58 2023/09/17 14:50:51 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -196,7 +196,6 @@ cpu_initclocks(void) stathz = hz; profhz = stathz * 10; 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; diff --git a/sys/arch/mips64/mips64/clock.c b/sys/arch/mips64/mips64/clock.c index 0afc2e7c73d..fc23ffa3d20 100644 --- a/sys/arch/mips64/mips64/clock.c +++ b/sys/arch/mips64/mips64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.52 2023/09/14 19:39:48 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.53 2023/09/17 14:50:51 cheloha Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -242,7 +242,6 @@ cp0_initclock(void) stathz = hz; profhz = stathz * 10; statclock_is_randomized = 1; - clockintr_init(0); } /* diff --git a/sys/arch/powerpc64/powerpc64/clock.c b/sys/arch/powerpc64/powerpc64/clock.c index 7de2ac52c2e..30f191d2240 100644 --- a/sys/arch/powerpc64/powerpc64/clock.c +++ b/sys/arch/powerpc64/powerpc64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.13 2023/09/14 19:39:48 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.14 2023/09/17 14:50:51 cheloha Exp $ */ /* * Copyright (c) 2020 Mark Kettenis @@ -95,7 +95,6 @@ cpu_initclocks(void) stathz = hz; profhz = stathz * 10; statclock_is_randomized = 1; - clockintr_init(0); evcount_attach(&clock_count, "clock", NULL); } diff --git a/sys/arch/riscv64/riscv64/clock.c b/sys/arch/riscv64/riscv64/clock.c index 5685e9c4d85..d0574f534b0 100644 --- a/sys/arch/riscv64/riscv64/clock.c +++ b/sys/arch/riscv64/riscv64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.12 2023/09/14 19:39:48 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.13 2023/09/17 14:50:51 cheloha Exp $ */ /* * Copyright (c) 2020 Mark Kettenis @@ -93,7 +93,6 @@ cpu_initclocks(void) stathz = hz; profhz = stathz * 10; statclock_is_randomized = 1; - clockintr_init(0); riscv_intc_intr_establish(IRQ_TIMER_SUPERVISOR, 0, clock_intr, NULL, NULL); diff --git a/sys/arch/sh/sh/clock.c b/sys/arch/sh/sh/clock.c index daeedf34e66..c27ac50fd1c 100644 --- a/sys/arch/sh/sh/clock.c +++ b/sys/arch/sh/sh/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.16 2023/08/23 01:55:47 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.17 2023/09/17 14:50:51 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.32 2006/09/05 11:09:36 uwe Exp $ */ /*- @@ -259,7 +259,6 @@ cpu_initclocks(void) stathz = hz; profhz = stathz; - clockintr_init(0); } void diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c index 84ec8404d6e..5dbec5b023d 100644 --- a/sys/arch/sparc64/sparc64/clock.c +++ b/sys/arch/sparc64/sparc64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.81 2023/09/14 19:39:48 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.82 2023/09/17 14:50:51 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */ /* @@ -502,7 +502,6 @@ cpu_initclocks(void) stathz = hz; profhz = stathz * 10; statclock_is_randomized = 1; - clockintr_init(0); /* Make sure we have a sane cpu_clockrate -- we'll need it */ if (!cpu_clockrate) diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c index 2f1efcbb871..5cfae369f25 100644 --- a/sys/kern/kern_clockintr.c +++ b/sys/kern/kern_clockintr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_clockintr.c,v 1.53 2023/09/15 11:48:49 deraadt Exp $ */ +/* $OpenBSD: kern_clockintr.c,v 1.54 2023/09/17 14:50:50 cheloha Exp $ */ /* * Copyright (c) 2003 Dale Rahn * Copyright (c) 2020 Mark Kettenis @@ -31,13 +31,6 @@ #include #include -/* - * Protection for global variables in this file: - * - * I Immutable after initialization. - */ -uint32_t clockintr_flags; /* [I] global state + behavior flags */ - void clockintr_hardclock(struct clockintr *, void *, void *); void clockintr_schedule(struct clockintr *, uint64_t); void clockintr_schedule_locked(struct clockintr *, uint64_t); @@ -50,19 +43,6 @@ void clockqueue_pend_insert(struct clockintr_queue *, struct clockintr *, void clockqueue_reset_intrclock(struct clockintr_queue *); uint64_t nsec_advance(uint64_t *, uint64_t, uint64_t); -/* - * Initialize global state. Set flags and compute intervals. - */ -void -clockintr_init(uint32_t flags) -{ - KASSERT(CPU_IS_PRIMARY(curcpu())); - KASSERT(clockintr_flags == 0); - KASSERT(!ISSET(flags, ~CL_FLAG_MASK)); - - SET(clockintr_flags, flags | CL_INIT); -} - /* * Ready the calling CPU for clockintr_dispatch(). If this is our * first time here, install the intrclock, if any, and set necessary @@ -77,8 +57,6 @@ clockintr_cpu_init(const struct intrclock *ic) struct schedstate_percpu *spc = &ci->ci_schedstate; int reset_cq_intrclock = 0; - KASSERT(ISSET(clockintr_flags, CL_INIT)); - if (ic != NULL) clockqueue_intrclock_install(cq, ic); diff --git a/sys/sys/clockintr.h b/sys/sys/clockintr.h index 247457c4be4..463085007d5 100644 --- a/sys/sys/clockintr.h +++ b/sys/sys/clockintr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: clockintr.h,v 1.17 2023/09/15 11:48:48 deraadt Exp $ */ +/* $OpenBSD: clockintr.h,v 1.18 2023/09/17 14:50:50 cheloha Exp $ */ /* * Copyright (c) 2020-2022 Scott Cheloha * @@ -109,16 +109,8 @@ struct clockintr_queue { #define CQ_INTRCLOCK 0x00000002 /* intrclock installed */ #define CQ_STATE_MASK 0x00000003 -/* Global state flags. */ -#define CL_INIT 0x00000001 /* global init done */ -#define CL_STATE_MASK 0x00000001 - -/* Global behavior flags. */ -#define CL_FLAG_MASK 0x00000000 - void clockintr_cpu_init(const struct intrclock *); int clockintr_dispatch(void *); -void clockintr_init(uint32_t); void clockintr_trigger(void); /*