Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Mar 2004 17:33:07 -0800 (PST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 49487 for review
Message-ID:  <200403220133.i2M1X7sM069127@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=49487

Change 49487 by rwatson@rwatson_tislabs on 2004/03/21 17:32:13

	NDIS driver has increased stack size.
	NDIS timer events run from NDIS swi instead of timer.
	NDIS goes back to using bus_alloc_resource() for source code compat
	    reasons.
	KSE hack in sched_ule.

Affected files ...

.. //depot/projects/netperf_socket/sys/compat/ndis/kern_ndis.c#7 integrate
.. //depot/projects/netperf_socket/sys/compat/ndis/ntoskrnl_var.h#5 integrate
.. //depot/projects/netperf_socket/sys/compat/ndis/subr_ntoskrnl.c#8 integrate
.. //depot/projects/netperf_socket/sys/conf/files.i386#9 integrate
.. //depot/projects/netperf_socket/sys/conf/kern.post.mk#4 integrate
.. //depot/projects/netperf_socket/sys/dev/if_ndis/if_ndis_pccard.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/if_ndis/if_ndis_pci.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/ispfw/ispfw.c#2 integrate
.. //depot/projects/netperf_socket/sys/i386/i386/uio_machdep.c#1 branch
.. //depot/projects/netperf_socket/sys/i386/i386/vm_machdep.c#7 integrate
.. //depot/projects/netperf_socket/sys/kern/sched_ule.c#3 integrate
.. //depot/projects/netperf_socket/sys/net/if_arcsubr.c#3 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_tee.c#2 integrate
.. //depot/projects/netperf_socket/sys/netinet/if_ether.c#4 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/compat/ndis/kern_ndis.c#7 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.43 2004/03/20 23:39:43 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.44 2004/03/22 00:41:41 wpaul Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -268,14 +268,16 @@
 		ndis_tproc.np_q = &ndis_ttodo;
 		ndis_tproc.np_state = NDIS_PSTATE_SLEEPING;
 		error = kthread_create(ndis_runq, &ndis_tproc,
-		    &ndis_tproc.np_p, RFHIGHPID, 0, "ndis taskqueue");
+		    &ndis_tproc.np_p, RFHIGHPID,
+		    NDIS_KSTACK_PAGES, "ndis taskqueue");
 	}
 
 	if (error == 0) {
 		ndis_iproc.np_q = &ndis_itodo;
 		ndis_iproc.np_state = NDIS_PSTATE_SLEEPING;
 		error = kthread_create(ndis_runq, &ndis_iproc,
-		    &ndis_iproc.np_p, RFHIGHPID, 0, "ndis swi");
+		    &ndis_iproc.np_p, RFHIGHPID,
+		    NDIS_KSTACK_PAGES, "ndis swi");
 	}
 
 	if (error) {

==== //depot/projects/netperf_socket/sys/compat/ndis/ntoskrnl_var.h#5 (text+ko) ====

@@ -29,7 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/compat/ndis/ntoskrnl_var.h,v 1.10 2004/03/20 23:39:43 wpaul Exp $
+ * $FreeBSD: src/sys/compat/ndis/ntoskrnl_var.h,v 1.11 2004/03/22 00:41:41 wpaul Exp $
  */
 
 #ifndef _NTOSKRNL_VAR_H_
@@ -466,6 +466,13 @@
 
 #define STATUS_WAIT_0			0x00000000
 
+/*
+ * FreeBSD's kernel stack is 2 pages in size by default. The
+ * Windows stack is larger, so we need to give our threads more
+ * stack pages. 4 should be enough, we use 8 just to extra safe.
+ */
+#define NDIS_KSTACK_PAGES	8
+
 extern image_patch_table ntoskrnl_functbl[];
 extern struct mtx *ntoskrnl_dispatchlock;
 

==== //depot/projects/netperf_socket/sys/compat/ndis/subr_ntoskrnl.c#8 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.29 2004/03/20 23:39:43 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.30 2004/03/22 00:41:41 wpaul Exp $");
 
 #include <sys/ctype.h>
 #include <sys/unistd.h>
@@ -85,6 +85,7 @@
 	int64_t *, wait_block *);
 static void ntoskrnl_wakeup(void *);
 static void ntoskrnl_timercall(void *);
+static void ntoskrnl_timersched(void *);
 __stdcall static void ntoskrnl_writereg_ushort(uint16_t *, uint16_t);
 __stdcall static uint16_t ntoskrnl_readreg_ushort(uint16_t *);
 __stdcall static void ntoskrnl_writereg_ulong(uint32_t *, uint32_t);
@@ -1585,7 +1586,7 @@
 
 	sprintf(tname, "windows kthread %d", ntoskrnl_kth);
 	error = kthread_create(ntoskrnl_thrfunc, tc, &p,
-	    RFHIGHPID, 0, tname);
+	    RFHIGHPID, NDIS_KSTACK_PAGES, tname);
 	*handle = p;
 
 	ntoskrnl_kth++;
@@ -1641,9 +1642,23 @@
 	return;
 }
 
+/*
+ * We run all timer callouts in the ndis swi thread to take
+ * advantage of its larger stack size. If we don't do this,
+ * the callout will run in the clock ithread context.
+ */
+
 static void
+ntoskrnl_timersched(arg)
+	void			*arg;
+{
+	ndis_sched(ntoskrnl_timercall, arg, NDIS_SWI);
+	return;
+}
+
+static void
 ntoskrnl_timercall(arg)
-	void		*arg;
+	void			*arg;
 {
 	ktimer			*timer;
 	__stdcall kdpc_func	timerfunc;
@@ -1666,7 +1681,7 @@
 		tv.tv_sec = 0;
 		tv.tv_usec = timer->k_period * 1000;
 		timer->k_handle =
-		    timeout(ntoskrnl_timercall, timer, tvtohz(&tv));
+		    timeout(ntoskrnl_timersched, timer, tvtohz(&tv));
 	}
 
 	if (dpc != NULL) {
@@ -1744,7 +1759,7 @@
 
 	if (timer->k_handle.callout != NULL &&
 	    callout_pending(timer->k_handle.callout)) {
-		untimeout(ntoskrnl_timercall, timer, timer->k_handle);
+		untimeout(ntoskrnl_timersched, timer, timer->k_handle);
 		pending = TRUE;
 	} else
 		pending = FALSE;
@@ -1769,7 +1784,7 @@
 		}
 	}
 
-	timer->k_handle = timeout(ntoskrnl_timercall, timer, tvtohz(&tv));
+	timer->k_handle = timeout(ntoskrnl_timersched, timer, tvtohz(&tv));
 
 	return(pending);
 }
@@ -1798,7 +1813,7 @@
 	else
 		pending = FALSE;
 
-	untimeout(ntoskrnl_timercall, timer, timer->k_handle);
+	untimeout(ntoskrnl_timersched, timer, timer->k_handle);
 
 	return(pending);
 }

==== //depot/projects/netperf_socket/sys/conf/files.i386#9 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.i386,v 1.479 2004/03/15 22:24:27 fjoe Exp $
+# $FreeBSD: src/sys/conf/files.i386,v 1.480 2004/03/21 20:28:36 alc Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -239,6 +239,7 @@
 i386/i386/sys_machdep.c		standard
 i386/i386/trap.c		standard
 i386/i386/tsc.c			standard
+i386/i386/uio_machdep.c		standard
 i386/i386/vm86.c		standard
 i386/i386/vm_machdep.c		standard
 i386/ibcs2/ibcs2_errno.c	optional	ibcs2

==== //depot/projects/netperf_socket/sys/conf/kern.post.mk#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/kern.post.mk,v 1.63 2004/03/20 22:47:30 marcel Exp $
+# $FreeBSD: src/sys/conf/kern.post.mk,v 1.64 2004/03/21 19:06:54 obrien Exp $
 
 # Part of a unified Makefile for building kernels.  This part includes all
 # the definitions that need to be after all the % directives except %RULES
@@ -116,7 +116,7 @@
 ./assym.s: assym.s
 
 assym.s: $S/kern/genassym.sh genassym.o
-	NM=${NM} sh $S/kern/genassym.sh genassym.o > ${.TARGET}
+	NM="${NM}" sh $S/kern/genassym.sh genassym.o > ${.TARGET}
 
 genassym.o: $S/$M/$M/genassym.c
 	${CC} -c ${CFLAGS:N-fno-common} $S/$M/$M/genassym.c

==== //depot/projects/netperf_socket/sys/dev/if_ndis/if_ndis_pccard.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pccard.c,v 1.3 2004/03/17 17:50:35 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pccard.c,v 1.4 2004/03/21 19:56:41 wpaul Exp $");
 
 #include <sys/ctype.h>
 #include <sys/param.h>
@@ -194,9 +194,9 @@
 	sc->ndis_dev = dev;
 
 	sc->ndis_io_rid = 0;
-	sc->ndis_res_io = bus_alloc_resource_any(dev,
+	sc->ndis_res_io = bus_alloc_resource(dev,
 	    SYS_RES_IOPORT, &sc->ndis_io_rid,
-	    RF_ACTIVE);
+	    0, ~0, 1, RF_ACTIVE);
 	if (sc->ndis_res_io == NULL) {
 		device_printf(dev,
 		    "couldn't map iospace\n");
@@ -206,8 +206,8 @@
 	sc->ndis_rescnt++;
 
 	rid = 0;
-	sc->ndis_irq = bus_alloc_resource_any(dev,
-	    SYS_RES_IRQ, &rid,
+	sc->ndis_irq = bus_alloc_resource(dev,
+	    SYS_RES_IRQ, &rid, 0, ~0, 1,
 	    RF_SHAREABLE | RF_ACTIVE);
 	if (sc->ndis_irq == NULL) {
 		device_printf(dev,

==== //depot/projects/netperf_socket/sys/dev/if_ndis/if_ndis_pci.c#5 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.4 2004/03/17 17:50:35 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.5 2004/03/21 19:56:41 wpaul Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -184,9 +184,9 @@
 			switch (rle->type) {
 			case SYS_RES_IOPORT:
 				sc->ndis_io_rid = rle->rid;
-				sc->ndis_res_io = bus_alloc_resource_any(dev,
+				sc->ndis_res_io = bus_alloc_resource(dev,
 				    SYS_RES_IOPORT, &sc->ndis_io_rid,
-				    RF_ACTIVE);
+				    0, ~0, 1, RF_ACTIVE);
 				if (sc->ndis_res_io == NULL) {
 					device_printf(dev,
 					    "couldn't map iospace\n");
@@ -205,10 +205,10 @@
 				if (rle->rid == PCIR_BAR(2)) {
 					sc->ndis_altmem_rid = rle->rid;
 					sc->ndis_res_altmem =
-					    bus_alloc_resource_any(dev,
+					    bus_alloc_resource(dev,
 					        SYS_RES_MEMORY,
 						&sc->ndis_altmem_rid,
-						RF_ACTIVE);
+						0, ~0, 1, RF_ACTIVE);
 					if (sc->ndis_res_altmem == NULL) {
 						device_printf(dev,
 						    "couldn't map alt "
@@ -219,10 +219,10 @@
 				} else {
 					sc->ndis_mem_rid = rle->rid;
 					sc->ndis_res_mem =
-					    bus_alloc_resource_any(dev,
+					    bus_alloc_resource(dev,
 					        SYS_RES_MEMORY,
 						&sc->ndis_mem_rid,
-						RF_ACTIVE);
+						0, ~0, 1, RF_ACTIVE);
 					if (sc->ndis_res_mem == NULL) {
 						device_printf(dev,
 						    "couldn't map memory\n");
@@ -233,8 +233,8 @@
 				break;
 			case SYS_RES_IRQ:
 				rid = rle->rid;
-				sc->ndis_irq = bus_alloc_resource_any(dev,
-				    SYS_RES_IRQ, &rid,
+				sc->ndis_irq = bus_alloc_resource(dev,
+				    SYS_RES_IRQ, &rid, 0, ~0, 1,
 	    			    RF_SHAREABLE | RF_ACTIVE);
 				if (sc->ndis_irq == NULL) {
 					device_printf(dev,

==== //depot/projects/netperf_socket/sys/dev/ispfw/ispfw.c#2 (text+ko) ====

@@ -1,7 +1,4 @@
-/*
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ispfw/ispfw.c,v 1.10 2003/08/24 17:49:14 obrien Exp $");
+/*-
  * ISP Firmware Helper Pseudo Device for FreeBSD
  *
  * Copyright (c) 2000, 2001, by Matthew Jacob
@@ -29,6 +26,9 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/sys/dev/ispfw/ispfw.c,v 1.11 2004/03/21 18:16:49 obrien Exp $");
+
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>

==== //depot/projects/netperf_socket/sys/i386/i386/vm_machdep.c#7 (text+ko) ====

@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.232 2004/03/16 19:04:27 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.233 2004/03/22 00:28:38 wpaul Exp $");
 
 #include "opt_isa.h"
 #include "opt_kstack_pages.h"
@@ -172,7 +172,8 @@
 #endif
 
 	/* Point the pcb to the top of the stack */
-	pcb2 = (struct pcb *)(td2->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
+	pcb2 = (struct pcb *)(td2->td_kstack +
+	    td2->td_kstack_pages * PAGE_SIZE) - 1;
 	td2->td_pcb = pcb2;
 
 	/* Copy p1's pcb */
@@ -346,8 +347,8 @@
 cpu_thread_setup(struct thread *td)
 {
 
-	td->td_pcb =
-	     (struct pcb *)(td->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
+	td->td_pcb = (struct pcb *)(td->td_kstack +
+	    td->td_kstack_pages * PAGE_SIZE) - 1;
 	td->td_frame = (struct trapframe *)((caddr_t)td->td_pcb - 16) - 1;
 	td->td_pcb->pcb_ext = NULL; 
 }

==== //depot/projects/netperf_socket/sys/kern/sched_ule.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.100 2004/02/27 18:52:43 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.101 2004/03/21 18:53:29 obrien Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -186,7 +186,7 @@
 #define	SCHED_INTERACTIVE(kg)						\
     (sched_interact_score(kg) < SCHED_INTERACT_THRESH)
 #define	SCHED_CURR(kg, ke)						\
-    (ke->ke_thread->td_priority != kg->kg_user_pri ||			\
+    (ke->ke_thread->td_priority < kg->kg_user_pri ||			\
     SCHED_INTERACTIVE(kg))
 
 /*
@@ -1166,11 +1166,8 @@
 	 */
 	if ((ke->ke_flags & KEF_ASSIGNED) == 0) {
 		if (TD_IS_RUNNING(td)) {
-			if (td->td_proc->p_flag & P_SA) {
-				kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke);
-				setrunqueue(td);
-			} else 
-				kseq_runq_add(KSEQ_SELF(), ke);
+			kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke);
+			setrunqueue(td);
 		} else {
 			if (ke->ke_runq) {
 				kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke);

==== //depot/projects/netperf_socket/sys/net/if_arcsubr.c#3 (text+ko) ====

@@ -1,5 +1,5 @@
 /*	$NetBSD: if_arcsubr.c,v 1.36 2001/06/14 05:44:23 itojun Exp $	*/
-/*	$FreeBSD: src/sys/net/if_arcsubr.c,v 1.16 2004/03/21 06:34:34 mdodd Exp $ */
+/*	$FreeBSD: src/sys/net/if_arcsubr.c,v 1.17 2004/03/21 17:27:41 mdodd Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Ignatios Souvatzis
@@ -153,12 +153,12 @@
 		switch(ntohs(ah->ar_op)) {
 		case ARPOP_REVREQUEST:
 		case ARPOP_REVREPLY:
-			type = htons(ARCTYPE_REVARP);
+			atype = ARCTYPE_REVARP;
 			break;
 		case ARPOP_REQUEST:
 		case ARPOP_REPLY:
 		default:
-			type = htons(ARCTYPE_ARP);
+			atype = ARCTYPE_ARP;
 			break;
 		}
 

==== //depot/projects/netperf_socket/sys/netgraph/ng_tee.c#2 (text+ko) ====

@@ -36,7 +36,7 @@
  *
  * Author: Julian Elischer <julian@freebsd.org>
  *
- * $FreeBSD: src/sys/netgraph/ng_tee.c,v 1.25 2003/07/03 22:09:47 julian Exp $
+ * $FreeBSD: src/sys/netgraph/ng_tee.c,v 1.26 2004/03/22 01:15:28 julian Exp $
  * $Whistle: ng_tee.c,v 1.18 1999/11/01 09:24:52 julian Exp $
  */
 
@@ -351,11 +351,11 @@
 		}
 	}
 	/* Deliver frame out destination hook */
-	dest->stats.outOctets += m->m_pkthdr.len;
-	dest->stats.outFrames++;
-	if (dest->hook)
+	if (dest->hook) {
+		dest->stats.outOctets += m->m_pkthdr.len;
+		dest->stats.outFrames++;
 		NG_FWD_ITEM_HOOK(error, item, dest->hook);
-	else
+	} else
 		NG_FREE_ITEM(item);
 	return (error);
 }

==== //depot/projects/netperf_socket/sys/netinet/if_ether.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)if_ether.c	8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/netinet/if_ether.c,v 1.119 2004/03/21 06:36:05 mdodd Exp $
+ * $FreeBSD: src/sys/netinet/if_ether.c,v 1.120 2004/03/21 18:51:26 mdodd Exp $
  */
 
 /*
@@ -314,9 +314,9 @@
 		return;
 	m->m_len = sizeof(*ah) + 2*sizeof(struct in_addr) +
 		2*ifp->if_data.ifi_addrlen;
-		m->m_pkthdr.len = m->m_len;
-		MH_ALIGN(m, m->m_len);
-		ah = mtod(m, struct arphdr *);
+	m->m_pkthdr.len = m->m_len;
+	MH_ALIGN(m, m->m_len);
+	ah = mtod(m, struct arphdr *);
 	bzero((caddr_t)ah, m->m_len);
 #ifdef MAC
 	mac_create_mbuf_linklayer(ifp, m);
@@ -695,8 +695,7 @@
 		la->la_asked = 0;
 		la->la_preempt = arp_maxtries;
 		if (la->la_hold) {
-			(*ifp->if_output)(ifp, la->la_hold,
-				rt_key(rt), rt);
+			(*ifp->if_output)(ifp, la->la_hold, rt_key(rt), rt);
 			la->la_hold = 0;
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403220133.i2M1X7sM069127>