PERFORCE change 91364 for review

Warner Losh imp at FreeBSD.org
Tue Feb 7 18:25:14 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=91364

Change 91364 by imp at imp_harmony on 2006/02/08 02:24:50

	IFC @91362

Affected files ...

.. //depot/projects/arm/src/sys/alpha/alpha/mp_machdep.c#3 integrate
.. //depot/projects/arm/src/sys/amd64/amd64/mp_machdep.c#6 integrate
.. //depot/projects/arm/src/sys/conf/files#19 integrate
.. //depot/projects/arm/src/sys/dev/pccbb/pccbb.c#6 integrate
.. //depot/projects/arm/src/sys/geom/eli/g_eli.c#5 integrate
.. //depot/projects/arm/src/sys/i386/i386/mp_machdep.c#6 integrate
.. //depot/projects/arm/src/sys/ia64/ia64/mp_machdep.c#3 integrate
.. //depot/projects/arm/src/sys/kern/init_main.c#5 integrate
.. //depot/projects/arm/src/sys/kern/kern_acct.c#6 integrate
.. //depot/projects/arm/src/sys/kern/kern_exit.c#10 integrate
.. //depot/projects/arm/src/sys/kern/kern_proc.c#6 integrate
.. //depot/projects/arm/src/sys/kern/kern_resource.c#4 integrate
.. //depot/projects/arm/src/sys/kern/kern_synch.c#5 integrate
.. //depot/projects/arm/src/sys/kern/kern_tc.c#3 integrate
.. //depot/projects/arm/src/sys/kern/subr_trap.c#3 integrate
.. //depot/projects/arm/src/sys/modules/arcnet/Makefile#3 integrate
.. //depot/projects/arm/src/sys/net/if_gre.c#4 integrate
.. //depot/projects/arm/src/sys/net/radix.c#2 integrate
.. //depot/projects/arm/src/sys/netinet/tcp_syncache.c#6 integrate
.. //depot/projects/arm/src/sys/security/audit/audit.c#4 integrate
.. //depot/projects/arm/src/sys/sparc64/sparc64/mp_machdep.c#3 integrate
.. //depot/projects/arm/src/sys/sparc64/sparc64/tick.c#4 integrate
.. //depot/projects/arm/src/sys/sys/pcpu.h#3 integrate
.. //depot/projects/arm/src/sys/sys/proc.h#7 integrate
.. //depot/projects/arm/src/sys/sys/systm.h#9 integrate

Differences ...

==== //depot/projects/arm/src/sys/alpha/alpha/mp_machdep.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.57 2005/11/03 21:08:19 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.58 2006/02/07 21:22:01 phk Exp $");
 
 #include "opt_kstack_pages.h"
 
@@ -225,7 +225,7 @@
 	spinlock_exit();
 	KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count"));
 
-	binuptime(PCPU_PTR(switchtime));
+	PCPU_SET(switchtime, cpu_ticks());
 	PCPU_SET(switchticks, ticks);
 
 	cpu_throw(NULL, choosethread());	/* doesn't return */

==== //depot/projects/arm/src/sys/amd64/amd64/mp_machdep.c#6 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.267 2005/12/22 22:16:05 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.268 2006/02/07 21:22:01 phk Exp $");
 
 #include "opt_cpu.h"
 #include "opt_kstack_pages.h"
@@ -582,7 +582,7 @@
 	spinlock_exit();
 	KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count"));
 
-	binuptime(PCPU_PTR(switchtime));
+	PCPU_SET(switchtime, cpu_ticks());
 	PCPU_SET(switchticks, ticks);
 
 	cpu_throw(NULL, choosethread());	/* doesn't return */

==== //depot/projects/arm/src/sys/conf/files#19 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1095 2006/02/06 22:50:39 rwatson Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1096 2006/02/07 18:41:56 imp Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and

==== //depot/projects/arm/src/sys/dev/pccbb/pccbb.c#6 (text+ko) ====

@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pccbb/pccbb.c,v 1.138 2006/02/04 21:56:14 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pccbb/pccbb.c,v 1.139 2006/02/07 18:38:51 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -287,18 +287,26 @@
 	int tmp;
 	int error;
 
+	/*
+	 * Before we delete the children (which we have to do because
+	 * attach doesn't check for children busses correctly), we have
+	 * to detach the children.  Even if we didn't need to delete the
+	 * children, we have to detach them.
+	 */
+	error = bus_generic_detach(brdev);
+	if (error != 0)
+		return (error);
+
+	/*
+	 * Since the attach routine doesn't search for children before it
+	 * attaches them to this device, we must delete them here in order
+	 * for the kldload/unload case to work.  If we failed to do that, then
+	 * we'd get duplicate devices when cbb.ko was reloaded.
+	 */
 	device_get_children(brdev, &devlist, &numdevs);
-
-	error = 0;
-	for (tmp = 0; tmp < numdevs; tmp++) {
-		if (device_detach(devlist[tmp]) == 0)
-			device_delete_child(brdev, devlist[tmp]);
-		else
-			error++;
-	}
+	for (tmp = 0; tmp < numdevs; tmp++)
+		device_delete_child(brdev, devlist[tmp]);
 	free(devlist, M_TEMP);
-	if (error > 0)
-		return (ENXIO);
 
 	/* Turn off the interrupts */
 	cbb_set(sc, CBB_SOCKET_MASK, 0);

==== //depot/projects/arm/src/sys/geom/eli/g_eli.c#5 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/geom/eli/g_eli.c,v 1.17 2006/02/01 12:05:59 pjd Exp $");
+__FBSDID("$FreeBSD: src/sys/geom/eli/g_eli.c,v 1.18 2006/02/07 17:23:22 brueffer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -60,15 +60,15 @@
 static u_int g_eli_tries = 3;
 TUNABLE_INT("kern.geom.eli.tries", &g_eli_tries);
 SYSCTL_UINT(_kern_geom_eli, OID_AUTO, tries, CTLFLAG_RW, &g_eli_tries, 0,
-    "Number of tries when asking for passphrase");
+    "Number of tries for entering the passphrase");
 static u_int g_eli_visible_passphrase = 0;
 TUNABLE_INT("kern.geom.eli.visible_passphrase", &g_eli_visible_passphrase);
 SYSCTL_UINT(_kern_geom_eli, OID_AUTO, visible_passphrase, CTLFLAG_RW,
     &g_eli_visible_passphrase, 0,
-    "Turn on echo when entering passphrase (debug purposes only!!)");
+    "Turn on echo when entering the passphrase (for debug purposes only!!)");
 u_int g_eli_overwrites = 5;
 SYSCTL_UINT(_kern_geom_eli, OID_AUTO, overwrites, CTLFLAG_RW, &g_eli_overwrites,
-    0, "Number of overwrites on-disk keys when destroying");
+    0, "Number of times on-disk keys should be overwritten when destroying them");
 static u_int g_eli_threads = 0;
 TUNABLE_INT("kern.geom.eli.threads", &g_eli_threads);
 SYSCTL_UINT(_kern_geom_eli, OID_AUTO, threads, CTLFLAG_RW, &g_eli_threads, 0,
@@ -121,7 +121,7 @@
 			break;
 	}
 	KASSERT(wr != NULL, ("Invalid worker (%u).", bp->bio_pflags));
-	G_ELI_DEBUG(1, "Reruning crypto %s request (sid: %ju -> %ju).",
+	G_ELI_DEBUG(1, "Rerunning crypto %s request (sid: %ju -> %ju).",
 	    bp->bio_cmd == BIO_READ ? "READ" : "WRITE", (uintmax_t)wr->w_sid,
 	    (uintmax_t)crp->crp_sid);
 	wr->w_sid = crp->crp_sid;
@@ -767,10 +767,10 @@
 		if (error != 0) {
 			free(wr, M_ELI);
 			if (req != NULL) {
-				gctl_error(req, "Cannot setup crypto session "
+				gctl_error(req, "Cannot set up crypto session "
 				    "for %s (error=%d).", bpp->name, error);
 			} else {
-				G_ELI_DEBUG(1, "Cannot setup crypto session "
+				G_ELI_DEBUG(1, "Cannot set up crypto session "
 				    "for %s (error=%d).", bpp->name, error);
 			}
 			goto failed;
@@ -853,7 +853,7 @@
 	if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)) {
 		if (force) {
 			G_ELI_DEBUG(1, "Device %s is still open, so it "
-			    "can't be definitely removed.", pp->name);
+			    "cannot be definitely removed.", pp->name);
 		} else {
 			G_ELI_DEBUG(1,
 			    "Device %s is still open (r%dw%de%d).", pp->name,

==== //depot/projects/arm/src/sys/i386/i386/mp_machdep.c#6 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/mp_machdep.c,v 1.261 2005/12/22 22:16:06 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/mp_machdep.c,v 1.262 2006/02/07 21:22:01 phk Exp $");
 
 #include "opt_apic.h"
 #include "opt_cpu.h"
@@ -631,7 +631,7 @@
 	spinlock_exit();
 	KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count"));
 
-	binuptime(PCPU_PTR(switchtime));
+	PCPU_SET(switchtime, cpu_ticks());
 	PCPU_SET(switchticks, ticks);
 
 	cpu_throw(NULL, choosethread());	/* doesn't return */

==== //depot/projects/arm/src/sys/ia64/ia64/mp_machdep.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/ia64/ia64/mp_machdep.c,v 1.58 2005/09/03 23:53:49 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/ia64/ia64/mp_machdep.c,v 1.59 2006/02/07 21:22:01 phk Exp $");
 
 #include "opt_kstack_pages.h"
 
@@ -138,7 +138,7 @@
 	spinlock_exit();
 	KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count"));
 
-	binuptime(PCPU_PTR(switchtime));
+	PCPU_SET(switchtime, cpu_ticks());
 	PCPU_SET(switchticks, ticks);
 
 	ia64_set_tpr(0);

==== //depot/projects/arm/src/sys/kern/init_main.c#5 (text+ko) ====

@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/init_main.c,v 1.261 2006/02/06 16:03:10 cognet Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/init_main.c,v 1.262 2006/02/07 21:22:01 phk Exp $");
 
 #include "opt_init_path.h"
 #include "opt_mac.h"
@@ -459,11 +459,10 @@
 	sx_slock(&allproc_lock);
 	LIST_FOREACH(p, &allproc, p_list) {
 		microuptime(&p->p_stats->p_start);
-		p->p_rux.rux_runtime.sec = 0;
-		p->p_rux.rux_runtime.frac = 0;
+		p->p_rux.rux_runtime = 0;
 	}
 	sx_sunlock(&allproc_lock);
-	binuptime(PCPU_PTR(switchtime));
+	PCPU_SET(switchtime, cpu_ticks());
 	PCPU_SET(switchticks, ticks);
 
 	/*

==== //depot/projects/arm/src/sys/kern/kern_acct.c#6 (text+ko) ====

@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_acct.c,v 1.79 2006/02/07 16:04:03 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_acct.c,v 1.80 2006/02/07 18:59:47 jhb Exp $");
 
 #include "opt_mac.h"
 
@@ -122,8 +122,29 @@
 	&acctresume, 0, "percentage of free disk space above which accounting resumes");
 
 static int acctchkfreq = 15;	/* frequency (in seconds) to check space */
-SYSCTL_INT(_kern, OID_AUTO, acct_chkfreq, CTLFLAG_RW,
-	&acctchkfreq, 0, "frequency for checking the free space");
+
+static int
+sysctl_acct_chkfreq(SYSCTL_HANDLER_ARGS)
+{
+	int error, value;
+
+	/* Write out the old value. */
+	error = SYSCTL_OUT(req, &acctchkfreq, sizeof(int));
+	if (error || req->newptr == NULL)
+		return (error);
+
+	/* Read in and verify the new value. */
+	error = SYSCTL_IN(req, &value, sizeof(int));
+	if (error)
+		return (error);
+	if (value <= 0)
+		return (EINVAL);
+	acctchkfreq = value;
+	return (0);
+}
+SYSCTL_PROC(_kern, OID_AUTO, acct_chkfreq, CTLTYPE_INT|CTLFLAG_RW,
+    &acctchkfreq, 0, sysctl_acct_chkfreq, "I",
+    "frequency for checking the free space");
 
 SYSCTL_INT(_kern, OID_AUTO, acct_suspended, CTLFLAG_RD, &acct_suspended, 0,
 	"Accounting suspended or not");

==== //depot/projects/arm/src/sys/kern/kern_exit.c#10 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.281 2006/02/06 21:56:13 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.282 2006/02/07 21:22:01 phk Exp $");
 
 #include "opt_compat.h"
 #include "opt_ktrace.h"
@@ -110,7 +110,7 @@
 void
 exit1(struct thread *td, int rv)
 {
-	struct bintime new_switchtime;
+	uint64_t new_switchtime;
 	struct proc *p, *nq, *q;
 	struct tty *tp;
 	struct vnode *ttyvp;
@@ -543,9 +543,8 @@
 	ruadd(p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
 
 	/* Do the same timestamp bookkeeping that mi_switch() would do. */
-	binuptime(&new_switchtime);
-	bintime_add(&p->p_rux.rux_runtime, &new_switchtime);
-	bintime_sub(&p->p_rux.rux_runtime, PCPU_PTR(switchtime));
+	new_switchtime = cpu_ticks();
+	p->p_rux.rux_runtime += (new_switchtime - PCPU_GET(switchtime));
 	PCPU_SET(switchtime, new_switchtime);
 	PCPU_SET(switchticks, ticks);
 	cnt.v_swtch++;

==== //depot/projects/arm/src/sys/kern/kern_proc.c#6 (text+ko) ====

@@ -27,11 +27,11 @@
  * SUCH DAMAGE.
  *
  *	@(#)kern_proc.c	8.7 (Berkeley) 2/14/95
- * $FreeBSD: src/sys/kern/kern_proc.c,v 1.238 2006/01/18 20:27:43 julian Exp $
+ * $FreeBSD: src/sys/kern/kern_proc.c,v 1.239 2006/02/07 21:22:02 phk Exp $
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.238 2006/01/18 20:27:43 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.239 2006/02/07 21:22:02 phk Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_kstack_pages.h"
@@ -624,7 +624,6 @@
 	struct thread *td0;
 	struct tty *tp;
 	struct session *sp;
-	struct timeval tv;
 	struct ucred *cred;
 	struct sigacts *ps;
 
@@ -695,8 +694,7 @@
 	kp->ki_swtime = p->p_swtime;
 	kp->ki_pid = p->p_pid;
 	kp->ki_nice = p->p_nice;
-	bintime2timeval(&p->p_rux.rux_runtime, &tv);
-	kp->ki_runtime = tv.tv_sec * (u_int64_t)1000000 + tv.tv_usec;
+	kp->ki_runtime = p->p_rux.rux_runtime * 1000000 / cpu_tickrate();
 	mtx_unlock_spin(&sched_lock);
 	if ((p->p_sflag & PS_INMEM) && p->p_stats != NULL) {
 		kp->ki_start = p->p_stats->p_start;

==== //depot/projects/arm/src/sys/kern/kern_resource.c#4 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_resource.c,v 1.152 2006/01/25 02:05:47 ups Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_resource.c,v 1.153 2006/02/07 21:22:02 phk Exp $");
 
 #include "opt_compat.h"
 
@@ -704,7 +704,7 @@
 	struct timeval *up;
 	struct timeval *sp;
 {
-	struct bintime bt;
+	uint64_t bt;
 	struct rusage_ext rux;
 	struct thread *td;
 	int bt_valid;
@@ -712,6 +712,7 @@
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 	mtx_assert(&sched_lock, MA_NOTOWNED);
 	bt_valid = 0;
+	bt = 0;
 	mtx_lock_spin(&sched_lock);
 	rux = p->p_rux;
 	FOREACH_THREAD_IN_PROC(p, td) {
@@ -725,12 +726,16 @@
 			KASSERT(td->td_oncpu != NOCPU,
 			    ("%s: running thread has no CPU", __func__));
 			if (!bt_valid) {
-				binuptime(&bt);
+				bt = cpu_ticks();
 				bt_valid = 1;
 			}
-			bintime_add(&rux.rux_runtime, &bt);
-			bintime_sub(&rux.rux_runtime,
-			    &pcpu_find(td->td_oncpu)->pc_switchtime);
+			/*
+			 * XXX: Doesn't this mean that this quantum will
+			 * XXX: get counted twice if calcru() is called
+			 * XXX: from SIGINFO ?
+			 */
+			rux.rux_runtime +=
+			    (bt - pcpu_find(td->td_oncpu)->pc_switchtime);
 		}
 	}
 	mtx_unlock_spin(&sched_lock);
@@ -758,7 +763,6 @@
 	struct timeval *up;
 	struct timeval *sp;
 {
-	struct timeval tv;
 	/* {user, system, interrupt, total} {ticks, usec}; previous tu: */
 	u_int64_t ut, uu, st, su, it, iu, tt, tu, ptu;
 
@@ -770,8 +774,7 @@
 		st = 1;
 		tt = 1;
 	}
-	bintime2timeval(&ruxp->rux_runtime, &tv);
-	tu = (u_int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
+	tu = (ruxp->rux_runtime * 1000000LL) / cpu_tickrate();
 	ptu = ruxp->rux_uu + ruxp->rux_su + ruxp->rux_iu;
 	if (tu < ptu) {
 		printf(
@@ -884,7 +887,7 @@
 	register long *ip, *ip2;
 	register int i;
 
-	bintime_add(&rux->rux_runtime, &rux2->rux_runtime);
+	rux->rux_runtime += rux2->rux_runtime;
 	rux->rux_uticks += rux2->rux_uticks;
 	rux->rux_sticks += rux2->rux_sticks;
 	rux->rux_iticks += rux2->rux_iticks;

==== //depot/projects/arm/src/sys/kern/kern_synch.c#5 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_synch.c,v 1.273 2005/12/29 21:15:32 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_synch.c,v 1.274 2006/02/07 21:22:02 phk Exp $");
 
 #include "opt_ktrace.h"
 
@@ -355,7 +355,7 @@
 void
 mi_switch(int flags, struct thread *newtd)
 {
-	struct bintime new_switchtime;
+	uint64_t new_switchtime;
 	struct thread *td;
 	struct proc *p;
 
@@ -384,9 +384,8 @@
 	 * Compute the amount of time during which the current
 	 * process was running, and add that to its total so far.
 	 */
-	binuptime(&new_switchtime);
-	bintime_add(&p->p_rux.rux_runtime, &new_switchtime);
-	bintime_sub(&p->p_rux.rux_runtime, PCPU_PTR(switchtime));
+	new_switchtime = cpu_ticks();
+	p->p_rux.rux_runtime += (new_switchtime - PCPU_GET(switchtime));
 
 	td->td_generation++;	/* bump preempt-detect counter */
 
@@ -405,7 +404,7 @@
 	 * it reaches the max, arrange to kill the process in ast().
 	 */
 	if (p->p_cpulimit != RLIM_INFINITY &&
-	    p->p_rux.rux_runtime.sec >= p->p_cpulimit) {
+	    p->p_rux.rux_runtime >= p->p_cpulimit * cpu_tickrate()) {
 		p->p_sflag |= PS_XCPU;
 		td->td_flags |= TDF_ASTPENDING;
 	}

==== //depot/projects/arm/src/sys/kern/kern_tc.c#3 (text+ko) ====

@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.167 2006/02/07 21:22:02 phk Exp $");
 
 #include "opt_ntp.h"
 
@@ -131,6 +131,7 @@
 #endif
 		return SYSCTL_OUT(req, &boottime, sizeof(boottime));
 }
+
 /*
  * Return the difference between the timehands' counter value now and what
  * was when we copied it to the timehands' offset_count.
@@ -782,3 +783,23 @@
 }
 
 SYSINIT(timecounter, SI_SUB_CLOCKS, SI_ORDER_SECOND, inittimecounter, NULL)
+
+static
+uint64_t
+tc_cpu_ticks(void)
+{
+	static uint64_t base;
+	static unsigned last;
+	uint64_t u;
+	struct timecounter *tc;
+
+	tc = timehands->th_counter;
+	u = tc->tc_get_timecount(tc) & tc->tc_counter_mask;
+	if (u < last)
+		base += tc->tc_counter_mask + 1;
+	last = u;
+	return (u + base);
+}
+
+uint64_t (*cpu_ticks)(void) = tc_cpu_ticks;
+uint64_t (*cpu_tickrate)(void) = tc_getfrequency;

==== //depot/projects/arm/src/sys/kern/subr_trap.c#3 (text+ko) ====

@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/subr_trap.c,v 1.283 2005/11/13 13:27:44 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/subr_trap.c,v 1.284 2006/02/07 21:22:02 phk Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_mac.h"
@@ -238,7 +238,7 @@
 		PROC_LOCK(p);
 		lim_rlimit(p, RLIMIT_CPU, &rlim);
 		mtx_lock_spin(&sched_lock);
-		if (p->p_rux.rux_runtime.sec >= rlim.rlim_max) {
+		if (p->p_rux.rux_runtime >= rlim.rlim_max * cpu_tickrate()) {
 			mtx_unlock_spin(&sched_lock);
 			killproc(p, "exceeded maximum CPU limit");
 		} else {

==== //depot/projects/arm/src/sys/modules/arcnet/Makefile#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/modules/arcnet/Makefile,v 1.4 2005/10/14 23:30:07 yar Exp $
+# $FreeBSD: src/sys/modules/arcnet/Makefile,v 1.5 2006/02/07 18:13:56 yar Exp $
 
 .PATH: ${.CURDIR}/../../net
 
@@ -17,9 +17,12 @@
 		arc_storelladdr
 
 .if !defined(KERNBUILDDIR)
-opt_inet.h opt_inet6.h:
+opt_inet.h:
 	echo "#define INET 1" > ${.TARGET}
 
+opt_inet6.h:
+	echo "#define INET6 1" > ${.TARGET}
+
 opt_ipx.h:
 	echo "#define IPX 1" > ${.TARGET}
 .endif

==== //depot/projects/arm/src/sys/net/if_gre.c#4 (text+ko) ====

@@ -612,9 +612,9 @@
 			error = EINVAL;
 			break;
 		}
-		sc->g_src = (satosin((struct sockadrr *)&lifr->addr))->sin_addr;
+		sc->g_src = (satosin(&lifr->addr))->sin_addr;
 		sc->g_dst =
-		    (satosin((struct sockadrr *)&lifr->dstaddr))->sin_addr;
+		    (satosin(&lifr->dstaddr))->sin_addr;
 		goto recompute;
 	case SIOCDIFPHYADDR:
 		if ((error = suser(curthread)) != 0)

==== //depot/projects/arm/src/sys/net/radix.c#2 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)radix.c	8.5 (Berkeley) 5/19/95
- * $FreeBSD: src/sys/net/radix.c,v 1.37 2005/01/07 01:45:35 imp Exp $
+ * $FreeBSD: src/sys/net/radix.c,v 1.38 2006/02/07 20:25:39 qingli Exp $
  */
 
 /*
@@ -1006,7 +1006,7 @@
 			rn = rn->rn_parent;
 
 			/* if went up beyond last, stop */
-			if (rn->rn_bit < lastb) {
+			if (rn->rn_bit <= lastb) {
 				stopping = 1;
 				/* printf("up too far\n"); */
 				/*
@@ -1018,6 +1018,14 @@
 				 */
 			}
 		}
+		
+		/* 
+		 * At the top of the tree, no need to traverse the right
+		 * half, prevent the traversal of the entire tree in the
+		 * case of default route.
+		 */
+		if (rn->rn_parent->rn_flags & RNF_ROOT)
+			stopping = 1;
 
 		/* Find the next *leaf* since next node might vanish, too */
 		for (rn = rn->rn_parent->rn_right; rn->rn_bit >= 0;)

==== //depot/projects/arm/src/sys/netinet/tcp_syncache.c#6 (text+ko) ====

@@ -28,7 +28,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/netinet/tcp_syncache.c,v 1.81 2006/01/18 18:25:03 andre Exp $
+ * $FreeBSD: src/sys/netinet/tcp_syncache.c,v 1.82 2006/02/07 19:59:46 qingli Exp $
  */
 
 #include "opt_inet.h"
@@ -1386,6 +1386,7 @@
 	 * Fill in the syncache values.
 	 * XXX duplicate code from syncache_add
 	 */
+	bzero(sc, sizeof(*sc));
 	sc->sc_ipopts = NULL;
 	sc->sc_inc.inc_fport = inc->inc_fport;
 	sc->sc_inc.inc_lport = inc->inc_lport;

==== //depot/projects/arm/src/sys/security/audit/audit.c#4 (text) ====

@@ -27,7 +27,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/security/audit/audit.c,v 1.5 2006/02/06 22:50:39 rwatson Exp $
+ * $FreeBSD: src/sys/security/audit/audit.c,v 1.6 2006/02/07 23:44:31 rwatson Exp $
  */
 
 #include <sys/param.h>
@@ -282,7 +282,9 @@
 	if (ret)
 		goto out;
 
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
 	ret = VOP_GETATTR(vp, &vattr, cred, td);
+	VOP_UNLOCK(vp, 0, td);
 	if (ret)
 		goto out;
 

==== //depot/projects/arm/src/sys/sparc64/sparc64/mp_machdep.c#3 (text+ko) ====

@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/mp_machdep.c,v 1.30 2005/11/03 21:08:20 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/mp_machdep.c,v 1.31 2006/02/07 21:22:02 phk Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -361,7 +361,7 @@
 	/* ok, now grab sched_lock and enter the scheduler */
 	mtx_lock_spin(&sched_lock);
 	spinlock_exit();
-	binuptime(PCPU_PTR(switchtime));
+	PCPU_SET(switchtime, cpu_ticks());
 	PCPU_SET(switchticks, ticks);
 	cpu_throw(NULL, choosethread());	/* doesn't return */
 }

==== //depot/projects/arm/src/sys/sparc64/sparc64/tick.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/tick.c,v 1.18 2005/12/22 22:16:09 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/tick.c,v 1.19 2006/02/07 21:22:02 phk Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -65,6 +65,20 @@
 
 static void tick_hardclock(struct trapframe *);
 
+static uint64_t
+tick_cputicks(void)
+{
+
+	return (rd(tick));
+}
+
+static uint64_t
+tick_cputickrate(void)
+{
+
+	return (tick_freq);
+}
+
 void
 cpu_initclocks(void)
 {
@@ -156,6 +170,9 @@
 	 * handled.
 	 */
 	tick_stop();
+
+	cpu_ticks = tick_cputicks;
+	cpu_tickrate = tick_cputickrate;
 }
 
 void

==== //depot/projects/arm/src/sys/sys/pcpu.h#3 (text+ko) ====

@@ -27,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/pcpu.h,v 1.16 2005/04/26 17:07:40 jhb Exp $
+ * $FreeBSD: src/sys/sys/pcpu.h,v 1.17 2006/02/07 21:22:02 phk Exp $
  */
 
 #ifndef _SYS_PCPU_H_
@@ -60,7 +60,7 @@
 	struct thread	*pc_fpcurthread;	/* Fp state owner */
 	struct thread	*pc_deadthread;		/* Zombie thread or NULL */
 	struct pcb	*pc_curpcb;		/* Current pcb */
-	struct bintime	pc_switchtime;	
+	uint64_t	pc_switchtime;	
 	int		pc_switchticks;
 	u_int		pc_cpuid;		/* This cpu number */
 	cpumask_t	pc_cpumask;		/* This cpu mask */

==== //depot/projects/arm/src/sys/sys/proc.h#7 (text+ko) ====

@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)proc.h	8.15 (Berkeley) 5/19/95
- * $FreeBSD: src/sys/sys/proc.h,v 1.449 2006/02/02 00:37:05 rwatson Exp $
+ * $FreeBSD: src/sys/sys/proc.h,v 1.450 2006/02/07 21:22:02 phk Exp $
  */
 
 #ifndef _SYS_PROC_H_
@@ -505,7 +505,7 @@
  * Locking: (cj) means (j) for p_rux and (c) for p_crux.
  */
 struct rusage_ext {
-	struct bintime	rux_runtime;    /* (cj) Real time. */
+	u_int64_t	rux_runtime;    /* (cj) Real time. */
 	u_int64_t	rux_uticks;     /* (cj) Statclock hits in user mode. */
 	u_int64_t	rux_sticks;     /* (cj) Statclock hits in sys mode. */
 	u_int64_t	rux_iticks;     /* (cj) Statclock hits in intr mode. */

==== //depot/projects/arm/src/sys/sys/systm.h#9 (text+ko) ====

@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)systm.h	8.7 (Berkeley) 3/29/95
- * $FreeBSD: src/sys/sys/systm.h,v 1.238 2006/02/06 10:11:59 jeff Exp $
+ * $FreeBSD: src/sys/sys/systm.h,v 1.239 2006/02/07 21:22:02 phk Exp $
  */
 
 #ifndef _SYS_SYSTM_H_
@@ -238,6 +238,9 @@
 int	unsetenv(const char *name);
 int	testenv(const char *name);
 
+extern uint64_t	(*cpu_ticks)(void);
+extern uint64_t	(*cpu_tickrate)(void);
+
 #ifdef APM_FIXUP_CALLTODO
 struct timeval;
 void	adjust_timeout_calltodo(struct timeval *time_change);


More information about the p4-projects mailing list