PERFORCE change 42086 for review

Robert Watson rwatson at FreeBSD.org
Wed Nov 12 03:35:33 GMT 2003


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

Change 42086 by rwatson at rwatson_tislabs on 2003/11/11 19:34:40

	Integrate TrustedBSD MAC branch from TrustedBSD base branch:
	turnstiles, VFS mount changes, and loopback of (struct label)
	-> (struct label *) changes to MAC Framework.

Affected files ...

.. //depot/projects/trustedbsd/mac/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml#42 integrate
.. //depot/projects/trustedbsd/mac/sbin/init/init.8#8 integrate
.. //depot/projects/trustedbsd/mac/share/man/man4/Makefile#36 integrate
.. //depot/projects/trustedbsd/mac/share/man/man4/ddb.4#5 integrate
.. //depot/projects/trustedbsd/mac/share/man/man4/inet.4#8 integrate
.. //depot/projects/trustedbsd/mac/share/man/man4/intro.4#8 integrate
.. //depot/projects/trustedbsd/mac/share/man/man4/ips.4#1 branch
.. //depot/projects/trustedbsd/mac/share/man/man4/man4.i386/lnc.4#2 integrate
.. //depot/projects/trustedbsd/mac/share/man/man4/man4.i386/svr4.4#5 integrate
.. //depot/projects/trustedbsd/mac/sys/amd64/amd64/autoconf.c#3 integrate
.. //depot/projects/trustedbsd/mac/sys/conf/files#98 integrate
.. //depot/projects/trustedbsd/mac/sys/dev/sound/pcm/ac97.c#15 integrate
.. //depot/projects/trustedbsd/mac/sys/dev/usb/ohci.c#22 integrate
.. //depot/projects/trustedbsd/mac/sys/fs/devfs/devfs.h#13 integrate
.. //depot/projects/trustedbsd/mac/sys/i386/i386/mptable.c#2 integrate
.. //depot/projects/trustedbsd/mac/sys/ia64/ia64/interrupt.c#17 integrate
.. //depot/projects/trustedbsd/mac/sys/ia64/ia64/machdep.c#38 integrate
.. //depot/projects/trustedbsd/mac/sys/ia64/ia64/trap.c#22 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/kern_exec.c#68 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#429 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/kern_mutex.c#27 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/kern_thread.c#26 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/subr_turnstile.c#1 branch
.. //depot/projects/trustedbsd/mac/sys/kern/subr_witness.c#40 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/vfs_mount.c#25 integrate
.. //depot/projects/trustedbsd/mac/sys/modules/mac_stub/Makefile#3 integrate
.. //depot/projects/trustedbsd/mac/sys/net/bpfdesc.h#10 integrate
.. //depot/projects/trustedbsd/mac/sys/net/if_var.h#20 integrate
.. //depot/projects/trustedbsd/mac/sys/netinet/ip_var.h#19 integrate
.. //depot/projects/trustedbsd/mac/sys/nfsclient/nfs_vfsops.c#27 integrate
.. //depot/projects/trustedbsd/mac/sys/pci/agp.c#15 integrate
.. //depot/projects/trustedbsd/mac/sys/pci/agp_ali.c#7 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac/mac_internal.h#15 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac/mac_net.c#12 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac/mac_pipe.c#12 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac/mac_process.c#10 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac/mac_system.c#6 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac/mac_vfs.c#9 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_biba/mac_biba.c#229 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_lomac/mac_lomac.c#75 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_mls/mac_mls.c#184 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_partition/mac_partition.c#28 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_test/mac_test.c#119 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/_mutex.h#7 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/filedesc.h#15 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/mac.h#250 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/mount.h#30 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/pipe.h#10 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/proc.h#50 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/socketvar.h#35 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/turnstile.h#1 branch
.. //depot/projects/trustedbsd/mac/sys/sys/ucred.h#21 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/vnode.h#62 integrate

Differences ...

==== //depot/projects/trustedbsd/mac/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml#42 (text+ko) ====

@@ -29,7 +29,7 @@
 
 <sect1 id="support">
   <sect1info>
-    <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml,v 1.196 2003/11/09 23:42:51 bmah Exp $</pubdate>
+    <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml,v 1.197 2003/11/11 19:20:13 trhodes Exp $</pubdate>
   </sect1info>
 
   <title>Supported Devices</title>
@@ -430,7 +430,7 @@
     driver)
     </para>
 
-    <para arch="i386">IBM / Adaptec ServeRAID series (ips driver)</para>
+    <para arch="i386">IBM / Adaptec ServeRAID series (&man.ips.4; driver)</para>
 
     <para arch="i386,alpha,pc98,sparc64,ia64">LSI Logic Fusion/MP
 	architecture Fiber Channel controllers (&man.mpt.4; driver)</para>

==== //depot/projects/trustedbsd/mac/sbin/init/init.8#8 (text+ko) ====

@@ -33,7 +33,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)init.8	8.3 (Berkeley) 4/18/94
-.\" $FreeBSD: src/sbin/init/init.8,v 1.39 2003/06/08 12:50:49 charnier Exp $
+.\" $FreeBSD: src/sbin/init/init.8,v 1.40 2003/11/11 18:37:50 kensmith Exp $
 .\"
 .Dd April 18, 1994
 .Dt INIT 8
@@ -151,9 +151,24 @@
 using
 .Xr sysctl 8
 to set the
-.Dq kern.securelevel
+.Va kern.securelevel
 variable to the required security level.
 .Pp
+If
+.Nm
+is run in a jail the security level of the
+.Dq host system
+will not be effected.
+Part of the information set up in the kernel to support a jail
+is a per-jail
+.Dq securelevel
+setting.
+This allows running a higher security level inside of a jail
+than that of the host system.
+See
+.Xr jail 8
+for more information about jails.
+.Pp
 In multi-user operation,
 .Nm
 maintains
@@ -383,6 +398,7 @@
 .Xr getty 8 ,
 .Xr halt 8 ,
 .Xr ipfw 8 ,
+.Xr jail 8 ,
 .Xr rc 8 ,
 .Xr reboot 8 ,
 .Xr shutdown 8 ,

==== //depot/projects/trustedbsd/mac/share/man/man4/Makefile#36 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
-# $FreeBSD: src/share/man/man4/Makefile,v 1.238 2003/11/10 21:26:52 hmp Exp $
+# $FreeBSD: src/share/man/man4/Makefile,v 1.239 2003/11/11 18:48:02 trhodes Exp $
 
 MAN=	aac.4 \
 	acpi.4 \
@@ -96,6 +96,7 @@
 	ip.4 \
 	ip6.4 \
 	ipfirewall.4 \
+	ips.4 \
 	ipsec.4 \
 	isp.4 \
 	ispfw.4 \

==== //depot/projects/trustedbsd/mac/share/man/man4/ddb.4#5 (text+ko) ====

@@ -57,7 +57,7 @@
 .\" 	Created.
 .\" 	[90/08/30            dbg]
 .\"
-.\" $FreeBSD: src/share/man/man4/ddb.4,v 1.23 2003/10/14 02:47:23 imp Exp $
+.\" $FreeBSD: src/share/man/man4/ddb.4,v 1.24 2003/11/12 02:35:20 hmp Exp $
 .Dd January 16, 1996
 .Dt DDB 4
 .Os
@@ -312,7 +312,8 @@
 point at the low-level code paths may also cause strange behavior.
 .It Cm delete Ar addr
 .It Cm delete Li \&# Ns Ar number
-Delete the break point.  The target break point can be specified by a
+Delete the break point.
+The target break point can be specified by a
 break point number with
 .Li # ,
 or by using the same
@@ -520,7 +521,10 @@
 .It Li maxwidth
 The width of the displayed line.
 .It Li lines
-The number of lines.  It is used by "more" feature.
+The number of lines.
+It is used by
+.Dq more
+feature.
 .It Li tabstops
 Tab stop width.
 .It Li work Ns Ar xx
@@ -583,7 +587,8 @@
 a binary operator which rounds up the left hand side to the next
 multiple of right hand side.
 .It Li \&* Ns Em expr
-indirection.  It may be followed by a
+indirection.
+It may be followed by a
 .Sq Li :
 and modifiers as described above.
 .El

==== //depot/projects/trustedbsd/mac/share/man/man4/inet.4#8 (text+ko) ====

@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)inet.4	8.1 (Berkeley) 6/5/93
-.\" $FreeBSD: src/share/man/man4/inet.4,v 1.25 2003/10/14 02:59:13 imp Exp $
+.\" $FreeBSD: src/share/man/man4/inet.4,v 1.26 2003/11/12 02:35:20 hmp Exp $
 .\"
 .Dd February 14, 1995
 .Dt INET 4
@@ -297,7 +297,8 @@
 .Re
 .Sh CAVEAT
 The Internet protocol support is subject to change as
-the Internet protocols develop.  Users should not depend
+the Internet protocols develop.
+Users should not depend
 on details of the current implementation, but rather
 the services exported.
 .Sh HISTORY

==== //depot/projects/trustedbsd/mac/share/man/man4/intro.4#8 (text+ko) ====

@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/intro.4,v 1.27 2003/06/28 23:53:37 ru Exp $
+.\" $FreeBSD: src/share/man/man4/intro.4,v 1.28 2003/11/12 02:35:20 hmp Exp $
 .\"
 .Dd January 20, 1996
 .Dt INTRO 4
@@ -149,8 +149,8 @@
 .Xr config 8
 for a detailed description of the files involved.
 The individual manual pages in this section provide a sample line for the
-configuration file in their synopsis portion.  See also the sample
-config file
+configuration file in their synopsis portion.
+See also the sample config file
 .Pa /sys/i386/conf/LINT
 (for the
 .Em i386

==== //depot/projects/trustedbsd/mac/share/man/man4/man4.i386/lnc.4#2 (text+ko) ====

@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/man4.i386/lnc.4,v 1.20 2001/10/13 09:08:37 yokota Exp $
+.\" $FreeBSD: src/share/man/man4/man4.i386/lnc.4,v 1.21 2003/11/12 02:35:20 hmp Exp $
 .\"
 .Dd January 19, 1997
 .Dt LNC 4 i386
@@ -68,20 +68,24 @@
 .Sh DIAGNOSTICS
 .Bl -diag
 .It "lnc%d: Framing error"
-A framing error occurred.  This means a CRC error also occurred.
+A framing error occurred.
+This means a CRC error also occurred.
 This caused the driver to drop the packet that contained the framing error.
 .It "lnc%d: Receive CRC error
 The received Ethernet frame failed the CRC checksum.
 This caused the driver to drop the packet that failed the checksum.
 .It "lnc%d: Packet dropped, no mbufs"
-The driver ran out of mbuf's.  This may suggest a resource problem.
+The driver ran out of mbuf's.
+This may suggest a resource problem.
 .It "lnc%d: Couldn't allocate memory for NIC"
-This is a fatal error.  The driver will not attach to the card under this
+This is a fatal error.
+The driver will not attach to the card under this
 circumstance.
 .It "lnc%d: Memory allocated above 16Mb limit"
 ISA and ESIA cards require bounce buffers for DMA transfers above 16mb.
 The Am7990 and Am79C960 only have 24 address lines and so can only access
-the lower 16Mb of physical memory.  The
+the lower 16Mb of physical memory.
+The
 .Nm
 driver assumes the memory it allocates is within the lower 16Mb range.
 This is not a very valid assumption but there's nothing that can be done
@@ -89,7 +93,8 @@
 For shared memory NICs this isn't relevant.
 .It "lnc%d: Device timeout -- Resetting"
 The device has stopped responding to the network, or there is a problem with
-the network connection (cable).   Make sure the network connection in use
+the network connection (cable).
+Make sure the network connection in use
 is the same one the card is configured for.
 .It "lnc%d: Transmit late collision  -- Net error?"
 .It "lnc%d: Loss of carrier during transmit -- Net error?"

==== //depot/projects/trustedbsd/mac/share/man/man4/man4.i386/svr4.4#5 (text+ko) ====

@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/man4.i386/svr4.4,v 1.9 2003/10/28 05:22:19 tjr Exp $
+.\" $FreeBSD: src/share/man/man4/man4.i386/svr4.4,v 1.10 2003/11/12 02:35:20 hmp Exp $
 .Dd October 28, 2003
 .Dt SVR4 4 i386
 .Os
@@ -141,7 +141,9 @@
 .Pa /compat/svr4/dev .
 Internally, the
 .Xr streams 4
-driver produces a socket descriptor and "tags" it with additional STREAMS
+driver produces a socket descriptor and
+.Dq tags
+it with additional STREAMS
 state information before returning it to the client application.
 The
 .Nm
@@ -177,9 +179,11 @@
 .Pp
 Extensive testing has only really been carried out with Solaris 2.x binaries,
 with anecdotal reports of limited success coming from testers with
-early-revision SCO media.  In theory, the basic SVR4 ABI should be constant
+early-revision SCO media.
+In theory, the basic SVR4 ABI should be constant
 across the set of vendors who produce SVR4 operating systems, but in
-practice that's probably not the case.  If necessary, future work can
+practice that's probably not the case.
+If necessary, future work can
 either implement additional
 .Xr kld 4
 modules which produce functionality which contains OS-dependent
@@ -187,7 +191,9 @@
 ABI implementation.
 Alternatively,
 .Xr sysctl 8
-variables could set the "personality" the environment should present to
+variables could set the
+.Dq personality
+the environment should present to
 client applications.
 .Sh FILES
 .Bl -tag -width /sys/compat/svr4/syscalls.master -compact

==== //depot/projects/trustedbsd/mac/sys/amd64/amd64/autoconf.c#3 (text+ko) ====

@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/autoconf.c,v 1.174 2003/07/25 21:15:44 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/autoconf.c,v 1.175 2003/11/12 01:49:49 peter Exp $");
 
 /*
  * Setup the system to run on the current machine.
@@ -155,6 +155,8 @@
 {
 
 	cninit_finish(); 
+	if (bootverbose)
+		printf("Device configuration finished.\n");
 	cold = 0;
 }
 

==== //depot/projects/trustedbsd/mac/sys/conf/files#98 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.847 2003/11/11 18:58:53 ume Exp $
+# $FreeBSD: src/sys/conf/files,v 1.849 2003/11/12 03:14:28 rwatson Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -1154,6 +1154,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/trustedbsd/mac/sys/dev/sound/pcm/ac97.c#15 (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/trustedbsd/mac/sys/dev/usb/ohci.c#22 (text+ko) ====

@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/ohci.c,v 1.137 2003/11/10 00:20:52 joe Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/ohci.c,v 1.138 2003/11/12 01:40:11 joe Exp $");
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -1475,7 +1475,7 @@
 			printf("ohci_softintr: sitd=%p is done\n", sitd);
 		sitd->isdone = 1;
 #endif
-		struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
+		opipe = (struct ohci_pipe *)xfer->pipe;
 		if (opipe->aborting)
 			continue;
  

==== //depot/projects/trustedbsd/mac/sys/fs/devfs/devfs.h#13 (text+ko) ====

@@ -33,7 +33,7 @@
  *	@(#)kernfs.h	8.6 (Berkeley) 3/29/95
  * From: FreeBSD: src/sys/miscfs/kernfs/kernfs.h 1.14
  *
- * $FreeBSD: src/sys/fs/devfs/devfs.h,v 1.17 2002/12/09 03:44:27 rwatson Exp $
+ * $FreeBSD: src/sys/fs/devfs/devfs.h,v 1.18 2003/11/12 03:14:29 rwatson Exp $
  */
 
 #ifndef _FS_DEVFS_DEVFS_H_

==== //depot/projects/trustedbsd/mac/sys/i386/i386/mptable.c#2 (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/trustedbsd/mac/sys/ia64/ia64/interrupt.c#17 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/ia64/ia64/interrupt.c,v 1.41 2003/09/10 22:49:38 marcel Exp $ */
+/* $FreeBSD: src/sys/ia64/ia64/interrupt.c,v 1.42 2003/11/12 01:26:02 marcel Exp $ */
 /* $NetBSD: interrupt.c,v 1.23 1998/02/24 07:38:01 thorpej Exp $ */
 
 /*
@@ -200,8 +200,12 @@
 		asts[PCPU_GET(cpuid)]++;
 		CTR1(KTR_SMP, "IPI_AST, cpuid=%d", PCPU_GET(cpuid));
 	} else if (vector == ipi_vector[IPI_HIGH_FP]) {
-		if (PCPU_GET(fpcurthread) != NULL)
-			ia64_highfp_save(PCPU_GET(fpcurthread));
+		struct thread *thr = PCPU_GET(fpcurthread);
+		if (thr != NULL) {
+			save_high_fp(&thr->td_pcb->pcb_high_fp);
+			thr->td_pcb->pcb_fpcpu = NULL;
+			PCPU_SET(fpcurthread, NULL);
+		}
 	} else if (vector == ipi_vector[IPI_RENDEZVOUS]) {
 		rdvs[PCPU_GET(cpuid)]++;
 		CTR1(KTR_SMP, "IPI_RENDEZVOUS, cpuid=%d", PCPU_GET(cpuid));

==== //depot/projects/trustedbsd/mac/sys/ia64/ia64/machdep.c#38 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/ia64/ia64/machdep.c,v 1.168 2003/11/11 09:53:37 marcel Exp $
+ * $FreeBSD: src/sys/ia64/ia64/machdep.c,v 1.169 2003/11/12 01:26:02 marcel Exp $
  */
 
 #include "opt_compat.h"
@@ -311,6 +311,8 @@
 #if IA32
 	ia32_savectx(oldpcb);
 #endif
+	if (PCPU_GET(fpcurthread) == old)
+		old->td_frame->tf_special.psr |= IA64_PSR_DFH;
 	if (!savectx(oldpcb)) {
 		newpcb = new->td_pcb;
 		oldpcb->pcb_current_pmap =
@@ -319,6 +321,8 @@
 #if IA32
 		ia32_restorectx(newpcb);
 #endif
+		if (PCPU_GET(fpcurthread) == new)
+			new->td_frame->tf_special.psr &= ~IA64_PSR_DFH;
 		restorectx(newpcb);
 		/* We should not get here. */
 		panic("cpu_switch: restorectx() returned");

==== //depot/projects/trustedbsd/mac/sys/ia64/ia64/trap.c#22 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/ia64/ia64/trap.c,v 1.93 2003/10/28 19:38:26 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/ia64/ia64/trap.c,v 1.94 2003/11/12 01:26:02 marcel Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ktrace.h"
@@ -570,81 +570,54 @@
 		if (!user)
 			trap_panic(vector, framep);
 
+		critical_enter();
+		thr = PCPU_GET(fpcurthread);
+		if (thr == td) {
+			/*
+			 * Short-circuit handling the trap when this CPU
+			 * already holds the high FP registers for this
+			 * thread.  We really shouldn't get the trap in the
+			 * first place, but since it's only a performance
+			 * issue and not a correctness issue, we emit a
+			 * message for now, enable the high FP registers and
+			 * return.
+			 */
+			printf("XXX: bogusly disabled high FP regs\n");
+			framep->tf_special.psr &= ~IA64_PSR_DFH;
+			critical_exit();
+			goto out;
+		} else if (thr != NULL) {
+			pcb = thr->td_pcb;
+			save_high_fp(&pcb->pcb_high_fp);
+			pcb->pcb_fpcpu = NULL;
+			PCPU_SET(fpcurthread, NULL);
+			thr = NULL;
+		}
+
 		pcb = td->td_pcb;
 		pcpu = pcb->pcb_fpcpu;
 
-#if 0
-		printf("XXX: td %p: highfp on cpu %p\n", td, pcpu);
-#endif
-
-		/*
-		 * The pcpu variable holds the address of the per-CPU
-		 * structure of the CPU currently holding this threads
-		 * high FP registers (or NULL if no CPU holds these
-		 * registers). We have to interrupt that CPU and wait
-		 * for it to have saved the registers.
-		 */
+#ifdef SMP
 		if (pcpu != NULL) {
-			thr = pcpu->pc_fpcurthread;
-			KASSERT(thr == td, ("High FP state out of sync"));
-
-			if (pcpu == pcpup) {
-				/*
-				 * Short-circuit handling the trap when this
-				 * CPU already holds the high FP registers for
-				 * this thread. We really shouldn't get the
-				 * trap in the first place, but since it's
-				 * only a performance issue and not a
-				 * correctness issue, we emit a message for
-				 * now, enable the high FP registers and
-				 * return.
-				 */
-				printf("XXX: bogusly disabled high FP regs\n");
-				framep->tf_special.psr &= ~IA64_PSR_DFH;
-				goto out;
-			}
-#ifdef SMP
-			/*
-			 * Interrupt the other CPU so that it saves the high
-			 * FP registers of this thread. Note that this can
-			 * only happen for the SMP case.
-			 */
 			ipi_send(pcpu->pc_lid, IPI_HIGH_FP);
-#endif
-#ifdef DIAGNOSTICS
-		} else {
-			KASSERT(PCPU_GET(fpcurthread) != td,
-			    ("High FP state out of sync"));
-#endif
+			critical_exit();
+			while (pcb->pcb_fpcpu != pcpu)
+				DELAY(100);
+			critical_enter();
+			pcpu = pcb->pcb_fpcpu;
+			thr = PCPU_GET(fpcurthread);
 		}
-
-		thr = PCPU_GET(fpcurthread);
-
-#if 0
-		printf("XXX: cpu %p: highfp belongs to td %p\n", pcpup, thr);
 #endif
 
-		/*
-		 * The thr variable holds the thread that owns the high FP
-		 * registers currently on this CPU. Free this CPU so that
-		 * we can load the current threads high FP registers.
-		 */
-		if (thr != NULL) {
-			KASSERT(thr != td, ("High FP state out of sync"));
-			pcb = thr->td_pcb;
-			KASSERT(pcb->pcb_fpcpu == pcpup,
-			    ("High FP state out of sync"));
-			ia64_highfp_save(thr);
+		if (thr == NULL && pcpu == NULL) {
+			restore_high_fp(&pcb->pcb_high_fp);
+			PCPU_SET(fpcurthread, td);
+			pcb->pcb_fpcpu = pcpup;
+			framep->tf_special.psr &= ~IA64_PSR_MFH;
+			framep->tf_special.psr &= ~IA64_PSR_DFH;
 		}
 
-		/*
-		 * Wait for the other CPU to have saved out high FP
-		 * registers (if applicable).
-		 */
-		while (pcpu && pcpu->pc_fpcurthread == td);
-
-		ia64_highfp_load(td);
-		framep->tf_special.psr &= ~IA64_PSR_DFH;
+		critical_exit();
 		goto out;
 	}
 

==== //depot/projects/trustedbsd/mac/sys/kern/kern_exec.c#68 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_exec.c,v 1.231 2003/10/21 01:13:49 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_exec.c,v 1.232 2003/11/12 03:14:29 rwatson Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_mac.h"

==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#429 (text+ko) ====

@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_mac.c,v 1.104 2003/11/11 03:40:04 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_mac.c,v 1.105 2003/11/12 03:14:29 rwatson Exp $");
 
 #include "opt_mac.h"
 #include "opt_devfs.h"
@@ -1025,7 +1025,6 @@
 
 	NDFREE(&nd, 0);
 	mtx_unlock(&Giant);				/* VFS */
-
 out:
 	mac_vnode_label_free(intlabel);
 	return (error);

==== //depot/projects/trustedbsd/mac/sys/kern/kern_mutex.c#27 (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;

>>> TRUNCATED FOR MAIL (1000 lines) <<<
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list