PERFORCE change 48264 for review

Robert Watson rwatson at FreeBSD.org
Fri Mar 5 18:08:36 PST 2004


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

Change 48264 by rwatson at rwatson_none5 on 2004/03/05 18:08:00

	Integrate netperf_socket branch to CVS HEAD:
	
	Kernel thread exit no longer requires exit.
	Giant pushed down in exec, fork, exit.
	Back out of mlock/vslock changes.
	roundrobin_callout in sched_4bsd now MPSAFE.
	userret ast sanity test moved from INVARIANTS to DIAGNOSTIC.

Affected files ...

.. //depot/projects/netperf_socket/sys/alpha/include/critical.h#2 integrate
.. //depot/projects/netperf_socket/sys/amd64/amd64/critical.c#2 integrate
.. //depot/projects/netperf_socket/sys/amd64/amd64/identcpu.c#2 integrate
.. //depot/projects/netperf_socket/sys/amd64/conf/NOTES#4 integrate
.. //depot/projects/netperf_socket/sys/amd64/include/cpufunc.h#3 integrate
.. //depot/projects/netperf_socket/sys/amd64/include/critical.h#2 integrate
.. //depot/projects/netperf_socket/sys/compat/ndis/kern_ndis.c#3 integrate
.. //depot/projects/netperf_socket/sys/conf/options.amd64#4 integrate
.. //depot/projects/netperf_socket/sys/dev/aac/aac.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi_cpu.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi_thermal.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/adlink/adlink.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/md/md.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/pccbb/pccbb.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/random/harvest.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/utopia/utopia.c#2 integrate
.. //depot/projects/netperf_socket/sys/geom/bde/g_bde_work.c#3 integrate
.. //depot/projects/netperf_socket/sys/i386/conf/NOTES#6 integrate
.. //depot/projects/netperf_socket/sys/i386/i386/critical.c#2 integrate
.. //depot/projects/netperf_socket/sys/i386/include/cpufunc.h#2 integrate
.. //depot/projects/netperf_socket/sys/i386/include/critical.h#2 integrate
.. //depot/projects/netperf_socket/sys/ia64/include/critical.h#2 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_exec.c#3 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_exit.c#3 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_fork.c#4 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_intr.c#3 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_sig.c#4 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_sysctl.c#3 integrate
.. //depot/projects/netperf_socket/sys/kern/sched_4bsd.c#3 integrate
.. //depot/projects/netperf_socket/sys/kern/subr_trap.c#3 integrate
.. //depot/projects/netperf_socket/sys/nfs4client/nfs4_vfsops.c#3 integrate
.. //depot/projects/netperf_socket/sys/opencrypto/crypto.c#2 integrate
.. //depot/projects/netperf_socket/sys/powerpc/include/critical.h#2 integrate
.. //depot/projects/netperf_socket/sys/sparc64/include/critical.h#2 integrate
.. //depot/projects/netperf_socket/sys/sys/_null.h#2 integrate
.. //depot/projects/netperf_socket/sys/sys/param.h#3 integrate
.. //depot/projects/netperf_socket/sys/vm/vm_extern.h#3 integrate
.. //depot/projects/netperf_socket/sys/vm/vm_glue.c#3 integrate
.. //depot/projects/netperf_socket/sys/vm/vm_mmap.c#4 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/alpha/include/critical.h#2 (text+ko) ====

@@ -33,7 +33,7 @@
  *	related support functions residing
  *	in <arch>/<arch>/critical.c	- prototyped
  *
- * $FreeBSD: src/sys/alpha/include/critical.h,v 1.3 2003/08/12 23:24:03 imp Exp $
+ * $FreeBSD: src/sys/alpha/include/critical.h,v 1.4 2004/03/05 09:19:59 le Exp $
  */
 
 #ifndef _MACHINE_CRITICAL_H_
@@ -81,8 +81,8 @@
 
 #else /* !__GNUC__ */
 
-void cpu_critical_enter(void)
-void cpu_critical_exit(void)
+void cpu_critical_enter(void);
+void cpu_critical_exit(void);
 
 #endif	/* __GNUC__ */
 

==== //depot/projects/netperf_socket/sys/amd64/amd64/critical.c#2 (text+ko) ====

@@ -26,15 +26,19 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/critical.c,v 1.13 2003/12/06 23:13:22 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/critical.c,v 1.14 2004/03/05 14:31:21 bde Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
+
 #include <machine/critical.h>
+#include <machine/psl.h>
 
 /*
  * cpu_critical_fork_exit() - cleanup after fork
+ *
+ *	Enable interrupts in the saved copy of eflags.
  */
 void
 cpu_critical_fork_exit(void)

==== //depot/projects/netperf_socket/sys/amd64/amd64/identcpu.c#2 (text+ko) ====

@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.128 2003/11/21 03:01:59 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.129 2004/03/06 00:51:30 peter Exp $");
 
 #include "opt_cpu.h"
 
@@ -123,8 +123,8 @@
 	}
 
 	if (strcmp(cpu_vendor, "GenuineIntel") == 0) {
-		/* How the hell did you get here?? */
-		strcat(cpu_model, "Yamhill?");
+		/* Better late than never I suppose.. */
+		strcat(cpu_model, "IA-32e");
 	} else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) {
 		/*
 		 * Values taken from AMD Processor Recognition

==== //depot/projects/netperf_socket/sys/amd64/conf/NOTES#4 (text+ko) ====

@@ -4,7 +4,7 @@
 # This file contains machine dependent kernel configuration notes.  For
 # machine independent notes, look in /sys/conf/NOTES.
 #
-# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.6 2004/03/05 05:08:22 obrien Exp $
+# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.10 2004/03/05 08:04:10 obrien Exp $
 #
 
 # We don't have modules on amd64.
@@ -12,8 +12,7 @@
 
 #
 # This directive is mandatory; it defines the architecture to be
-# configured for; in this case, the 386 family based IBM-PC and
-# compatibles.
+# configured for; in this case, the AMD64 family based machines.
 #
 machine		amd64
 
@@ -42,8 +41,8 @@
 #
 
 # Optional:
-device		atpic			# Legacy pic
-device		mptable
+device		atpic			# Optional legacy pic support
+device		mptable			# Optional MPSPEC mptable support
 options 	NO_MIXED_MODE		# Disable use of mixed mode
 
 
@@ -167,12 +166,6 @@
 #####################################################################
 # HARDWARE DEVICE CONFIGURATION
 
-# To include support for VGA VESA video modes
-options 	VESA
-
-# Turn on extra debugging checks and output for VESA support.
-options 	VESA_DEBUG
-
 #
 # Optional devices:
 #
@@ -266,9 +259,9 @@
 # nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters.
 # stg: TMC 18C30, 18C50 based SCSI host adapters.
 
-device          ncv
-device          nsp
-device          stg
+device		ncv
+device		nsp
+device		stg
 
 #
 # Adaptec FSA RAID controllers, including integrated DELL controllers,
@@ -293,7 +286,6 @@
 #
 # Miscellaneous hardware:
 #
-# cy: Cyclades serial driver
 # digi: Digiboard driver
 # stl: Stallion EasyIO and EasyConnection 8/32 (cd1400 based)
 
@@ -315,7 +307,8 @@
 device		digi_Xe
 device		digi_Xem
 device		digi_Xr
-#XXX#	PCI versions exist, but driver needs to be moved and split up.
+#XXX#	PCI versions exist, but driver needs to be moved and split up,
+#XXX#	Warner Losh working on it.
 #XXX#device		stl
 # HOT1 Xilinx 6200 card (http://www.vcc.com/)
 device		xrpu
@@ -503,7 +496,7 @@
 
 options 	FB_INSTALL_CDEV		# install a CDEV entry in /dev
 
-options 	ENABLE_ALART
+options 	ENABLE_ALART		# Control alarm on Intel intpm driver
 options 	KBDIO_DEBUG=2
 options 	KBD_MAXRETRY=4
 options 	KBD_MAXWAIT=6

==== //depot/projects/netperf_socket/sys/amd64/include/cpufunc.h#3 (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/amd64/include/cpufunc.h,v 1.139 2004/01/28 23:53:04 peter Exp $
+ * $FreeBSD: src/sys/amd64/include/cpufunc.h,v 1.140 2004/03/05 09:19:59 le Exp $
  */
 
 /*
@@ -744,9 +744,9 @@
 void	ltr(u_short sel);
 void	outb(u_int port, u_char data);
 void	outl(u_int port, u_int data);
-void	outsb(u_int port, void *addr, size_t cnt);
-void	outsl(u_int port, void *addr, size_t cnt);
-void	outsw(u_int port, void *addr, size_t cnt);
+void	outsb(u_int port, const void *addr, size_t cnt);
+void	outsl(u_int port, const void *addr, size_t cnt);
+void	outsw(u_int port, const void *addr, size_t cnt);
 void	outw(u_int port, u_short data);
 void	ia32_pause(void);
 u_int	rcr0(void);

==== //depot/projects/netperf_socket/sys/amd64/include/critical.h#2 (text+ko) ====

@@ -33,7 +33,7 @@
  *	related support functions residing
  *	in <arch>/<arch>/critical.c	- prototyped
  *
- * $FreeBSD: src/sys/amd64/include/critical.h,v 1.6 2003/12/06 23:13:22 peter Exp $
+ * $FreeBSD: src/sys/amd64/include/critical.h,v 1.7 2004/03/05 09:19:59 le Exp $
  */
 
 #ifndef _MACHINE_CRITICAL_H_
@@ -75,8 +75,8 @@
 
 #else /* !__GNUC__ */
 
-void cpu_critical_enter(void)
-void cpu_critical_exit(void)
+void cpu_critical_enter(void);
+void cpu_critical_exit(void);
 
 #endif	/* __GNUC__ */
 

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

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.39 2004/02/14 20:57:32 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.40 2004/03/05 22:42:16 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -244,7 +244,6 @@
 	}
 
 	wakeup(die);
-	mtx_lock(&Giant);
 	kthread_exit(0);
 }
 

==== //depot/projects/netperf_socket/sys/conf/options.amd64#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options.amd64,v 1.12 2004/03/05 04:38:58 obrien Exp $
+# $FreeBSD: src/sys/conf/options.amd64,v 1.13 2004/03/05 07:56:23 obrien Exp $
 # Options specific to AMD64 platform kernels
 
 AUTO_EOI_1		opt_auto_eoi.h
@@ -30,9 +30,6 @@
 VGA_SLOW_IOACCESS	opt_vga.h
 VGA_WIDTH90		opt_vga.h
 
-VESA
-VESA_DEBUG		opt_vesa.h
-
 ATKBD_DFLT_KEYMAP	opt_atkbd.h
 
 # -------------------------------

==== //depot/projects/netperf_socket/sys/dev/aac/aac.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/aac/aac.c,v 1.89 2004/02/25 05:41:44 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/aac/aac.c,v 1.90 2004/03/05 22:42:16 jhb Exp $");
 
 /*
  * Driver for the Adaptec 'FSA' family of PCI/SCSI RAID adapters.
@@ -814,7 +814,6 @@
 	AAC_LOCK_RELEASE(&sc->aac_io_lock);
 	wakeup(sc->aac_dev);
 
-	mtx_lock(&Giant);
 	kthread_exit(0);
 }
 

==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_cpu.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.30 2004/03/04 05:17:52 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.31 2004/03/05 18:08:23 njl Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -709,7 +709,8 @@
     SYSCTL_ADD_PROC(&acpi_cpu_sysctl_ctx,
 		    SYSCTL_CHILDREN(acpi_cpu_sysctl_tree),
 		    OID_AUTO, "cx_history", CTLTYPE_STRING | CTLFLAG_RD,
-		    NULL, 0, acpi_cpu_history_sysctl, "A", "");
+		    NULL, 0, acpi_cpu_history_sysctl, "A",
+		    "count of full sleeps for Cx state / short sleeps");
 
 #ifdef notyet
     /* Signal platform that we can handle _CST notification. */

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

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_thermal.c,v 1.39 2004/03/03 18:34:42 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_thermal.c,v 1.40 2004/03/05 18:06:31 njl Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -449,7 +449,7 @@
     }
 
     /* Handle user override of active mode */
-    if (sc->tz_requested > newactive)
+    if (sc->tz_requested != TZ_ACTIVE_NONE && sc->tz_requested < newactive)
 	newactive = sc->tz_requested;
 
     /* update temperature-related flags */

==== //depot/projects/netperf_socket/sys/dev/adlink/adlink.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/adlink/adlink.c,v 1.7 2004/02/21 21:10:40 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/adlink/adlink.c,v 1.8 2004/03/05 22:41:22 jhb Exp $");
 
 #ifdef _KERNEL
 #include <sys/param.h>
@@ -221,6 +221,7 @@
 
 	sc = arg;
 	idx = 0;
+	mtx_lock(&Giant);
 	for (;;) {
 		while (sc->stat[idx] == 0)
 			msleep(sc, NULL, PRIBIO, "loran", 1);
@@ -234,6 +235,7 @@
 		idx++;
 		idx %= NRING;
 	}
+	mtx_unlock(&Giant);
 	kthread_exit(0);
 }
 

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

@@ -6,7 +6,7 @@
  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
  * ----------------------------------------------------------------------------
  *
- * $FreeBSD: src/sys/dev/md/md.c,v 1.113 2004/03/02 20:13:23 phk Exp $
+ * $FreeBSD: src/sys/dev/md/md.c,v 1.114 2004/03/05 22:42:16 jhb Exp $
  *
  */
 
@@ -638,8 +638,8 @@
 				mtx_unlock(&sc->queue_mtx);
 				sc->procp = NULL;
 				wakeup(&sc->procp);
-				if (!hasgiant)
-					mtx_lock(&Giant);
+				if (hasgiant)
+					mtx_unlock(&Giant);
 				kthread_exit(0);
 			}
 			msleep(sc, &sc->queue_mtx, PRIBIO | PDROP, "mdwait", 0);

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

@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pccbb/pccbb.c,v 1.101 2004/01/04 22:10:00 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pccbb/pccbb.c,v 1.102 2004/03/05 22:42:17 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1053,7 +1053,6 @@
 		mtx_unlock(&sc->mtx);
 	}
 	sc->flags &= ~CBB_KTHREAD_RUNNING;
-	mtx_lock(&Giant);	/* kthread_exit drops */
 	kthread_exit(0);
 }
 

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

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/random/harvest.c,v 1.21 2003/11/17 23:02:21 markm Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/random/harvest.c,v 1.22 2004/03/05 22:42:17 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/kthread.h>
@@ -128,7 +128,6 @@
 random_set_wakeup_exit(void *control)
 {
 	wakeup(control);
-	mtx_lock(&Giant);
 	kthread_exit(0);
 	/* NOTREACHED */
 }

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

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/utopia/utopia.c,v 1.4 2003/07/30 08:35:58 harti Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/utopia/utopia.c,v 1.5 2004/03/05 22:42:17 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1512,7 +1512,6 @@
 	}
 	wakeup_one(&utopia_list);
 	UTP_RUNLOCK_LIST();
-	mtx_lock(&Giant);
 	kthread_exit(0);
 }
 

==== //depot/projects/netperf_socket/sys/geom/bde/g_bde_work.c#3 (text+ko) ====

@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/geom/bde/g_bde_work.c,v 1.23 2004/02/08 10:19:18 phk Exp $
+ * $FreeBSD: src/sys/geom/bde/g_bde_work.c,v 1.24 2004/03/05 22:42:17 jhb Exp $
  *
  * This source file contains the state-engine which makes things happen in the
  * right order.
@@ -663,7 +663,6 @@
 	mtx_unlock(&sc->worklist_mutex);
 	sc->dead = 2;
 	wakeup(sc);
-	mtx_lock(&Giant);
 	kthread_exit(0);
 }
 

==== //depot/projects/netperf_socket/sys/i386/conf/NOTES#6 (text+ko) ====

@@ -4,7 +4,7 @@
 # This file contains machine dependent kernel configuration notes.  For
 # machine independent notes, look in /sys/conf/NOTES.
 #
-# $FreeBSD: src/sys/i386/conf/NOTES,v 1.1132 2004/03/03 12:43:59 rik Exp $
+# $FreeBSD: src/sys/i386/conf/NOTES,v 1.1133 2004/03/05 08:04:10 obrien Exp $
 #
 
 #
@@ -509,6 +509,7 @@
 #       DE101, DE200, DE201, DE202, DE203, DE204, DE205, DE422)
 # lnc:  Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL, AMD Am7990 and
 #       Am79C960)
+# nv:	nVidia nForce MCP on-board Networking.
 # oltr: Olicom ISA token-ring adapters OC-3115, OC-3117, OC-3118 and OC-3133.
 #       Olicom PCI token-ring adapters OC-3136, OC-3137, OC-3139, OC-3140,
 #       OC-3141, OC-3540 and OC-3250.
@@ -560,7 +561,7 @@
 hint.lnc.0.port="0x280"
 hint.lnc.0.irq="10"
 hint.lnc.0.drq="0"
-#device		nv
+device		nv
 device		rdp	1
 hint.rdp.0.at="isa"
 hint.rdp.0.port="0x378"
@@ -1100,7 +1101,7 @@
 options 	PECOFF_SUPPORT
 options 	PECOFF_DEBUG
 
-options 	ENABLE_ALART
+options 	ENABLE_ALART		# Control alarm on Intel intpm driver
 options 	I4B_SMP_WORKAROUND
 options 	I586_PMC_GUPROF=0x70000
 options 	KBDIO_DEBUG=2

==== //depot/projects/netperf_socket/sys/i386/i386/critical.c#2 (text+ko) ====

@@ -26,12 +26,14 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/critical.c,v 1.12 2003/11/03 21:06:54 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/critical.c,v 1.13 2004/03/05 14:23:13 bde Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
+
 #include <machine/critical.h>
+#include <machine/psl.h>
 
 /*
  * cpu_critical_fork_exit() - cleanup after fork

==== //depot/projects/netperf_socket/sys/i386/include/cpufunc.h#2 (text+ko) ====

@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/i386/include/cpufunc.h,v 1.135 2003/08/06 18:21:27 bde Exp $
+ * $FreeBSD: src/sys/i386/include/cpufunc.h,v 1.138 2004/03/05 15:30:40 bde Exp $
  */
 
 /*
@@ -42,13 +42,8 @@
 #ifndef _MACHINE_CPUFUNC_H_
 #define	_MACHINE_CPUFUNC_H_
 
-#include <sys/cdefs.h>
-#include <machine/psl.h>
-
-struct thread;
 struct region_descriptor;
 
-__BEGIN_DECLS
 #define readb(va)	(*(volatile u_int8_t *) (va))
 #define readw(va)	(*(volatile u_int16_t *) (va))
 #define readl(va)	(*(volatile u_int32_t *) (va))
@@ -469,21 +464,18 @@
 	__asm __volatile("movl %0,%%gs" : : "rm" (sel));
 }
 
-/* void lidt(struct region_descriptor *addr); */
 static __inline void
 lidt(struct region_descriptor *addr)
 {
 	__asm __volatile("lidt (%0)" : : "r" (addr));
 }
 
-/* void lldt(u_short sel); */
 static __inline void
 lldt(u_short sel)
 {
 	__asm __volatile("lldt %0" : : "r" (sel));
 }
 
-/* void ltr(u_short sel); */
 static __inline void
 ltr(u_short sel)
 {
@@ -623,74 +615,68 @@
 int	breakpoint(void);
 u_int	bsfl(u_int mask);
 u_int	bsrl(u_int mask);
-void	cpu_invlpg(u_int addr);
-void	cpu_invlpg_range(u_int start, u_int end);
 void	disable_intr(void);
 void	do_cpuid(u_int ax, u_int *p);
 void	enable_intr(void);
 void	halt(void);
+void	ia32_pause(void);
 u_char	inb(u_int port);
 u_int	inl(u_int port);
 void	insb(u_int port, void *addr, size_t cnt);
 void	insl(u_int port, void *addr, size_t cnt);
 void	insw(u_int port, void *addr, size_t cnt);
+register_t	intr_disable(void);
+void	intr_restore(register_t ef);
 void	invd(void);
 void	invlpg(u_int addr);
-void	invlpg_range(u_int start, u_int end);
 void	invltlb(void);
 u_short	inw(u_int port);
+void	lidt(struct region_descriptor *addr);
+void	lldt(u_short sel);
 void	load_cr0(u_int cr0);
 void	load_cr3(u_int cr3);
 void	load_cr4(u_int cr4);
+void	load_dr0(u_int dr0);
+void	load_dr1(u_int dr1);
+void	load_dr2(u_int dr2);
+void	load_dr3(u_int dr3);
+void	load_dr4(u_int dr4);
+void	load_dr5(u_int dr5);
+void	load_dr6(u_int dr6);
+void	load_dr7(u_int dr7);
 void	load_fs(u_int sel);
 void	load_gs(u_int sel);
-struct region_descriptor;
-void	lidt(struct region_descriptor *addr);
-void	lldt(u_short sel);
 void	ltr(u_short sel);
 void	outb(u_int port, u_char data);
 void	outl(u_int port, u_int data);
-void	outsb(u_int port, void *addr, size_t cnt);
-void	outsl(u_int port, void *addr, size_t cnt);
-void	outsw(u_int port, void *addr, size_t cnt);
+void	outsb(u_int port, const void *addr, size_t cnt);
+void	outsl(u_int port, const void *addr, size_t cnt);
+void	outsw(u_int port, const void *addr, size_t cnt);
 void	outw(u_int port, u_short data);
-void	ia32_pause(void);
 u_int	rcr0(void);
 u_int	rcr2(void);
 u_int	rcr3(void);
 u_int	rcr4(void);
-u_int	rfs(void);
-u_int	rgs(void);
 u_int64_t rdmsr(u_int msr);
 u_int64_t rdpmc(u_int pmc);
-u_int64_t rdtsc(void);
-u_int	read_eflags(void);
-void	wbinvd(void);
-void	write_eflags(u_int ef);
-void	wrmsr(u_int msr, u_int64_t newval);
 u_int	rdr0(void);
-void	load_dr0(u_int dr0);
 u_int	rdr1(void);
-void	load_dr1(u_int dr1);
 u_int	rdr2(void);
-void	load_dr2(u_int dr2);
 u_int	rdr3(void);
-void	load_dr3(u_int dr3);
 u_int	rdr4(void);
-void	load_dr4(u_int dr4);
 u_int	rdr5(void);
-void	load_dr5(u_int dr5);
 u_int	rdr6(void);
-void	load_dr6(u_int dr6);
 u_int	rdr7(void);
-void	load_dr7(u_int dr7);
-register_t	intr_disable(void);
-void	intr_restore(register_t ef);
+u_int64_t rdtsc(void);
+u_int	read_eflags(void);
+u_int	rfs(void);
+u_int	rgs(void);
+void	wbinvd(void);
+void	write_eflags(u_int ef);
+void	wrmsr(u_int msr, u_int64_t newval);
 
 #endif	/* __GNUC__ */
 
 void    reset_dbregs(void);
 
-__END_DECLS
-
 #endif /* !_MACHINE_CPUFUNC_H_ */

==== //depot/projects/netperf_socket/sys/i386/include/critical.h#2 (text+ko) ====

@@ -33,7 +33,7 @@
  *	related support functions residing
  *	in <arch>/<arch>/critical.c	- prototyped
  *
- * $FreeBSD: src/sys/i386/include/critical.h,v 1.5 2003/11/03 21:06:54 jhb Exp $
+ * $FreeBSD: src/sys/i386/include/critical.h,v 1.6 2004/03/05 09:19:59 le Exp $
  */
 
 #ifndef _MACHINE_CRITICAL_H_
@@ -83,8 +83,8 @@
 
 #else /* !__GNUC__ */
 
-void cpu_critical_enter(void)
-void cpu_critical_exit(void)
+void cpu_critical_enter(void);
+void cpu_critical_exit(void);
 
 #endif	/* __GNUC__ */
 

==== //depot/projects/netperf_socket/sys/ia64/include/critical.h#2 (text+ko) ====

@@ -33,7 +33,7 @@
  *	related support functions residing
  *	in <arch>/<arch>/critical.c	- prototyped
  *
- * $FreeBSD: src/sys/ia64/include/critical.h,v 1.3 2003/08/12 23:24:04 imp Exp $
+ * $FreeBSD: src/sys/ia64/include/critical.h,v 1.4 2004/03/05 09:19:59 le Exp $
  */
 
 #ifndef _MACHINE_CRITICAL_H_
@@ -82,8 +82,8 @@
 
 #else /* !__GNUC__ */
 
-void cpu_critical_enter(void)
-void cpu_critical_exit(void)
+void cpu_critical_enter(void);
+void cpu_critical_exit(void);
 
 #endif	/* __GNUC__ */
 

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

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_exec.c,v 1.236 2004/02/18 00:54:17 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_exec.c,v 1.237 2004/03/05 22:38:26 jhb Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_mac.h"
@@ -253,12 +253,14 @@
 	 * that might allow a local user to illicitly obtain elevated
 	 * privileges.
 	 */
+	mtx_lock(&Giant);
 	PROC_LOCK(p);
 	KASSERT((p->p_flag & P_INEXEC) == 0,
 	    ("%s(): process already has P_INEXEC flag", __func__));
 	if (p->p_flag & P_SA || p->p_numthreads > 1) {
 		if (thread_single(SINGLE_EXIT)) {
 			PROC_UNLOCK(p);
+			mtx_unlock(&Giant);
 			return (ERESTART);	/* Try again later. */
 		}
 		/*
@@ -269,6 +271,7 @@
 		td->td_mailbox = NULL;
 		thread_single_end();
 	}
+	mtx_unlock(&Giant);
 	p->p_flag |= P_INEXEC;
 	PROC_UNLOCK(p);
 

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

@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.223 2004/02/27 18:39:09 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.224 2004/03/05 22:39:53 jhb Exp $");
 
 #include "opt_compat.h"
 #include "opt_ktrace.h"
@@ -97,7 +97,6 @@
 sys_exit(struct thread *td, struct sys_exit_args *uap)
 {
 
-	mtx_lock(&Giant);
 	exit1(td, W_EXITCODE(uap->rval, 0));
 	/* NOTREACHED */
 }
@@ -121,7 +120,12 @@
 #endif
 	struct plimit *plim;
 
-	GIANT_REQUIRED;
+	/*
+	 * Drop Giant if caller has it.  Eventually we should warn about
+	 * being called with Giant held.
+	 */ 
+	while (mtx_owned(&Giant))
+		mtx_unlock(&Giant);
 
 	p = td->td_proc;
 	if (p == initproc) {
@@ -133,6 +137,7 @@
 	/*
 	 * MUST abort all other threads before proceeding past here.
 	 */
+	mtx_lock(&Giant);
 	PROC_LOCK(p);
 	if (p->p_flag & P_SA || p->p_numthreads > 1) {
 		/*
@@ -167,6 +172,7 @@
 		p->p_flag &= ~P_SA;
 		thread_single_end();	/* Don't need this any more. */
 	}
+	mtx_unlock(&Giant);
 	/*
 	 * With this state set:
 	 * Any thread entering the kernel from userspace will thread_exit()
@@ -197,17 +203,23 @@
 	}
 
 #ifdef PGINPROF
+	mtx_lock(&Giant);
 	vmsizmon();
+	mtx_unlock(&Giant);
 #endif
-	STOPEVENT(p, S_EXIT, rv);
+	PROC_LOCK(p);
+	_STOPEVENT(p, S_EXIT, rv);
 	wakeup(&p->p_stype);	/* Wakeup anyone in procfs' PIOCWAIT */
+	PROC_UNLOCK(p);
 
 	/*
 	 * Check if any loadable modules need anything done at process exit.
 	 * e.g. SYSV IPC stuff
 	 * XXX what if one of these generates an error?
 	 */
+	mtx_lock(&Giant);
 	EVENTHANDLER_INVOKE(process_exit, p);
+	mtx_unlock(&Giant);
 
 	MALLOC(p->p_ru, struct rusage *, sizeof(struct rusage),
 		M_ZOMBIE, M_WAITOK);
@@ -238,6 +250,7 @@
 	 * Reset any sigio structures pointing to us as a result of
 	 * F_SETOWN with our pid.
 	 */
+	mtx_lock(&Giant);	/* XXX: not sure if needed */
 	funsetownlst(&p->p_sigiolst);
 
 	/*
@@ -245,6 +258,7 @@
 	 * This may block!
 	 */
 	fdfree(td);
+	mtx_unlock(&Giant);	
 
 	/*
 	 * Remove ourself from our leader's peer list and wake our leader.
@@ -259,6 +273,7 @@
 	}
 	mtx_unlock(&ppeers_lock);
 
+	mtx_lock(&Giant);	
 	/* The next two chunks should probably be moved to vmspace_exit. */
 	vm = p->p_vmspace;
 	/*
@@ -345,6 +360,7 @@
 	fixjobc(p, p->p_pgrp, 0);
 	sx_xunlock(&proctree_lock);
 	(void)acct_process(td);
+	mtx_unlock(&Giant);	
 #ifdef KTRACE
 	/*
 	 * release trace file
@@ -368,7 +384,9 @@
 	 */
 	if ((vtmp = p->p_textvp) != NULL) {
 		p->p_textvp = NULL;
+		mtx_lock(&Giant);	
 		vrele(vtmp);
+		mtx_unlock(&Giant);	
 	}
 
 	/*
@@ -424,6 +442,7 @@
 	 * Save exit status and final rusage info, adding in child rusage
 	 * info and self times.
 	 */
+	mtx_lock(&Giant);	
 	PROC_LOCK(p);
 	p->p_xstat = rv;
 	*p->p_ru = p->p_stats->p_ru;
@@ -436,6 +455,7 @@
 	 * Notify interested parties of our demise.
 	 */
 	KNOTE(&p->p_klist, NOTE_EXIT);
+	mtx_unlock(&Giant);	
 	/*
 	 * Just delete all entries in the p_klist. At this point we won't
 	 * report any more events, and there are nasty race conditions that
@@ -580,7 +600,6 @@
 	}
 	if (uap->options &~ (WUNTRACED|WNOHANG|WCONTINUED|WLINUXCLONE))
 		return (EINVAL);
-	mtx_lock(&Giant);
 loop:
 	nfound = 0;
 	sx_xlock(&proctree_lock);
@@ -649,7 +668,6 @@
 				wakeup(t);
 				PROC_UNLOCK(t);
 				sx_xunlock(&proctree_lock);
-				mtx_unlock(&Giant);
 				return (0);
 			}
 
@@ -669,6 +687,7 @@
 			 * all other writes to this proc are visible now, so
 			 * no more locking is needed for p.
 			 */
+			mtx_lock(&Giant);
 			PROC_LOCK(p);
 			p->p_xstat = 0;		/* XXX: why? */
 			PROC_UNLOCK(p);
@@ -677,6 +696,7 @@
 			PROC_UNLOCK(q);
 			FREE(p->p_ru, M_ZOMBIE);
 			p->p_ru = NULL;
+			mtx_unlock(&Giant);
 
 			/*
 			 * Decrement the count of procs running with this uid.
@@ -696,6 +716,7 @@
 			/*
 			 * do any thread-system specific cleanups
 			 */
+			mtx_lock(&Giant);
 			thread_wait(p);
 
 			/*
@@ -704,6 +725,7 @@
 			 * release while still running in process context.
 			 */
 			vm_waitproc(p);
+			mtx_unlock(&Giant);
 #ifdef MAC
 			mac_destroy_proc(p);
 #endif
@@ -713,7 +735,6 @@
 			sx_xlock(&allproc_lock);
 			nprocs--;
 			sx_xunlock(&allproc_lock);
-			mtx_unlock(&Giant);
 			return (0);
 		}
 		mtx_lock_spin(&sched_lock);
@@ -740,7 +761,6 @@
 				PROC_UNLOCK(p);
 				error = 0;
 			}
-			mtx_unlock(&Giant);
 			return (error);
 		}
 		mtx_unlock_spin(&sched_lock);
@@ -757,30 +777,25 @@
 			} else
 				error = 0;
 
-			mtx_unlock(&Giant);
 			return (error);
 		}
 		PROC_UNLOCK(p);
 	}
 	if (nfound == 0) {
 		sx_xunlock(&proctree_lock);
-		mtx_unlock(&Giant);
 		return (ECHILD);
 	}
 	if (uap->options & WNOHANG) {
 		sx_xunlock(&proctree_lock);
 		td->td_retval[0] = 0;
-		mtx_unlock(&Giant);
 		return (0);
 	}
 	PROC_LOCK(q);
 	sx_xunlock(&proctree_lock);
 	error = msleep(q, &q->p_mtx, PWAIT | PCATCH, "wait", 0);
 	PROC_UNLOCK(q);
-	if (error) {
-		mtx_unlock(&Giant);
-		return (error);
-	}
+	if (error)

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


More information about the p4-projects mailing list