Module Name: src Committed By: jmcneill Date: Thu Sep 8 12:10:13 UTC 2011
Modified Files: src/sys/arch/usermode/dev: clock.c cpu.c Log Message: get rid of clock softintr and move setitimer call to cpu_initclocks To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/usermode/dev/clock.c cvs rdiff -u -r1.36 -r1.37 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/usermode/dev/clock.c diff -u src/sys/arch/usermode/dev/clock.c:1.15 src/sys/arch/usermode/dev/clock.c:1.16 --- src/sys/arch/usermode/dev/clock.c:1.15 Thu Sep 8 11:11:18 2011 +++ src/sys/arch/usermode/dev/clock.c Thu Sep 8 12:10:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.15 2011/09/08 11:11:18 jmcneill Exp $ */ +/* $NetBSD: clock.c,v 1.16 2011/09/08 12:10:13 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca> @@ -26,10 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "opt_hz.h" - #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.15 2011/09/08 11:11:18 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.16 2011/09/08 12:10:13 jmcneill Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -46,7 +44,6 @@ static int clock_match(device_t, cfdata_t, void *); static void clock_attach(device_t, device_t, void *); -static void clock_softint(void *); static void clock_signal(int sig); static unsigned int clock_getcounter(struct timecounter *); @@ -55,7 +52,6 @@ typedef struct clock_softc { device_t sc_dev; struct todr_chip_handle sc_todr; - void *sc_ih; } clock_softc_t; static struct timecounter clock_timecounter = { @@ -90,7 +86,6 @@ { static struct sigaction sa; clock_softc_t *sc = device_private(self); - struct thunk_itimerval itimer; stack_t ss; long tcres; @@ -101,7 +96,6 @@ clock_sc = sc; sc->sc_dev = self; - sc->sc_ih = softint_establish(SOFTINT_CLOCK, clock_softint, sc); sc->sc_todr.todr_gettime = clock_todr_gettime; todr_attach(&sc->sc_todr); @@ -122,11 +116,6 @@ panic("couldn't register SIGALRM handler : %d", thunk_geterrno()); - itimer.it_interval.tv_sec = 0; - itimer.it_interval.tv_usec = 1000000 / HZ; - itimer.it_value = itimer.it_interval; - thunk_setitimer(ITIMER_REAL, &itimer, NULL); - tcres = thunk_clock_getres_monotonic(); if (tcres > 0) { clock_timecounter.tc_quality = 1000; @@ -138,21 +127,15 @@ static void clock_signal(int sig) { + struct clockframe cf; + curcpu()->ci_idepth++; - softint_schedule(clock_sc->sc_ih); + hardclock(&cf); curcpu()->ci_idepth--; } -static void -clock_softint(void *priv) -{ - struct clockframe cf; - - hardclock(&cf); -} - static unsigned int clock_getcounter(struct timecounter *tc) { Index: src/sys/arch/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.36 src/sys/arch/usermode/dev/cpu.c:1.37 --- src/sys/arch/usermode/dev/cpu.c:1.36 Thu Sep 8 12:08:13 2011 +++ src/sys/arch/usermode/dev/cpu.c Thu Sep 8 12:10:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.36 2011/09/08 12:08:13 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.37 2011/09/08 12:10:13 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca> @@ -27,9 +27,10 @@ */ #include "opt_cpu.h" +#include "opt_hz.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.36 2011/09/08 12:08:13 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.37 2011/09/08 12:10:13 jmcneill Exp $"); #include <sys/param.h> #include <sys/conf.h> @@ -346,6 +347,12 @@ void cpu_initclocks(void) { + struct thunk_itimerval itimer; + + itimer.it_interval.tv_sec = 0; + itimer.it_interval.tv_usec = 1000000 / HZ; + itimer.it_value = itimer.it_interval; + thunk_setitimer(ITIMER_REAL, &itimer, NULL); } void