Module Name: src Committed By: pooka Date: Wed Apr 22 16:49:42 UTC 2015
Modified Files: src/sys/rump/librump/rumpkern: Makefile.rumpkern emul.c intr.c Log Message: Include kern_clock.c in rump kernels. To generate a diff of this commit: cvs rdiff -u -r1.155 -r1.156 src/sys/rump/librump/rumpkern/Makefile.rumpkern cvs rdiff -u -r1.170 -r1.171 src/sys/rump/librump/rumpkern/emul.c cvs rdiff -u -r1.50 -r1.51 src/sys/rump/librump/rumpkern/intr.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/rump/librump/rumpkern/Makefile.rumpkern diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.155 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.156 --- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.155 Tue Apr 14 13:32:34 2015 +++ src/sys/rump/librump/rumpkern/Makefile.rumpkern Wed Apr 22 16:49:42 2015 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.rumpkern,v 1.155 2015/04/14 13:32:34 riastradh Exp $ +# $NetBSD: Makefile.rumpkern,v 1.156 2015/04/22 16:49:42 pooka Exp $ # .include "${RUMPTOP}/Makefile.rump" @@ -71,6 +71,7 @@ SRCS+= devsw.c SRCS+= init_sysctl_base.c \ kern_auth.c \ kern_cfglock.c \ + kern_clock.c \ kern_descrip.c \ kern_event.c \ kern_hook.c \ Index: src/sys/rump/librump/rumpkern/emul.c diff -u src/sys/rump/librump/rumpkern/emul.c:1.170 src/sys/rump/librump/rumpkern/emul.c:1.171 --- src/sys/rump/librump/rumpkern/emul.c:1.170 Sat Apr 18 15:49:18 2015 +++ src/sys/rump/librump/rumpkern/emul.c Wed Apr 22 16:49:42 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: emul.c,v 1.170 2015/04/18 15:49:18 pooka Exp $ */ +/* $NetBSD: emul.c,v 1.171 2015/04/22 16:49:42 pooka Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.170 2015/04/18 15:49:18 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.171 2015/04/22 16:49:42 pooka Exp $"); #include <sys/param.h> #include <sys/null.h> @@ -85,7 +85,6 @@ struct vnode *rootvp; dev_t rootdev = NODEV; const int schedppq = 1; -int hardclock_ticks; bool mp_online = false; struct timeval boottime; int cold = 1; Index: src/sys/rump/librump/rumpkern/intr.c diff -u src/sys/rump/librump/rumpkern/intr.c:1.50 src/sys/rump/librump/rumpkern/intr.c:1.51 --- src/sys/rump/librump/rumpkern/intr.c:1.50 Tue Apr 21 16:18:50 2015 +++ src/sys/rump/librump/rumpkern/intr.c Wed Apr 22 16:49:42 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.50 2015/04/21 16:18:50 pooka Exp $ */ +/* $NetBSD: intr.c,v 1.51 2015/04/22 16:49:42 pooka Exp $ */ /* * Copyright (c) 2008-2010, 2015 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.50 2015/04/21 16:18:50 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.51 2015/04/22 16:49:42 pooka Exp $"); #include <sys/param.h> #include <sys/atomic.h> @@ -82,22 +82,12 @@ kcondvar_t lbolt; /* Oh Kath Ra */ static int ncpu_final; -static u_int -rumptc_get(struct timecounter *tc) -{ - - KASSERT(rump_threads); - return (u_int)hardclock_ticks; -} - -static struct timecounter rumptc = { - .tc_get_timecount = rumptc_get, - .tc_poll_pps = NULL, - .tc_counter_mask = ~0, - .tc_frequency = 0, - .tc_name = "rumpclk", - .tc_quality = 0, -}; +void noclock(void); void noclock(void) {return;} +__strong_alias(sched_schedclock,noclock); +__strong_alias(cpu_initclocks,noclock); +__strong_alias(addupc_intr,noclock); +__strong_alias(sched_tick,noclock); +__strong_alias(setstatclockrate,noclock); /* * clock "interrupt" @@ -106,10 +96,11 @@ static void doclock(void *noarg) { struct timespec thetick, curclock; + struct clockframe frame; int64_t sec; long nsec; int error; - int cpuindx = curcpu()->ci_index; + struct cpu_info *ci = curcpu(); error = rumpuser_clock_gettime(RUMPUSER_CLOCK_ABSMONO, &sec, &nsec); if (error) @@ -120,21 +111,24 @@ doclock(void *noarg) thetick.tv_sec = 0; thetick.tv_nsec = 1000000000/hz; + /* not used, so doesn't matter what we pass in */ + memset(&frame, 0, sizeof(frame)); + for (;;) { - callout_hardclock(); + int lbolt_ticks = 0; + + hardclock(&frame); + if (CPU_IS_PRIMARY(ci)) { + if (++lbolt_ticks >= hz) { + lbolt_ticks = 0; + cv_broadcast(&lbolt); + } + } error = rumpuser_clock_sleep(RUMPUSER_CLOCK_ABSMONO, curclock.tv_sec, curclock.tv_nsec); KASSERT(!error); timespecadd(&curclock, &thetick, &curclock); - - if (cpuindx != 0) - continue; - - if ((++hardclock_ticks % hz) == 0) { - cv_broadcast(&lbolt); - } - tc_ticktock(); } } @@ -304,8 +298,12 @@ softint_init(struct cpu_info *ci) if (ci->ci_index == 0) { int sithr_swap; - rumptc.tc_frequency = hz; - tc_init(&rumptc); + /* pretend that we have our own for these */ + stathz = 1; + schedhz = 1; + profhz = 1; + + initclocks(); /* create deferred softint threads */ mutex_enter(&sithr_emtx);