PERFORCE change 42148 for review

Sam Leffler sam at FreeBSD.org
Wed Nov 12 10:53:38 PST 2003


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

Change 42148 by sam at sam_ebb on 2003/11/12 10:53:13

	IFC

Affected files ...

.. //depot/projects/netperf/sys/boot/sparc64/loader/metadata.c#2 integrate
.. //depot/projects/netperf/sys/conf/files#24 integrate
.. //depot/projects/netperf/sys/crypto/rijndael/rijndael.c#1 branch
.. //depot/projects/netperf/sys/crypto/rijndael/rijndael.h#2 integrate
.. //depot/projects/netperf/sys/dev/acpica/Osd/OsdInterrupt.c#2 integrate
.. //depot/projects/netperf/sys/dev/acpica/acpivar.h#5 integrate
.. //depot/projects/netperf/sys/dev/sound/pcm/ac97.c#7 integrate
.. //depot/projects/netperf/sys/i386/acpica/madt.c#5 integrate
.. //depot/projects/netperf/sys/i386/i386/mptable.c#5 integrate
.. //depot/projects/netperf/sys/kern/kern_mutex.c#3 integrate
.. //depot/projects/netperf/sys/kern/kern_thread.c#7 integrate
.. //depot/projects/netperf/sys/kern/subr_turnstile.c#1 branch
.. //depot/projects/netperf/sys/kern/subr_witness.c#6 integrate
.. //depot/projects/netperf/sys/modules/mac_stub/Makefile#2 integrate
.. //depot/projects/netperf/sys/net/if_loop.c#13 integrate
.. //depot/projects/netperf/sys/netinet/tcp_syncache.c#12 integrate
.. //depot/projects/netperf/sys/netinet6/esp_rijndael.c#3 integrate
.. //depot/projects/netperf/sys/netipsec/ipsec_osdep.h#4 integrate
.. //depot/projects/netperf/sys/pci/agp.c#4 integrate
.. //depot/projects/netperf/sys/pci/agp_ali.c#3 integrate
.. //depot/projects/netperf/sys/sys/_mutex.h#2 integrate
.. //depot/projects/netperf/sys/sys/filedesc.h#2 integrate
.. //depot/projects/netperf/sys/sys/proc.h#11 integrate
.. //depot/projects/netperf/sys/sys/turnstile.h#1 branch

Differences ...

==== //depot/projects/netperf/sys/boot/sparc64/loader/metadata.c#2 (text+ko) ====

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  *	from: FreeBSD: src/sys/boot/i386/libi386/bootinfo.c,v 1.29
- * $FreeBSD: src/sys/boot/sparc64/loader/metadata.c,v 1.9 2003/04/30 22:00:16 peter Exp $
+ * $FreeBSD: src/sys/boot/sparc64/loader/metadata.c,v 1.10 2003/11/11 18:01:44 jake Exp $
  */
 
 #include <stand.h>
@@ -67,6 +67,8 @@
 int
 md_getboothowto(char *kargs)
 {
+    char	buf[32];
+    phandle_t	options;
     char	*cp;
     int		howto;
     int		active;
@@ -126,10 +128,10 @@
     for (i = 0; howto_names[i].ev != NULL; i++)
 	if (getenv(howto_names[i].ev) != NULL)
 	    howto |= howto_names[i].mask;
-    if (!strcmp(getenv("console"), "comconsole"))
-	howto |= RB_SERIAL;
-    if (!strcmp(getenv("console"), "nullconsole"))
-	howto |= RB_MUTE;
+    options = OF_finddevice("/options");
+    OF_getprop(options, "output-device", buf, sizeof(buf));
+    if (strcmp(buf, "ttya") == 0 || strcmp(buf, "ttyb") == 0)
+	    howto |= RB_SERIAL;
     return(howto);
 }
 

==== //depot/projects/netperf/sys/conf/files#24 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.846 2003/11/10 10:39:14 ume Exp $
+# $FreeBSD: src/sys/conf/files,v 1.848 2003/11/11 22:07:29 jhb Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -207,7 +207,7 @@
 crypto/des/des_ecb.c	optional ipsec ipsec_esp
 crypto/des/des_setkey.c	optional ipsec ipsec_esp
 crypto/rijndael/rijndael-alg-fst.c	optional ipsec
-crypto/rijndael/rijndael-api-fst.c	optional ipsec
+crypto/rijndael/rijndael.c	optional ipsec
 opencrypto/rmd160.c	optional ipsec
 crypto/sha1.c		optional ipsec
 crypto/sha2/sha2.c	optional ipsec
@@ -1155,6 +1155,7 @@
 kern/subr_smp.c		optional smp
 kern/subr_taskqueue.c	standard
 kern/subr_trap.c	standard
+kern/subr_turnstile.c	standard
 kern/subr_witness.c	optional witness
 kern/sys_generic.c	standard
 kern/sys_pipe.c		standard

==== //depot/projects/netperf/sys/crypto/rijndael/rijndael.h#2 (text+ko) ====

@@ -1,3 +1,52 @@
-/*	$KAME: rijndael.h,v 1.2 2000/10/02 17:14:27 itojun Exp $	*/
+/*	$KAME: rijndael.h,v 1.6 2003/08/28 08:36:32 itojun Exp $	*/
+/*	$FreeBSD: src/sys/crypto/rijndael/rijndael.h,v 1.2 2003/11/11 18:58:53 ume Exp $	*/
+
+/**
+ * rijndael-alg-fst.h
+ *
+ * @version 3.0 (December 2000)
+ *
+ * Optimised ANSI C code for the Rijndael cipher (now AES)
+ *
+ * @author Vincent Rijmen <vincent.rijmen at esat.kuleuven.ac.be>
+ * @author Antoon Bosselaers <antoon.bosselaers at esat.kuleuven.ac.be>
+ * @author Paulo Barreto <paulo.barreto at terra.com.br>
+ *
+ * This code is hereby placed in the public domain.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __RIJNDAEL_H
+#define	__RIJNDAEL_H
 
+#include <crypto/rijndael/rijndael-alg-fst.h>
 #include <crypto/rijndael/rijndael-api-fst.h>
+
+/* XXX: avoid conflicts with opencrypto */
+#define	rijndael_set_key	_rijndael_set_key
+#define	rijndael_decrypt	_rijndael_decrypt
+#define	rijndael_encrypt	_rijndael_encrypt
+
+typedef struct {
+	int	decrypt;
+	int	Nr;		/* key-length-dependent number of rounds */
+	uint32_t ek[4 * (RIJNDAEL_MAXNR + 1)];	/* encrypt key schedule */
+	uint32_t dk[4 * (RIJNDAEL_MAXNR + 1)];	/* decrypt key schedule */
+} rijndael_ctx;
+
+void	rijndael_set_key(rijndael_ctx *, const u_char *, int);
+void	rijndael_decrypt(const rijndael_ctx *, const u_char *, u_char *);
+void	rijndael_encrypt(const rijndael_ctx *, const u_char *, u_char *);
+
+#endif /* __RIJNDAEL_H */

==== //depot/projects/netperf/sys/dev/acpica/Osd/OsdInterrupt.c#2 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/acpica/Osd/OsdInterrupt.c,v 1.12 2002/10/16 17:28:53 jhb Exp $
+ *	$FreeBSD: src/sys/dev/acpica/Osd/OsdInterrupt.c,v 1.13 2003/11/11 18:12:12 jhb Exp $
  */
 
 /*
@@ -46,6 +46,8 @@
 static void		InterruptWrapper(void *arg);
 static OSD_HANDLER	InterruptHandler;
 
+static UINT32 InterruptOverride = 0;
+
 /*
  * XXX this does not correctly free resources in the case of partically successful
  * attachment.
@@ -81,6 +83,12 @@
 	return_ACPI_STATUS(AE_ALREADY_EXISTS);
     }
     sc->acpi_irq_rid = 0;
+    if (InterruptOverride != 0) {
+	    device_printf(sc->acpi_dev,
+		"Overriding SCI Interrupt from IRQ %u to IRQ %u\n",
+		InterruptNumber, InterruptOverride);
+	    InterruptNumber = InterruptOverride;
+    }
     bus_set_resource(sc->acpi_dev, SYS_RES_IRQ, 0, InterruptNumber, 1);
     if ((sc->acpi_irq = bus_alloc_resource(sc->acpi_dev, SYS_RES_IRQ, &sc->acpi_irq_rid, 0, ~0, 1, 
 					   RF_SHAREABLE | RF_ACTIVE)) == NULL) {
@@ -123,6 +131,16 @@
     return_ACPI_STATUS(AE_OK);
 }
 
+ACPI_STATUS
+acpi_OverrideInterruptLevel(UINT32 InterruptNumber)
+{
+
+	if (InterruptOverride != 0)
+		return_ACPI_STATUS(AE_ALREADY_EXISTS);
+	InterruptOverride = InterruptNumber;
+	return_ACPI_STATUS(AE_OK);
+}
+
 /*
  * Interrupt handler wrapper.
  */

==== //depot/projects/netperf/sys/dev/acpica/acpivar.h#5 (text+ko) ====

@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/acpica/acpivar.h,v 1.46 2003/10/25 05:03:24 njl Exp $
+ *	$FreeBSD: src/sys/dev/acpica/acpivar.h,v 1.47 2003/11/11 18:12:12 jhb Exp $
  */
 
 #include "bus_if.h"
@@ -184,6 +184,7 @@
 						 ACPI_RESOURCE **resp);
 extern ACPI_STATUS	acpi_AppendBufferResource(ACPI_BUFFER *buf,
 						  ACPI_RESOURCE *res);
+extern ACPI_STATUS	acpi_OverrideInterruptLevel(UINT32 InterruptNumber);
 extern ACPI_STATUS	acpi_SetIntrModel(int model);
 extern ACPI_STATUS	acpi_SetSleepState(struct acpi_softc *sc, int state);
 extern ACPI_STATUS	acpi_Enable(struct acpi_softc *sc);

==== //depot/projects/netperf/sys/dev/sound/pcm/ac97.c#7 (text+ko) ====

@@ -30,7 +30,7 @@
 
 #include "mixer_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/ac97.c,v 1.48 2003/10/12 11:51:24 des Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/ac97.c,v 1.49 2003/11/11 22:15:17 kuriyama Exp $");
 
 MALLOC_DEFINE(M_AC97, "ac97", "ac97 codec");
 
@@ -138,6 +138,7 @@
 	{ 0x414c4740, 0x0f, 0, "ALC202", 	0 },
 	{ 0x414c4720, 0x0f, 0, "ALC650", 	0 },
 	{ 0x414c4760, 0x0f, 0, "ALC655",	0 },
+	{ 0x414c4780, 0x0f, 0, "ALC658",	0 },
 	{ 0x43525900, 0x07, 0, "CS4297", 	0 },
 	{ 0x43525910, 0x07, 0, "CS4297A", 	0 },
 	{ 0x43525920, 0x07, 0, "CS4294/98",	0 },

==== //depot/projects/netperf/sys/i386/acpica/madt.c#5 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/acpica/madt.c,v 1.5 2003/11/10 19:52:57 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/acpica/madt.c,v 1.6 2003/11/11 18:20:10 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -536,7 +536,12 @@
 	}
 
 	if (intr->Source != intr->GlobalSystemInterrupt) {
-		ioapic_remap_vector(new_ioapic, new_pin, intr->Source);
+		/* XXX: This assumes that the SCI uses IRQ 9. */
+		if (intr->GlobalSystemInterrupt > 15 && intr->Source == 9)
+			acpi_OverrideInterruptLevel(
+				intr->GlobalSystemInterrupt);
+		else
+			ioapic_remap_vector(new_ioapic, new_pin, intr->Source);
 		if (madt_find_interrupt(intr->Source, &old_ioapic,
 		    &old_pin) != 0)
 			printf("MADT: Could not find APIC for source IRQ %d\n",

==== //depot/projects/netperf/sys/i386/i386/mptable.c#5 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/mptable.c,v 1.224 2003/11/11 17:14:26 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/mptable.c,v 1.225 2003/11/11 21:19:43 jhb Exp $");
 
 #include "opt_mptable_force_htt.h"
 #include <sys/param.h>
@@ -893,6 +893,8 @@
 		return (EINVAL);
 	if (pci0 == -1 || pci0 + bus > mptable_maxbusid)
 		return (ENXIO);
+	if (busses[pci0 + bus].bus_type != PCI)
+		return (ENXIO);
 	args.bus = pci0 + bus;
 	args.found = 0;
 	mptable_walk_table(mptable_pci_probe_table_handler, &args);

==== //depot/projects/netperf/sys/kern/kern_mutex.c#3 (text+ko) ====

@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.131 2003/07/31 18:52:18 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.132 2003/11/11 22:07:29 jhb Exp $");
 
 #include "opt_adaptive_mutexes.h"
 #include "opt_ddb.h"
@@ -52,6 +52,7 @@
 #include <sys/sched.h>
 #include <sys/sbuf.h>
 #include <sys/sysctl.h>
+#include <sys/turnstile.h>
 #include <sys/vmmeter.h>
 
 #include <machine/atomic.h>
@@ -90,122 +91,6 @@
 struct mtx sched_lock;
 struct mtx Giant;
 
-/*
- * Prototypes for non-exported routines.
- */
-static void	propagate_priority(struct thread *);
-
-static void
-propagate_priority(struct thread *td)
-{
-	int pri = td->td_priority;
-	struct mtx *m = td->td_blocked;
-
-	mtx_assert(&sched_lock, MA_OWNED);
-	for (;;) {
-		struct thread *td1;
-
-		td = mtx_owner(m);
-
-		if (td == NULL) {
-			/*
-			 * This really isn't quite right. Really
-			 * ought to bump priority of thread that
-			 * next acquires the mutex.
-			 */
-			MPASS(m->mtx_lock == MTX_CONTESTED);
-			return;
-		}
-
-		MPASS(td->td_proc != NULL);
-		MPASS(td->td_proc->p_magic == P_MAGIC);
-		KASSERT(!TD_IS_SLEEPING(td), (
-		    "sleeping thread (pid %d) owns a mutex",
-		    td->td_proc->p_pid));
-		if (td->td_priority <= pri) /* lower is higher priority */
-			return;
-
-
-		/*
-		 * If lock holder is actually running, just bump priority.
-		 */
-		if (TD_IS_RUNNING(td)) {
-			td->td_priority = pri;
-			return;
-		}
-
-#ifndef SMP
-		/*
-		 * For UP, we check to see if td is curthread (this shouldn't
-		 * ever happen however as it would mean we are in a deadlock.)
-		 */
-		KASSERT(td != curthread, ("Deadlock detected"));
-#endif
-
-		/*
-		 * If on run queue move to new run queue, and quit.
-		 * XXXKSE this gets a lot more complicated under threads
-		 * but try anyhow.
-		 */
-		if (TD_ON_RUNQ(td)) {
-			MPASS(td->td_blocked == NULL);
-			sched_prio(td, pri);
-			return;
-		}
-		/*
-		 * Adjust for any other cases.
-		 */
-		td->td_priority = pri;
-
-		/*
-		 * If we aren't blocked on a mutex, we should be.
-		 */
-		KASSERT(TD_ON_LOCK(td), (
-		    "process %d(%s):%d holds %s but isn't blocked on a mutex\n",
-		    td->td_proc->p_pid, td->td_proc->p_comm, td->td_state,
-		    m->mtx_object.lo_name));
-
-		/*
-		 * Pick up the mutex that td is blocked on.
-		 */
-		m = td->td_blocked;
-		MPASS(m != NULL);
-
-		/*
-		 * Check if the thread needs to be moved up on
-		 * the blocked chain
-		 */
-		if (td == TAILQ_FIRST(&m->mtx_blocked)) {
-			continue;
-		}
-
-		td1 = TAILQ_PREV(td, threadqueue, td_lockq);
-		if (td1->td_priority <= pri) {
-			continue;
-		}
-
-		/*
-		 * Remove thread from blocked chain and determine where
-		 * it should be moved up to.  Since we know that td1 has
-		 * a lower priority than td, we know that at least one
-		 * thread in the chain has a lower priority and that
-		 * td1 will thus not be NULL after the loop.
-		 */
-		TAILQ_REMOVE(&m->mtx_blocked, td, td_lockq);
-		TAILQ_FOREACH(td1, &m->mtx_blocked, td_lockq) {
-			MPASS(td1->td_proc->p_magic == P_MAGIC);
-			if (td1->td_priority > pri)
-				break;
-		}
-
-		MPASS(td1 != NULL);
-		TAILQ_INSERT_BEFORE(td1, td, td_lockq);
-		CTR4(KTR_LOCK,
-		    "propagate_priority: p %p moved before %p on [%p] %s",
-		    td, td1, m, m->mtx_object.lo_name);
-	}
-}
-
 #ifdef MUTEX_PROFILING
 SYSCTL_NODE(_debug, OID_AUTO, mutex, CTLFLAG_RD, NULL, "mutex debugging");
 SYSCTL_NODE(_debug_mutex, OID_AUTO, prof, CTLFLAG_RD, NULL, "mutex profiling");
@@ -484,8 +369,8 @@
 void
 _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line)
 {
+	struct turnstile *ts;
 	struct thread *td = curthread;
-	struct thread *td1;
 #if defined(SMP) && defined(ADAPTIVE_MUTEXES)
 	struct thread *owner;
 #endif
@@ -509,15 +394,15 @@
 
 	while (!_obtain_lock(m, td)) {
 
-		mtx_lock_spin(&sched_lock);
+		ts = turnstile_lookup(&m->mtx_object);
 		v = m->mtx_lock;
 
 		/*
 		 * Check if the lock has been released while spinning for
-		 * the sched_lock.
+		 * the turnstile chain lock.
 		 */
 		if (v == MTX_UNOWNED) {
-			mtx_unlock_spin(&sched_lock);
+			turnstile_release(&m->mtx_object);
 #ifdef __i386__
 			ia32_pause();
 #endif
@@ -531,14 +416,9 @@
 		 * necessary.
 		 */
 		if (v == MTX_CONTESTED) {
-			td1 = TAILQ_FIRST(&m->mtx_blocked);
-			MPASS(td1 != NULL);
+			MPASS(ts != NULL);
 			m->mtx_lock = (uintptr_t)td | MTX_CONTESTED;
-			LIST_INSERT_HEAD(&td->td_contested, m, mtx_contested);
-
-			if (td1->td_priority < td->td_priority)
-				td->td_priority = td1->td_priority;
-			mtx_unlock_spin(&sched_lock);
+			turnstile_claim(ts);
 			return;
 		}
 
@@ -550,7 +430,7 @@
 		if ((v & MTX_CONTESTED) == 0 &&
 		    !atomic_cmpset_ptr(&m->mtx_lock, (void *)v,
 			(void *)(v | MTX_CONTESTED))) {
-			mtx_unlock_spin(&sched_lock);
+			turnstile_release(&m->mtx_object);
 #ifdef __i386__
 			ia32_pause();
 #endif
@@ -564,7 +444,7 @@
 		 */
 		owner = (struct thread *)(v & MTX_FLAGMASK);
 		if (m != &Giant && TD_IS_RUNNING(owner)) {
-			mtx_unlock_spin(&sched_lock);
+			turnstile_release(&m->mtx_object);
 			while (mtx_owner(m) == owner && TD_IS_RUNNING(owner)) {
 #ifdef __i386__
 				ia32_pause();
@@ -579,42 +459,6 @@
 		 */
 		mtx_assert(m, MA_NOTOWNED);
 
-#ifdef notyet
-		/*
-		 * If we're borrowing an interrupted thread's VM context, we
-		 * must clean up before going to sleep.
-		 */
-		if (td->td_ithd != NULL) {
-			struct ithd *it = td->td_ithd;
-
-			if (it->it_interrupted) {
-				if (LOCK_LOG_TEST(&m->mtx_object, opts))
-					CTR2(KTR_LOCK,
-				    "_mtx_lock_sleep: %p interrupted %p",
-					    it, it->it_interrupted);
-				intr_thd_fixup(it);
-			}
-		}
-#endif
-
-		/*
-		 * Put us on the list of threads blocked on this mutex
-		 * and add this mutex to the owning thread's list of
-		 * contested mutexes if needed.
-		 */
-		if (TAILQ_EMPTY(&m->mtx_blocked)) {
-			td1 = mtx_owner(m);
-			LIST_INSERT_HEAD(&td1->td_contested, m, mtx_contested);
-			TAILQ_INSERT_TAIL(&m->mtx_blocked, td, td_lockq);
-		} else {
-			TAILQ_FOREACH(td1, &m->mtx_blocked, td_lockq)
-				if (td1->td_priority > td->td_priority)
-					break;
-			if (td1)
-				TAILQ_INSERT_BEFORE(td1, td, td_lockq);
-			else
-				TAILQ_INSERT_TAIL(&m->mtx_blocked, td, td_lockq);
-		}
 #ifdef KTR
 		if (!cont_logged) {
 			CTR6(KTR_CONTENTION,
@@ -627,27 +471,9 @@
 #endif
 
 		/*
-		 * Save who we're blocked on.
+		 * Block on the turnstile.
 		 */
-		td->td_blocked = m;
-		td->td_lockname = m->mtx_object.lo_name;
-		TD_SET_LOCK(td);
-		propagate_priority(td);
-
-		if (LOCK_LOG_TEST(&m->mtx_object, opts))
-			CTR3(KTR_LOCK,
-			    "_mtx_lock_sleep: p %p blocked on [%p] %s", td, m,
-			    m->mtx_object.lo_name);
-
-		td->td_proc->p_stats->p_ru.ru_nvcsw++;
-		mi_switch();
-
-		if (LOCK_LOG_TEST(&m->mtx_object, opts))
-			CTR3(KTR_LOCK,
-			  "_mtx_lock_sleep: p %p free from blocked on [%p] %s",
-			  td, m, m->mtx_object.lo_name);
-
-		mtx_unlock_spin(&sched_lock);
+		turnstile_wait(ts, &m->mtx_object, mtx_owner(m));
 	}
 
 #ifdef KTR
@@ -724,11 +550,8 @@
 void
 _mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line)
 {
+	struct turnstile *ts;
 	struct thread *td, *td1;
-	struct mtx *m1;
-	int pri;
-
-	td = curthread;
 
 	if (mtx_recursed(m)) {
 		if (--(m->mtx_recurse) == 0)
@@ -738,57 +561,47 @@
 		return;
 	}
 
-	mtx_lock_spin(&sched_lock);
+	ts = turnstile_lookup(&m->mtx_object);
 	if (LOCK_LOG_TEST(&m->mtx_object, opts))
 		CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p contested", m);
 
-	td1 = TAILQ_FIRST(&m->mtx_blocked);
 #if defined(SMP) && defined(ADAPTIVE_MUTEXES)
-	if (td1 == NULL) {
+	if (ts == NULL) {
 		_release_lock_quick(m);
 		if (LOCK_LOG_TEST(&m->mtx_object, opts))
 			CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p no sleepers", m);
-		mtx_unlock_spin(&sched_lock);
+		turnstile_release(&m->mtx_object);
 		return;
 	}
+#else
+	MPASS(ts != NULL);
 #endif
-	MPASS(td->td_proc->p_magic == P_MAGIC);
-	MPASS(td1->td_proc->p_magic == P_MAGIC);
-
-	TAILQ_REMOVE(&m->mtx_blocked, td1, td_lockq);
-
-	LIST_REMOVE(m, mtx_contested);
-	if (TAILQ_EMPTY(&m->mtx_blocked)) {
+	/* XXX */
+	td1 = turnstile_head(ts);
+	if (turnstile_signal(ts)) {
 		_release_lock_quick(m);
 		if (LOCK_LOG_TEST(&m->mtx_object, opts))
 			CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p not held", m);
-	} else
+	} else {
 		m->mtx_lock = MTX_CONTESTED;
-
-	pri = PRI_MAX;
-	LIST_FOREACH(m1, &td->td_contested, mtx_contested) {
-		int cp = TAILQ_FIRST(&m1->mtx_blocked)->td_priority;
-		if (cp < pri)
-			pri = cp;
+		if (LOCK_LOG_TEST(&m->mtx_object, opts))
+			CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p still contested",
+			    m);
 	}
+	turnstile_unpend(ts);
 
-	if (pri > td->td_base_pri)
-		pri = td->td_base_pri;
-	td->td_priority = pri;
-
-	if (LOCK_LOG_TEST(&m->mtx_object, opts))
-		CTR2(KTR_LOCK, "_mtx_unlock_sleep: %p contested setrunqueue %p",
-		    m, td1);
-
-	td1->td_blocked = NULL;
-	TD_CLR_LOCK(td1);
-	if (!TD_CAN_RUN(td1)) {
-		mtx_unlock_spin(&sched_lock);
+	/*
+	 * XXX: This is just a hack until preemption is done.  However,
+	 * once preemption is done we need to either wrap the
+	 * turnstile_signal() and release of the actual lock in an
+	 * extra critical section or change the preemption code to
+	 * always just set a flag and never do instant-preempts.
+	 */
+	td = curthread;
+	if (td->td_critnest > 0 || td1->td_priority >= td->td_priority)
 		return;
-	}
-	setrunqueue(td1);
-
-	if (td->td_critnest == 1 && td1->td_priority < pri) {
+	mtx_lock_spin(&sched_lock);
+	if (!TD_IS_RUNNING(td1)) {
 #ifdef notyet
 		if (td->td_ithd != NULL) {
 			struct ithd *it = td->td_ithd;
@@ -813,7 +626,6 @@
 			CTR2(KTR_LOCK, "_mtx_unlock_sleep: %p resuming lock=%p",
 			    m, (void *)m->mtx_lock);
 	}
-
 	mtx_unlock_spin(&sched_lock);
 
 	return;
@@ -948,7 +760,6 @@
 		lock->lo_flags |= LO_DUPOK;
 
 	m->mtx_lock = MTX_UNOWNED;
-	TAILQ_INIT(&m->mtx_blocked);
 
 	LOCK_LOG_INIT(lock, opts);
 
@@ -992,6 +803,9 @@
 	/* Setup thread0 so that mutexes work. */
 	LIST_INIT(&thread0.td_contested);
 
+	/* Setup turnstiles so that sleep mutexes work. */
+	init_turnstiles();
+
 	/*
 	 * Initialize mutexes.
 	 */

==== //depot/projects/netperf/sys/kern/kern_thread.c#7 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.161 2003/08/26 11:33:15 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.162 2003/11/11 22:07:29 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,6 +44,7 @@
 #include <sys/signalvar.h>
 #include <sys/sx.h>
 #include <sys/tty.h>
+#include <sys/turnstile.h>
 #include <sys/user.h>
 #include <sys/jail.h>
 #include <sys/kse.h>
@@ -190,6 +191,7 @@
 	vm_thread_new(td, 0);
 	mtx_unlock(&Giant);
 	cpu_thread_setup(td);
+	td->td_turnstile = turnstile_alloc();
 	td->td_sched = (struct td_sched *)&td[1];
 }
 
@@ -202,6 +204,7 @@
 	struct thread	*td;
 
 	td = (struct thread *)mem;
+	turnstile_free(td->td_turnstile);
 	vm_thread_dispose(td);
 }
 

==== //depot/projects/netperf/sys/kern/subr_witness.c#6 (text+ko) ====

@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/subr_witness.c,v 1.161 2003/11/03 22:38:30 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/subr_witness.c,v 1.162 2003/11/11 22:07:29 jhb Exp $");
 
 #include "opt_ddb.h"
 #include "opt_witness.h"
@@ -288,6 +288,8 @@
 	{ "intr table", &lock_class_mtx_spin },
 	{ "ithread table lock", &lock_class_mtx_spin },
 	{ "sched lock", &lock_class_mtx_spin },
+	{ "turnstile chain", &lock_class_mtx_spin },
+	{ "td_contested", &lock_class_mtx_spin },
 	{ "callout", &lock_class_mtx_spin },
 	/*
 	 * leaf locks
@@ -342,9 +344,7 @@
 	  LO_INITIALIZED,		/* mtx_object.lo_flags */
 	  { NULL, NULL },		/* mtx_object.lo_list */
 	  NULL },			/* mtx_object.lo_witness */
-	MTX_UNOWNED, 0,			/* mtx_lock, mtx_recurse */
-	TAILQ_HEAD_INITIALIZER(all_mtx.mtx_blocked),
-	{ NULL, NULL }			/* mtx_contested */
+	MTX_UNOWNED, 0			/* mtx_lock, mtx_recurse */
 };
 
 /*

==== //depot/projects/netperf/sys/modules/mac_stub/Makefile#2 (text+ko) ====

@@ -1,9 +1,9 @@
-# $FreeBSD: src/sys/modules/mac_stub/Makefile,v 1.3 2003/08/21 15:43:01 rwatson Exp $
+# $FreeBSD: src/sys/modules/mac_stub/Makefile,v 1.4 2003/11/11 21:23:54 rwatson Exp $
 
-.PATH: ${.CURDIR}/../../security/mac_none
+.PATH: ${.CURDIR}/../../security/mac_stub
 
-KMOD=	mac_none
+KMOD=	mac_stub
 SRCS=	vnode_if.h \
-	mac_none.c
+	mac_stub.c
 
 .include <bsd.kmod.mk>

==== //depot/projects/netperf/sys/net/if_loop.c#13 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)if_loop.c	8.2 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/net/if_loop.c,v 1.90 2003/10/31 18:32:08 brooks Exp $
+ * $FreeBSD: src/sys/net/if_loop.c,v 1.91 2003/11/11 17:58:36 silby Exp $
  */
 
 /*
@@ -191,10 +191,6 @@
 	struct sockaddr *dst;
 	register struct rtentry *rt;
 {
-#ifdef INET6
-	struct mbuf *n;
-#endif
-
 	M_ASSERTPKTHDR(m); /* check if we have the packet header */
 
 	if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) {
@@ -202,29 +198,6 @@
 		return (rt->rt_flags & RTF_BLACKHOLE ? 0 :
 		        rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH);
 	}
-#ifdef INET6
-	/*
-	 * KAME requires that the packet to be contiguous on the
-	 * mbuf.  We need to make that sure.
-	 * this kind of code should be avoided.
-	 *
-	 * XXX: KAME may no longer need contiguous packets.  Once
-	 * that has been verified, the following code _should_ be
-	 * removed.
-	 */
-
-	if (m && m->m_next != NULL) {
-
-		n = m_defrag(m, M_DONTWAIT);
-
-		if (n == NULL) {
-			m_freem(m);
-			return (ENOBUFS);
-		} else {
-			m = n;
-		}
-	}
-#endif
 
 	ifp->if_opackets++;
 	ifp->if_obytes += m->m_pkthdr.len;

==== //depot/projects/netperf/sys/netinet/tcp_syncache.c#12 (text+ko) ====

@@ -31,7 +31,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.46 2003/11/10 23:29:33 sam Exp $
+ * $FreeBSD: src/sys/netinet/tcp_syncache.c,v 1.48 2003/11/11 18:16:54 sam Exp $
  */
 
 #include "opt_inet6.h"
@@ -379,7 +379,7 @@
         if (callout_pending(&tcp_syncache.tt_timerq[slot]) ||
             !callout_active(&tcp_syncache.tt_timerq[slot])) {
 		/* XXX can this happen? */
-		INP_INFO_WLOCK(&tcbinfo);
+		INP_INFO_WUNLOCK(&tcbinfo);
                 return;
         }
         callout_deactivate(&tcp_syncache.tt_timerq[slot]);
@@ -416,7 +416,7 @@
 	if (nsc != NULL)
 		callout_reset(&tcp_syncache.tt_timerq[slot],
 		    nsc->sc_rxttime - ticks, syncache_timer, (void *)(slot));
-	INP_INFO_WLOCK(&tcbinfo);
+	INP_INFO_WUNLOCK(&tcbinfo);
 }
 
 /*

==== //depot/projects/netperf/sys/netinet6/esp_rijndael.c#3 (text+ko) ====

@@ -1,5 +1,5 @@
-/*	$FreeBSD: src/sys/netinet6/esp_rijndael.c,v 1.3 2003/10/13 14:57:41 ume Exp $	*/
-/*	$KAME: esp_rijndael.c,v 1.4 2001/03/02 05:53:05 itojun Exp $	*/
+/*	$FreeBSD: src/sys/netinet6/esp_rijndael.c,v 1.4 2003/11/11 18:58:54 ume Exp $	*/
+/*	$KAME: esp_rijndael.c,v 1.14 2003/08/28 08:23:20 itojun Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -30,9 +30,6 @@
  * SUCH DAMAGE.
  */
 
-#include "opt_inet.h"
-#include "opt_inet6.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/socket.h>
@@ -50,13 +47,12 @@
 
 #include <net/net_osdep.h>
 
-/* as rijndael uses assymetric scheduled keys, we need to do it twice. */
 size_t
 esp_rijndael_schedlen(algo)
 	const struct esp_algorithm *algo;
 {
 
-	return sizeof(keyInstance) * 2;
+	return sizeof(rijndael_ctx);
 }
 
 int
@@ -64,15 +60,11 @@
 	const struct esp_algorithm *algo;
 	struct secasvar *sav;
 {
-	keyInstance *k;
+	rijndael_ctx *ctx;
 
-	k = (keyInstance *)sav->sched;
-	if (rijndael_makeKey(&k[0], DIR_DECRYPT, _KEYLEN(sav->key_enc) * 8,
-	    _KEYBUF(sav->key_enc)) < 0)
-		return -1;
-	if (rijndael_makeKey(&k[1], DIR_ENCRYPT, _KEYLEN(sav->key_enc) * 8,
-	    _KEYBUF(sav->key_enc)) < 0)
-		return -1;
+	ctx = (rijndael_ctx *)sav->sched;
+	rijndael_set_key(ctx,
+	    (u_char *)_KEYBUF(sav->key_enc), _KEYLEN(sav->key_enc) * 8);
 	return 0;
 }
 
@@ -83,16 +75,10 @@
 	u_int8_t *s;
 	u_int8_t *d;
 {
-	cipherInstance c;
-	keyInstance *p;
+	rijndael_ctx *ctx;
 
-	/* does not take advantage of CBC mode support */
-	bzero(&c, sizeof(c));
-	if (rijndael_cipherInit(&c, MODE_ECB, NULL) < 0)
-		return -1;
-	p = (keyInstance *)sav->sched;
-	if (rijndael_blockDecrypt(&c, &p[0], s, algo->padbound * 8, d) < 0)
-		return -1;
+	ctx = (rijndael_ctx *)sav->sched;
+	rijndael_decrypt(ctx, s, d);
 	return 0;
 }
 
@@ -103,15 +89,9 @@
 	u_int8_t *s;
 	u_int8_t *d;
 {
-	cipherInstance c;
-	keyInstance *p;
+	rijndael_ctx *ctx;
 
-	/* does not take advantage of CBC mode support */
-	bzero(&c, sizeof(c));
-	if (rijndael_cipherInit(&c, MODE_ECB, NULL) < 0)
-		return -1;
-	p = (keyInstance *)sav->sched;
-	if (rijndael_blockEncrypt(&c, &p[1], s, algo->padbound * 8, d) < 0)
-		return -1;
+	ctx = (rijndael_ctx *)sav->sched;
+	rijndael_encrypt(ctx, s, d);
 	return 0;
 }

==== //depot/projects/netperf/sys/netipsec/ipsec_osdep.h#4 (text+ko) ====


==== //depot/projects/netperf/sys/pci/agp.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/pci/agp.c,v 1.33 2003/10/23 18:08:56 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/pci/agp.c,v 1.34 2003/11/11 21:49:18 anholt Exp $");
 
 #include "opt_bus.h"
 
@@ -175,6 +175,11 @@
 			      "allocating GATT for aperture of size %dM\n",
 			      apsize / (1024*1024));
 
+	if (entries == 0) {
+		device_printf(dev, "bad aperture size\n");
+		return NULL;
+	}
+
 	gatt = malloc(sizeof(struct agp_gatt), M_AGP, M_NOWAIT);
 	if (!gatt)
 		return 0;

==== //depot/projects/netperf/sys/pci/agp_ali.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/pci/agp_ali.c,v 1.8 2003/08/22 07:13:20 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/pci/agp_ali.c,v 1.9 2003/11/11 21:49:18 anholt Exp $");
 
 #include "opt_bus.h"
 
@@ -102,6 +102,10 @@
 		return error;
 
 	sc->initial_aperture = AGP_GET_APERTURE(dev);
+	if (sc->initial_aperture == 0) {
+		device_printf(dev, "bad initial aperture size, disabling\n");
+		return ENXIO;
+	}

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list