PERFORCE change 19828 for review
Robert Watson
rwatson at freebsd.org
Mon Oct 21 20:44:49 GMT 2002
http://perforce.freebsd.org/chv.cgi?CH=19828
Change 19828 by rwatson at rwatson_paprika on 2002/10/21 13:44:11
IFC TrustedBSD base to TrustedBSD MAC: loop back more in the
way of MAC changes, including Biba/MLS compartments, which are
now in the main tree.
Affected files ...
.. //depot/projects/trustedbsd/mac/sys/fs/msdosfs/bootsect.h#3 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/kern_mutex.c#16 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/subr_disk.c#11 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_biba/mac_biba.c#146 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_biba/mac_biba.h#9 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_mls/mac_mls.c#128 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_mls/mac_mls.h#10 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/mac.h#183 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/proc.h#26 integrate
Differences ...
==== //depot/projects/trustedbsd/mac/sys/fs/msdosfs/bootsect.h#3 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/fs/msdosfs/bootsect.h,v 1.9 2001/11/28 16:56:42 jhb Exp $ */
+/* $FreeBSD: src/sys/fs/msdosfs/bootsect.h,v 1.10 2002/10/21 19:00:50 jhb Exp $ */
/* $NetBSD: bootsect.h,v 1.9 1997/11/17 15:36:17 ws Exp $ */
/*
@@ -59,7 +59,7 @@
struct bootsector710 {
u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
int8_t bsOEMName[8]; /* OEM name and version */
- int8_t bsPBP[53]; /* BIOS parameter block */
+ int8_t bsBPB[53]; /* BIOS parameter block */
int8_t bsExt[26]; /* Bootsector Extension */
int8_t bsBootCode[418]; /* pad so structure is 512b */
u_int8_t bsBootSectSig2; /* 2 & 3 are only defined for FAT32? */
==== //depot/projects/trustedbsd/mac/sys/kern/kern_mutex.c#16 (text+ko) ====
@@ -27,7 +27,7 @@
*
* from BSDI $Id: mutex_witness.c,v 1.1.2.20 2000/04/27 03:10:27 cp Exp $
* and BSDI $Id: synch_machdep.c,v 2.3.2.39 2000/04/27 03:10:25 cp Exp $
- * $FreeBSD: src/sys/kern/kern_mutex.c,v 1.112 2002/10/12 05:32:23 jeff Exp $
+ * $FreeBSD: src/sys/kern/kern_mutex.c,v 1.113 2002/10/21 18:48:28 des Exp $
*/
/*
@@ -215,14 +215,17 @@
&mutex_prof_enable, 0, "Enable tracing of mutex holdtime");
struct mutex_prof {
- const char *name;
- const char *file;
- int line;
+ const char *name;
+ const char *file;
+ int line;
+ /*
+ * XXX should use specialized struct members instead of an array
+ * and these silly #defines.
+ */
#define MPROF_MAX 0
#define MPROF_TOT 1
#define MPROF_CNT 2
-#define MPROF_AVG 3
- uintmax_t counter[4];
+ uintmax_t counter[3];
struct mutex_prof *next;
};
@@ -232,10 +235,10 @@
*
* Note: NUM_MPROF_BUFFERS must be smaller than MPROF_HASH_SIZE.
*/
-#define NUM_MPROF_BUFFERS 1000
+#define NUM_MPROF_BUFFERS 1000
static struct mutex_prof mprof_buf[NUM_MPROF_BUFFERS];
static int first_free_mprof_buf;
-#define MPROF_HASH_SIZE 1009
+#define MPROF_HASH_SIZE 1009
static struct mutex_prof *mprof_hash[MPROF_HASH_SIZE];
static int mutex_prof_acquisitions;
@@ -279,19 +282,27 @@
int error, i;
if (first_free_mprof_buf == 0)
- return SYSCTL_OUT(req, "No locking recorded",
- sizeof("No locking recorded"));
+ return (SYSCTL_OUT(req, "No locking recorded",
+ sizeof("No locking recorded")));
sb = sbuf_new(NULL, NULL, 1024, SBUF_AUTOEXTEND);
- sbuf_printf(sb, "%12s %12s %12s %12s %s\n",
- "max", "total", "count", "average", "name");
+ sbuf_printf(sb, "%6s %12s %11s %5s %s\n",
+ "max", "total", "count", "avg", "name");
+ /*
+ * XXX this spinlock seems to be by far the largest perpetrator
+ * of spinlock latency (1.6 msec on an Athlon1600 was recorded
+ * even before I pessimized it further by moving the average
+ * computation here).
+ */
mtx_lock_spin(&mprof_mtx);
for (i = 0; i < first_free_mprof_buf; ++i)
- sbuf_printf(sb, "%12ju %12ju %12ju %12ju %s:%d (%s)\n",
+ sbuf_printf(sb, "%6ju %12ju %11ju %5ju %s:%d (%s)\n",
mprof_buf[i].counter[MPROF_MAX] / 1000,
mprof_buf[i].counter[MPROF_TOT] / 1000,
mprof_buf[i].counter[MPROF_CNT],
- mprof_buf[i].counter[MPROF_AVG] / 1000,
+ mprof_buf[i].counter[MPROF_CNT] == 0 ? (uintmax_t)0 :
+ mprof_buf[i].counter[MPROF_TOT] /
+ (mprof_buf[i].counter[MPROF_CNT] * 1000),
mprof_buf[i].file, mprof_buf[i].line, mprof_buf[i].name);
mtx_unlock_spin(&mprof_mtx);
sbuf_finish(sb);
@@ -299,7 +310,7 @@
sbuf_delete(sb);
return (error);
}
-SYSCTL_PROC(_debug_mutex_prof, OID_AUTO, stats, CTLTYPE_STRING|CTLFLAG_RD,
+SYSCTL_PROC(_debug_mutex_prof, OID_AUTO, stats, CTLTYPE_STRING | CTLFLAG_RD,
NULL, 0, dump_mutex_prof_stats, "A", "Mutex profiling statistics");
#endif
@@ -384,14 +395,12 @@
}
/*
* Record if the mutex has been held longer now than ever
- * before
+ * before.
*/
- if ((now - acqtime) > mpp->counter[MPROF_MAX])
+ if (now - acqtime > mpp->counter[MPROF_MAX])
mpp->counter[MPROF_MAX] = now - acqtime;
mpp->counter[MPROF_TOT] += now - acqtime;
- mpp->counter[MPROF_CNT] += 1;
- mpp->counter[MPROF_AVG] =
- mpp->counter[MPROF_TOT] / mpp->counter[MPROF_CNT];
+ mpp->counter[MPROF_CNT]++;
unlock:
mtx_unlock_spin(&mprof_mtx);
}
==== //depot/projects/trustedbsd/mac/sys/kern/subr_disk.c#11 (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/kern/subr_disk.c,v 1.63 2002/10/17 23:48:29 sobomax Exp $
+ * $FreeBSD: src/sys/kern/subr_disk.c,v 1.64 2002/10/21 18:40:40 cognet Exp $
*
*/
@@ -22,7 +22,6 @@
#include <sys/disklabel.h>
#ifdef NO_GEOM
#include <sys/kernel.h>
-#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/sysctl.h>
#include <machine/md_var.h>
==== //depot/projects/trustedbsd/mac/sys/security/mac_biba/mac_biba.c#146 (text+ko) ====
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/security/mac_biba/mac_biba.c,v 1.22 2002/10/21 17:05:48 rwatson Exp $
+ * $FreeBSD: src/sys/security/mac_biba/mac_biba.c,v 1.24 2002/10/21 18:42:00 rwatson Exp $
*/
/*
==== //depot/projects/trustedbsd/mac/sys/security/mac_biba/mac_biba.h#9 (text+ko) ====
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/security/mac_biba/mac_biba.h,v 1.1 2002/07/31 18:07:43 rwatson Exp $
+ * $FreeBSD: src/sys/security/mac_biba/mac_biba.h,v 1.2 2002/10/21 18:42:00 rwatson Exp $
*/
/*
* Definitions for the TrustedBSD Biba integrity policy module.
==== //depot/projects/trustedbsd/mac/sys/security/mac_mls/mac_mls.c#128 (text+ko) ====
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/security/mac_mls/mac_mls.c,v 1.19 2002/10/21 17:01:30 rwatson Exp $
+ * $FreeBSD: src/sys/security/mac_mls/mac_mls.c,v 1.22 2002/10/21 18:42:00 rwatson Exp $
*/
/*
==== //depot/projects/trustedbsd/mac/sys/security/mac_mls/mac_mls.h#10 (text+ko) ====
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/security/mac_mls/mac_mls.h,v 1.1 2002/07/31 18:07:44 rwatson Exp $
+ * $FreeBSD: src/sys/security/mac_mls/mac_mls.h,v 1.2 2002/10/21 18:42:01 rwatson Exp $
*/
/*
* Definitions for the TrustedBSD MLS confidentiality policy module.
==== //depot/projects/trustedbsd/mac/sys/sys/mac.h#183 (text+ko) ====
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/sys/mac.h,v 1.14 2002/10/06 14:39:15 rwatson Exp $
+ * $FreeBSD: src/sys/sys/mac.h,v 1.15 2002/10/21 18:42:00 rwatson Exp $
*/
/*
* Userland/kernel interface for Mandatory Access Control.
@@ -113,9 +113,7 @@
* will enable the definitions in various policy include files once
* these can be disabled.
*/
-
#define MAC_BIBA_MAX_COMPARTMENTS 256
-
struct mac_biba_element {
u_short mbe_type;
u_short mbe_grade;
@@ -129,7 +127,6 @@
};
#define MAC_MLS_MAX_COMPARTMENTS 256
-
struct mac_mls_element {
u_short mme_type;
u_short mme_level;
==== //depot/projects/trustedbsd/mac/sys/sys/proc.h#26 (text+ko) ====
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)proc.h 8.15 (Berkeley) 5/19/95
- * $FreeBSD: src/sys/sys/proc.h,v 1.271 2002/10/15 00:14:32 jhb Exp $
+ * $FreeBSD: src/sys/sys/proc.h,v 1.272 2002/10/21 18:37:34 julian Exp $
*/
#ifndef _SYS_PROC_H_
@@ -448,8 +448,9 @@
#define KEF_USER 0x00200 /* Process is not officially in the kernel */
#define KEF_ASTPENDING 0x00400 /* KSE has a pending ast. */
#define KEF_NEEDRESCHED 0x00800 /* Process needs to yield. */
-#define KEF_ONLOANQ 0x01000 /* KSE is on loan queue */
+#define KEF_ONLOANQ 0x01000 /* KSE is on loan queue. */
#define KEF_DIDRUN 0x02000 /* KSE actually ran. */
+#define KEF_EXIT 0x04000 /* KSE is being killed. */
/*
* (*) A bound KSE with a bound thread in a KSE process may be lent to
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