CVS commit: [matt-nb5-mips64] src/sys/kern

2014-03-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Mar 24 07:36:48 UTC 2014

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_evcnt.c

Log Message:
Fix infinite recursion.


To generate a diff of this commit:
cvs rdiff -u -r1.4.94.3 -r1.4.94.4 src/sys/kern/subr_evcnt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_evcnt.c
diff -u src/sys/kern/subr_evcnt.c:1.4.94.3 src/sys/kern/subr_evcnt.c:1.4.94.4
--- src/sys/kern/subr_evcnt.c:1.4.94.3	Sat Feb 15 10:13:24 2014
+++ src/sys/kern/subr_evcnt.c	Mon Mar 24 07:36:48 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.4.94.3 2014/02/15 10:13:24 matt Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.4.94.4 2014/03/24 07:36:48 matt Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_evcnt.c,v 1.4.94.3 2014/02/15 10:13:24 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_evcnt.c,v 1.4.94.4 2014/03/24 07:36:48 matt Exp $);
 
 #include opt_ddb.h
 
@@ -153,7 +153,7 @@ evcnt_attach_dynamic(struct evcnt *ev, i
 const char *group, const char *name)
 {
 	memset(ev, 0, sizeof *ev);
-	evcnt_attach_dynamic(ev, type, parent, group, name);
+	evcnt_attach_dynamic_nozero(ev, type, parent, group, name);
 }
 
 void



CVS commit: [matt-nb5-mips64] src/sys/kern

2014-03-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Mar 24 18:51:45 UTC 2014

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_runq.c

Log Message:
Use the cpu_name in ci_data


To generate a diff of this commit:
cvs rdiff -u -r1.22.4.3.4.2 -r1.22.4.3.4.3 src/sys/kern/kern_runq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_runq.c
diff -u src/sys/kern/kern_runq.c:1.22.4.3.4.2 src/sys/kern/kern_runq.c:1.22.4.3.4.3
--- src/sys/kern/kern_runq.c:1.22.4.3.4.2	Sat Feb  5 06:00:14 2011
+++ src/sys/kern/kern_runq.c	Mon Mar 24 18:51:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_runq.c,v 1.22.4.3.4.2 2011/02/05 06:00:14 cliff Exp $	*/
+/*	$NetBSD: kern_runq.c,v 1.22.4.3.4.3 2014/03/24 18:51:45 matt Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008 Mindaugas Rasiukevicius rmind at NetBSD org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_runq.c,v 1.22.4.3.4.2 2011/02/05 06:00:14 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_runq.c,v 1.22.4.3.4.3 2014/03/24 18:51:45 matt Exp $);
 
 #include opt_multiprocessor.h
 
@@ -145,7 +145,6 @@ sched_cpuattach(struct cpu_info *ci)
 	runqueue_t *ci_rq;
 	void *rq_ptr;
 	u_int i, size;
-	char *cpuname;
 
 	if (ci-ci_schedstate.spc_lwplock == NULL) {
 		ci-ci_schedstate.spc_lwplock =
@@ -178,17 +177,14 @@ sched_cpuattach(struct cpu_info *ci)
 
 	ci-ci_schedstate.spc_sched_info = ci_rq;
 
-	cpuname = kmem_alloc(8, KM_SLEEP);
-	snprintf(cpuname, 8, cpu%d, cpu_index(ci));
-
 	evcnt_attach_dynamic(ci_rq-r_ev_pull, EVCNT_TYPE_MISC, NULL,
-	   cpuname, runqueue pull);
+	ci-ci_data.cpu_name, runqueue pull);
 	evcnt_attach_dynamic(ci_rq-r_ev_push, EVCNT_TYPE_MISC, NULL,
-	   cpuname, runqueue push);
+	ci-ci_data.cpu_name, runqueue push);
 	evcnt_attach_dynamic(ci_rq-r_ev_stay, EVCNT_TYPE_MISC, NULL,
-	   cpuname, runqueue stay);
+	ci-ci_data.cpu_name, runqueue stay);
 	evcnt_attach_dynamic(ci_rq-r_ev_localize, EVCNT_TYPE_MISC, NULL,
-	   cpuname, runqueue localize);
+	ci-ci_data.cpu_name, runqueue localize);
 }
 
 /*



CVS commit: [matt-nb5-mips64] src/sys/kern

2014-03-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Mar 24 07:36:48 UTC 2014

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_evcnt.c

Log Message:
Fix infinite recursion.


To generate a diff of this commit:
cvs rdiff -u -r1.4.94.3 -r1.4.94.4 src/sys/kern/subr_evcnt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2014-03-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Mar 24 18:51:45 UTC 2014

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_runq.c

Log Message:
Use the cpu_name in ci_data


To generate a diff of this commit:
cvs rdiff -u -r1.22.4.3.4.2 -r1.22.4.3.4.3 src/sys/kern/kern_runq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2014-03-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 14 21:45:42 UTC 2014

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_malloc.c

Log Message:
Make sure uvm_km_suballoc returned the correctly sized submap.


To generate a diff of this commit:
cvs rdiff -u -r1.121.10.1 -r1.121.10.2 src/sys/kern/kern_malloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_malloc.c
diff -u src/sys/kern/kern_malloc.c:1.121.10.1 src/sys/kern/kern_malloc.c:1.121.10.2
--- src/sys/kern/kern_malloc.c:1.121.10.1	Wed Apr 21 00:28:16 2010
+++ src/sys/kern/kern_malloc.c	Fri Mar 14 21:45:41 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_malloc.c,v 1.121.10.1 2010/04/21 00:28:16 matt Exp $	*/
+/*	$NetBSD: kern_malloc.c,v 1.121.10.2 2014/03/14 21:45:41 matt Exp $	*/
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_malloc.c,v 1.121.10.1 2010/04/21 00:28:16 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_malloc.c,v 1.121.10.2 2014/03/14 21:45:41 matt Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -918,9 +918,6 @@ kmeminit(void)
 	 */
 	kmeminit_nkmempages();
 
-	kmemusage = (struct kmemusage *) uvm_km_alloc(kernel_map,
-	(vsize_t)(nkmempages * sizeof(struct kmemusage)), 0,
-	UVM_KMF_WIRED|UVM_KMF_ZERO);
 	kmb = 0;
 	kmem_map = uvm_km_suballoc(kernel_map, kmb,
 	kml, ((vsize_t)nkmempages  PAGE_SHIFT),
@@ -928,6 +925,12 @@ kmeminit(void)
 	uvm_km_vacache_init(kmem_map, kvakmem, 0);
 	kmembase = (char *)kmb;
 	kmemlimit = (char *)kml;
+
+	KASSERT(((kmemlimit - kmembase)  PAGE_SHIFT) == nkmempages);
+
+	kmemusage = (struct kmemusage *) uvm_km_alloc(kernel_map,
+	(vsize_t)(nkmempages * sizeof(struct kmemusage)), 0,
+	UVM_KMF_WIRED|UVM_KMF_ZERO);
 #ifdef KMEMSTATS
 	for (indx = 0; indx  MINBUCKET + 16; indx++) {
 		if (1  indx = PAGE_SIZE)



CVS commit: [matt-nb5-mips64] src/sys/kern

2014-03-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 14 22:34:35 UTC 2014

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_malloc.c

Log Message:
Deal with the issue that VM_MAP_INTRSAFE km_suballoc returns more than asked
for so the space needs for kmemusage accounting has to needs adjusted as well.


To generate a diff of this commit:
cvs rdiff -u -r1.121.10.2 -r1.121.10.3 src/sys/kern/kern_malloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_malloc.c
diff -u src/sys/kern/kern_malloc.c:1.121.10.2 src/sys/kern/kern_malloc.c:1.121.10.3
--- src/sys/kern/kern_malloc.c:1.121.10.2	Fri Mar 14 21:45:41 2014
+++ src/sys/kern/kern_malloc.c	Fri Mar 14 22:34:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_malloc.c,v 1.121.10.2 2014/03/14 21:45:41 matt Exp $	*/
+/*	$NetBSD: kern_malloc.c,v 1.121.10.3 2014/03/14 22:34:35 matt Exp $	*/
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_malloc.c,v 1.121.10.2 2014/03/14 21:45:41 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_malloc.c,v 1.121.10.3 2014/03/14 22:34:35 matt Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -926,7 +926,12 @@ kmeminit(void)
 	kmembase = (char *)kmb;
 	kmemlimit = (char *)kml;
 
-	KASSERT(((kmemlimit - kmembase)  PAGE_SHIFT) == nkmempages);
+	/*
+	 * Since the suballoc was VM_MAP_INTRSAFE, the allocated size
+	 * may be larger than was we asked for.  Recompute nkmempages
+	 * to cover the additional space allocated.  
+	 */
+	nkmempages = (kmemlimit - kmembase)  PAGE_SHIFT;
 
 	kmemusage = (struct kmemusage *) uvm_km_alloc(kernel_map,
 	(vsize_t)(nkmempages * sizeof(struct kmemusage)), 0,



CVS commit: [matt-nb5-mips64] src/sys/kern

2014-03-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 14 21:45:42 UTC 2014

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_malloc.c

Log Message:
Make sure uvm_km_suballoc returned the correctly sized submap.


To generate a diff of this commit:
cvs rdiff -u -r1.121.10.1 -r1.121.10.2 src/sys/kern/kern_malloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2014-03-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 14 22:34:35 UTC 2014

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_malloc.c

Log Message:
Deal with the issue that VM_MAP_INTRSAFE km_suballoc returns more than asked
for so the space needs for kmemusage accounting has to needs adjusted as well.


To generate a diff of this commit:
cvs rdiff -u -r1.121.10.2 -r1.121.10.3 src/sys/kern/kern_malloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2014-02-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 14 18:31:49 UTC 2014

Modified Files:
src/sys/kern [matt-nb5-mips64]: vfs_subr.c

Log Message:
vpanic - vnpanic


To generate a diff of this commit:
cvs rdiff -u -r1.357.4.4.2.1.2.1 -r1.357.4.4.2.1.2.2 src/sys/kern/vfs_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.357.4.4.2.1.2.1 src/sys/kern/vfs_subr.c:1.357.4.4.2.1.2.2
--- src/sys/kern/vfs_subr.c:1.357.4.4.2.1.2.1	Wed Apr 21 00:28:19 2010
+++ src/sys/kern/vfs_subr.c	Fri Feb 14 18:31:49 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_subr.c,v 1.357.4.4.2.1.2.1 2010/04/21 00:28:19 matt Exp $	*/
+/*	$NetBSD: vfs_subr.c,v 1.357.4.4.2.1.2.2 2014/02/14 18:31:49 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_subr.c,v 1.357.4.4.2.1.2.1 2010/04/21 00:28:19 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_subr.c,v 1.357.4.4.2.1.2.2 2014/02/14 18:31:49 matt Exp $);
 
 #include opt_ddb.h
 #include opt_compat_netbsd.h
@@ -191,7 +191,7 @@ static void vrele_thread(void *);
 static void insmntque(vnode_t *, struct mount *);
 static int getdevvp(dev_t, vnode_t **, enum vtype);
 static vnode_t *getcleanvnode(void);;
-void vpanic(vnode_t *, const char *);
+void vnpanic(vnode_t *, const char *);
 
 #ifdef DEBUG 
 void printlockedvnodes(void);
@@ -199,14 +199,14 @@ void printlockedvnodes(void);
 
 #ifdef DIAGNOSTIC
 void
-vpanic(vnode_t *vp, const char *msg)
+vnpanic(vnode_t *vp, const char *msg)
 {
 
 	vprint(NULL, vp);
 	panic(%s\n, msg);
 }
 #else
-#define	vpanic(vp, msg)	/* nothing */
+#define	vnpanic(vp, msg)	/* nothing */
 #endif
 
 void
@@ -333,14 +333,14 @@ try_nextlist:
 		 * lists.
 		 */
 		if (vp-v_usecount != 0) {
-			vpanic(vp, free vnode isn't);
+			vnpanic(vp, free vnode isn't);
 		}
 		if ((vp-v_iflag  VI_CLEAN) != 0) {
-			vpanic(vp, clean vnode on freelist);
+			vnpanic(vp, clean vnode on freelist);
 		}
 		if (vp-v_freelisthd != listhd) {
 			printf(vnode sez %p, listhd %p\n, vp-v_freelisthd, listhd);
-			vpanic(vp, list head mismatch);
+			vnpanic(vp, list head mismatch);
 		}
 		if (!mutex_tryenter(vp-v_interlock))
 			continue;
@@ -411,13 +411,13 @@ try_nextlist:
 
 	if (vp-v_data != NULL || vp-v_uobj.uo_npages != 0 ||
 	!TAILQ_EMPTY(vp-v_uobj.memq)) {
-		vpanic(vp, cleaned vnode isn't);
+		vnpanic(vp, cleaned vnode isn't);
 	}
 	if (vp-v_numoutput != 0) {
-		vpanic(vp, clean vnode has pending I/O's);
+		vnpanic(vp, clean vnode has pending I/O's);
 	}
 	if ((vp-v_iflag  VI_ONWORKLST) != 0) {
-		vpanic(vp, clean vnode on syncer list);
+		vnpanic(vp, clean vnode on syncer list);
 	}
 
 	return vp;
@@ -1376,7 +1376,7 @@ vrelel(vnode_t *vp, int flags)
 
 	if (__predict_false(vp-v_op == dead_vnodeop_p 
 	(vp-v_iflag  (VI_CLEAN|VI_XLOCK)) == 0)) {
-		vpanic(vp, dead but not clean);
+		vnpanic(vp, dead but not clean);
 	}
 
 	/*
@@ -1389,7 +1389,7 @@ vrelel(vnode_t *vp, int flags)
 		return;
 	}
 	if (vp-v_usecount = 0 || vp-v_writecount != 0) {
-		vpanic(vp, vrelel: bad ref count);
+		vnpanic(vp, vrelel: bad ref count);
 	}
 
 	KASSERT((vp-v_iflag  VI_XLOCK) == 0);
@@ -1421,7 +1421,7 @@ vrelel(vnode_t *vp, int flags)
 			LK_RETRY);
 			if (error != 0) {
 /* XXX */
-vpanic(vp, vrele: unable to lock %p);
+vnpanic(vp, vrele: unable to lock %p);
 			}
 			mutex_enter(vp-v_interlock);
 			/*
@@ -1642,7 +1642,7 @@ holdrelel(vnode_t *vp)
 	KASSERT((vp-v_iflag  VI_MARKER) == 0);
 
 	if (vp-v_holdcnt = 0) {
-		vpanic(vp, holdrelel: holdcnt vp %p);
+		vnpanic(vp, holdrelel: holdcnt vp %p);
 	}
 
 	vp-v_holdcnt--;
@@ -1891,7 +1891,7 @@ vclean(vnode_t *vp, int flags)
 
 	/* Disassociate the underlying file system from the vnode. */
 	if (VOP_RECLAIM(vp)) {
-		vpanic(vp, vclean: cannot reclaim);
+		vnpanic(vp, vclean: cannot reclaim);
 	}
 
 	KASSERT(vp-v_uobj.uo_npages == 0);



CVS commit: [matt-nb5-mips64] src/sys/kern

2014-02-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 14 18:31:49 UTC 2014

Modified Files:
src/sys/kern [matt-nb5-mips64]: vfs_subr.c

Log Message:
vpanic - vnpanic


To generate a diff of this commit:
cvs rdiff -u -r1.357.4.4.2.1.2.1 -r1.357.4.4.2.1.2.2 src/sys/kern/vfs_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:27:15 UTC 2012

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_kmem.c

Log Message:
Add another KASSERT...


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.26.1 src/sys/kern/subr_kmem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_kmem.c
diff -u src/sys/kern/subr_kmem.c:1.19 src/sys/kern/subr_kmem.c:1.19.26.1
--- src/sys/kern/subr_kmem.c:1.19	Sat Feb  9 12:56:20 2008
+++ src/sys/kern/subr_kmem.c	Mon Jul  9 17:27:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kmem.c,v 1.19 2008/02/09 12:56:20 yamt Exp $	*/
+/*	subr_kmem.c,v 1.19 2008/02/09 12:56:20 yamt Exp	*/
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.19 2008/02/09 12:56:20 yamt Exp $);
+__KERNEL_RCSID(0, subr_kmem.c,v 1.19 2008/02/09 12:56:20 yamt Exp);
 
 #include sys/param.h
 #include sys/callback.h
@@ -209,6 +209,7 @@ kmem_backend_free(vmem_t *dummy, vmem_ad
 	KASSERT(dummy == NULL);
 	KASSERT(addr != 0);
 	KASSERT(size != 0);
+	KASSERT(addr == trunc_page(addr));
 	KASSERT(size == round_page(size));
 
 	kmem_poison_check((void *)addr, size);



CVS commit: [matt-nb5-mips64] src/sys/kern

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:27:15 UTC 2012

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_kmem.c

Log Message:
Add another KASSERT...


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.26.1 src/sys/kern/subr_kmem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2012-06-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun  4 18:47:08 UTC 2012

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_sysctl.c

Log Message:
Each va_start needs a corresponding va_end, even in the error paths...


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.218.8.1 src/sys/kern/kern_sysctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_sysctl.c
diff -u src/sys/kern/kern_sysctl.c:1.218 src/sys/kern/kern_sysctl.c:1.218.8.1
--- src/sys/kern/kern_sysctl.c:1.218	Thu Oct 23 20:41:14 2008
+++ src/sys/kern/kern_sysctl.c	Mon Jun  4 18:47:07 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sysctl.c,v 1.218 2008/10/23 20:41:14 christos Exp $	*/
+/*	kern_sysctl.c,v 1.218 2008/10/23 20:41:14 christos Exp	*/
 
 /*-
  * Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_sysctl.c,v 1.218 2008/10/23 20:41:14 christos Exp $);
+__KERNEL_RCSID(0, kern_sysctl.c,v 1.218 2008/10/23 20:41:14 christos Exp);
 
 #include opt_defcorename.h
 #include ksyms.h
@@ -1935,19 +1935,26 @@ sysctl_createv(struct sysctllog **log, i
 	 */
 	va_start(ap, newlen);
 	namelen = 0;
+	error = 0;
 	ni = -1;
 	do {
-		if (++ni == CTL_MAXNAME)
-			return (ENAMETOOLONG);
+		if (++ni == CTL_MAXNAME) {
+			error = ENAMETOOLONG;
+			break;
+		}
 		name[ni] = va_arg(ap, int);
 		/*
 		 * sorry, this is not supported from here
 		 */
-		if (name[ni] == CTL_CREATESYM)
-			return (EINVAL);
+		if (name[ni] == CTL_CREATESYM) {
+			error = EINVAL;
+			break;
+		}
 	} while (name[ni] != CTL_EOL  name[ni] != CTL_CREATE);
-	namelen = ni + (name[ni] == CTL_CREATE ? 1 : 0);
 	va_end(ap);
+	if (error)
+		return error;
+	namelen = ni + (name[ni] == CTL_CREATE ? 1 : 0);
 
 	/*
 	 * what's it called



CVS commit: [matt-nb5-mips64] src/sys/kern

2012-06-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun  4 18:47:08 UTC 2012

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_sysctl.c

Log Message:
Each va_start needs a corresponding va_end, even in the error paths...


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.218.8.1 src/sys/kern/kern_sysctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2011-05-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed May 25 05:35:50 UTC 2011

Modified Files:
src/sys/kern [matt-nb5-mips64]: tty.c

Log Message:
Merge in LWP_PC status change from -current.  Print PC addr if lwp is
running or runnable.


To generate a diff of this commit:
cvs rdiff -u -r1.227.4.1.4.1 -r1.227.4.1.4.2 src/sys/kern/tty.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/tty.c
diff -u src/sys/kern/tty.c:1.227.4.1.4.1 src/sys/kern/tty.c:1.227.4.1.4.2
--- src/sys/kern/tty.c:1.227.4.1.4.1	Wed Apr 21 00:28:18 2010
+++ src/sys/kern/tty.c	Wed May 25 05:35:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.c,v 1.227.4.1.4.1 2010/04/21 00:28:18 matt Exp $	*/
+/*	tty.c,v 1.227.4.1.4.1 2010/04/21 00:28:18 matt Exp	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tty.c,v 1.227.4.1.4.1 2010/04/21 00:28:18 matt Exp $);
+__KERNEL_RCSID(0, tty.c,v 1.227.4.1.4.1 2010/04/21 00:28:18 matt Exp);
 
 #include sys/param.h
 #include sys/systm.h
@@ -74,6 +74,7 @@
 #undef	TTYDEFCHARS
 #include sys/file.h
 #include sys/conf.h
+#include sys/cpu.h
 #include sys/dkstat.h
 #include sys/uio.h
 #include sys/kernel.h
@@ -2399,15 +2400,36 @@
 
 	mutex_enter(pick-p_lock);
 	LIST_FOREACH(l, pick-p_lwps, l_sibling) {
+		const char *lp;
 		lwp_lock(l);
-		snprintf(lmsg, sizeof(lmsg), %s%s,
-		l-l_stat == LSONPROC ? running :
-		l-l_stat == LSRUN ? runnable :
-		l-l_wchan ? l-l_wmesg : iowait,
-		(LIST_NEXT(l, l_sibling) != NULL) ?   : ] );
-		lwp_unlock(l);
-		strlcat(buf, lmsg, bufsz);
+#ifdef LWP_PC
+#define FMT_RUN %#PRIxVADDR
+#define VAL_RUNNING (vaddr_t)LWP_PC(l)
+#define VAL_RUNABLE (vaddr_t)LWP_PC(l)
+#else
+#define FMT_RUN %s
+#define VAL_RUNNING running
+#define VAL_RUNABLE runnable
+#endif
+		switch (l-l_stat) {
+		case LSONPROC:
+			snprintf(lmsg, sizeof(lmsg), FMT_RUN/%d, VAL_RUNNING,
+			cpu_index(l-l_cpu));
+			lp = lmsg;
+			break;
+		case LSRUN:
+			snprintf(lmsg, sizeof(lmsg), FMT_RUN, VAL_RUNABLE);
+			lp = lmsg;
+			break;
+		default:
+			lp = l-l_wchan ? l-l_wmesg : iowait;
+			break;
+		} 
+		strlcat(buf, lp, bufsz);
+		strlcat(buf, LIST_NEXT(l, l_sibling) != NULL ?   : ] ,
+		bufsz);
 		pctcpu += l-l_pctcpu;
+		lwp_unlock(l);
 	}
 	pctcpu += pick-p_pctcpu;
 	calcru(pick, utime, stime, NULL, NULL);



CVS commit: [matt-nb5-mips64] src/sys/kern

2011-05-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed May 25 05:35:50 UTC 2011

Modified Files:
src/sys/kern [matt-nb5-mips64]: tty.c

Log Message:
Merge in LWP_PC status change from -current.  Print PC addr if lwp is
running or runnable.


To generate a diff of this commit:
cvs rdiff -u -r1.227.4.1.4.1 -r1.227.4.1.4.2 src/sys/kern/tty.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: [matt-nb5-mips64] src/sys/kern

2011-02-08 Thread Adam Hamsik

On Feb,Tuesday 8 2011, at 10:56 PM, Cliff Neighbors wrote:

 Module Name:  src
 Committed By: cliff
 Date: Tue Feb  8 21:56:02 UTC 2011
 
 Modified Files:
   src/sys/kern [matt-nb5-mips64]: subr_autoconf.c
 
 Log Message:
 use mutex_obj_alloc() to allocate config_queues_lock and dc_funcs_lock
 instead of declaring them statically.

Should this be pulled to HEAD, if it fixes your problem.

Regards

Adam.



Re: CVS commit: [matt-nb5-mips64] src/sys/kern

2011-02-08 Thread Matt Thomas

On Feb 8, 2011, at 3:33 PM, Adam Hamsik wrote:

 
 On Feb,Tuesday 8 2011, at 10:56 PM, Cliff Neighbors wrote:
 
 Module Name: src
 Committed By:cliff
 Date:Tue Feb  8 21:56:02 UTC 2011
 
 Modified Files:
  src/sys/kern [matt-nb5-mips64]: subr_autoconf.c
 
 Log Message:
 use mutex_obj_alloc() to allocate config_queues_lock and dc_funcs_lock
 instead of declaring them statically.
 
 Should this be pulled to HEAD, if it fixes your problem.

But that doesn't answer why none of the other MP ports see this.  Maybe
this disguises a problem somewhere else.


CVS commit: [matt-nb5-mips64] src/sys/kern

2011-02-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 21:56:02 UTC 2011

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_autoconf.c

Log Message:
use mutex_obj_alloc() to allocate config_queues_lock and dc_funcs_lock
instead of declaring them statically.


To generate a diff of this commit:
cvs rdiff -u -r1.163.4.2.4.2 -r1.163.4.2.4.3 src/sys/kern/subr_autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.163.4.2.4.2 src/sys/kern/subr_autoconf.c:1.163.4.2.4.3
--- src/sys/kern/subr_autoconf.c:1.163.4.2.4.2	Tue Feb  8 06:04:59 2011
+++ src/sys/kern/subr_autoconf.c	Tue Feb  8 21:56:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.163.4.2.4.2 2011/02/08 06:04:59 cliff Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.163.4.2.4.3 2011/02/08 21:56:01 cliff Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.163.4.2.4.2 2011/02/08 06:04:59 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.163.4.2.4.3 2011/02/08 21:56:01 cliff Exp $);
 
 #include opt_multiprocessor.h
 #include opt_ddb.h
@@ -204,14 +204,14 @@
  * - interrupt_config_queue
  * is held for short durations, and is initialized to spin
  */
-static kmutex_t config_queues_lock;
+static kmutex_t *config_queues_lock;
 
 /*
  * dc_funcs_lock ensures the driver dc_func's are not called concurrently
  * many (most?) are not MP safe
  * is held for unknown durations, and is initialized to sleep
  */
-static kmutex_t dc_funcs_lock;
+static kmutex_t *dc_funcs_lock;
 
 struct deferred_config_head deferred_config_queue =
 	TAILQ_HEAD_INITIALIZER(deferred_config_queue);
@@ -376,9 +376,8 @@
 	mutex_init(config_misc_lock, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(config_misc_cv, cfgmisc);
 
-	mutex_init(dc_funcs_lock, MUTEX_DEFAULT, IPL_SOFTNET);
-
-	mutex_init(config_queues_lock, MUTEX_DEFAULT, IPL_VM);
+	dc_funcs_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_SOFTNET);
+	config_queues_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_VM);
 
 	/* allcfdrivers is statically initialized. */
 	for (i = 0; cfdriver_list_initial[i] != NULL; i++) {
@@ -416,18 +415,18 @@
 {
 	struct deferred_config *dc;
 
-	mutex_enter(config_queues_lock);
+	mutex_enter(config_queues_lock);
 	while ((dc = TAILQ_FIRST(interrupt_config_queue)) != NULL) {
 		TAILQ_REMOVE(interrupt_config_queue, dc, dc_queue);
-		mutex_exit(config_queues_lock);
-		mutex_enter(dc_funcs_lock);
+		mutex_exit(config_queues_lock);
+		mutex_enter(dc_funcs_lock);
 		(*dc-dc_func)(dc-dc_dev);
-		mutex_exit(dc_funcs_lock);
+		mutex_exit(dc_funcs_lock);
 		kmem_free(dc, sizeof(*dc));
 		config_pending_decr();
-		mutex_enter(config_queues_lock);
+		mutex_enter(config_queues_lock);
 	}
-	mutex_exit(config_queues_lock);
+	mutex_exit(config_queues_lock);
 
 	kthread_exit(0);
 }
@@ -1677,13 +1676,13 @@
 		panic(config_defer: can't defer config of a root device);
 
 #ifdef DIAGNOSTIC
-	mutex_enter(config_queues_lock);
+	mutex_enter(config_queues_lock);
 	for (dc = TAILQ_FIRST(deferred_config_queue); dc != NULL;
 	 dc = TAILQ_NEXT(dc, dc_queue)) {
 		if (dc-dc_dev == dev)
 			panic(config_defer: deferred twice);
 	}
-	mutex_exit(config_queues_lock);
+	mutex_exit(config_queues_lock);
 #endif
 
 	dc = kmem_alloc(sizeof(*dc), kmflags);
@@ -1693,9 +1692,9 @@
 	dc-dc_dev = dev;
 	dc-dc_func = func;
 
-	mutex_enter(config_queues_lock);
+	mutex_enter(config_queues_lock);
 	TAILQ_INSERT_TAIL(deferred_config_queue, dc, dc_queue);
-	mutex_exit(config_queues_lock);
+	mutex_exit(config_queues_lock);
 
 	config_pending_incr();
 }
@@ -1719,13 +1718,13 @@
 	}
 
 #ifdef DIAGNOSTIC
-	mutex_enter(config_queues_lock);
+	mutex_enter(config_queues_lock);
 	for (dc = TAILQ_FIRST(interrupt_config_queue); dc != NULL;
 	 dc = TAILQ_NEXT(dc, dc_queue)) {
 		if (dc-dc_dev == dev)
 			panic(config_interrupts: deferred twice);
 	}
-	mutex_exit(config_queues_lock);
+	mutex_exit(config_queues_lock);
 #endif
 
 	dc = kmem_alloc(sizeof(*dc), kmflags);
@@ -1734,9 +1733,9 @@
 
 	dc-dc_dev = dev;
 	dc-dc_func = func;
-	mutex_enter(config_queues_lock);
+	mutex_enter(config_queues_lock);
 	TAILQ_INSERT_TAIL(interrupt_config_queue, dc, dc_queue);
-	mutex_exit(config_queues_lock);
+	mutex_exit(config_queues_lock);
 	config_pending_incr();
 }
 
@@ -1749,21 +1748,21 @@
 {
 	struct deferred_config *dc, *ndc;
 
-	mutex_enter(config_queues_lock);
+	mutex_enter(config_queues_lock);
 	for (dc = TAILQ_FIRST(queue); dc != NULL; dc = ndc) {
 		ndc = TAILQ_NEXT(dc, dc_queue);
 		if (parent == NULL || dc-dc_dev-dv_parent == parent) {
 			TAILQ_REMOVE(queue, dc, dc_queue);
-			mutex_exit(config_queues_lock);
-			mutex_enter(dc_funcs_lock);
+			mutex_exit(config_queues_lock);
+			mutex_enter(dc_funcs_lock);
 			(*dc-dc_func)(dc-dc_dev);
-			mutex_exit(dc_funcs_lock);
+			

CVS commit: [matt-nb5-mips64] src/sys/kern

2011-02-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 21:56:02 UTC 2011

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_autoconf.c

Log Message:
use mutex_obj_alloc() to allocate config_queues_lock and dc_funcs_lock
instead of declaring them statically.


To generate a diff of this commit:
cvs rdiff -u -r1.163.4.2.4.2 -r1.163.4.2.4.3 src/sys/kern/subr_autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2011-02-07 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 06:05:00 UTC 2011

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_autoconf.c

Log Message:
- add config_queues_lock to serialize access to deferred_config_queue and
interrupt_config_queue for adds, deletes and (those DIAGNOSTIC) searches
- add dc_funcs_lock to serialize dispatch of deferred config functions
many (all?) of which may not be MP safe.


To generate a diff of this commit:
cvs rdiff -u -r1.163.4.2.4.1 -r1.163.4.2.4.2 src/sys/kern/subr_autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.163.4.2.4.1 src/sys/kern/subr_autoconf.c:1.163.4.2.4.2
--- src/sys/kern/subr_autoconf.c:1.163.4.2.4.1	Sat Feb  5 06:00:14 2011
+++ src/sys/kern/subr_autoconf.c	Tue Feb  8 06:04:59 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.163.4.2.4.1 2011/02/05 06:00:14 cliff Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.163.4.2.4.2 2011/02/08 06:04:59 cliff Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.163.4.2.4.1 2011/02/05 06:00:14 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.163.4.2.4.2 2011/02/08 06:04:59 cliff Exp $);
 
 #include opt_multiprocessor.h
 #include opt_ddb.h
@@ -198,6 +198,21 @@
 
 TAILQ_HEAD(deferred_config_head, deferred_config);
 
+/*
+ * config_queues_lock protects MP access to
+ * - deferred_config_queue
+ * - interrupt_config_queue
+ * is held for short durations, and is initialized to spin
+ */
+static kmutex_t config_queues_lock;
+
+/*
+ * dc_funcs_lock ensures the driver dc_func's are not called concurrently
+ * many (most?) are not MP safe
+ * is held for unknown durations, and is initialized to sleep
+ */
+static kmutex_t dc_funcs_lock;
+
 struct deferred_config_head deferred_config_queue =
 	TAILQ_HEAD_INITIALIZER(deferred_config_queue);
 struct deferred_config_head interrupt_config_queue =
@@ -361,6 +376,10 @@
 	mutex_init(config_misc_lock, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(config_misc_cv, cfgmisc);
 
+	mutex_init(dc_funcs_lock, MUTEX_DEFAULT, IPL_SOFTNET);
+
+	mutex_init(config_queues_lock, MUTEX_DEFAULT, IPL_VM);
+
 	/* allcfdrivers is statically initialized. */
 	for (i = 0; cfdriver_list_initial[i] != NULL; i++) {
 		if (config_cfdriver_attach(cfdriver_list_initial[i]) != 0)
@@ -397,12 +416,19 @@
 {
 	struct deferred_config *dc;
 
+	mutex_enter(config_queues_lock);
 	while ((dc = TAILQ_FIRST(interrupt_config_queue)) != NULL) {
 		TAILQ_REMOVE(interrupt_config_queue, dc, dc_queue);
+		mutex_exit(config_queues_lock);
+		mutex_enter(dc_funcs_lock);
 		(*dc-dc_func)(dc-dc_dev);
+		mutex_exit(dc_funcs_lock);
 		kmem_free(dc, sizeof(*dc));
 		config_pending_decr();
+		mutex_enter(config_queues_lock);
 	}
+	mutex_exit(config_queues_lock);
+
 	kthread_exit(0);
 }
 
@@ -1651,11 +1677,13 @@
 		panic(config_defer: can't defer config of a root device);
 
 #ifdef DIAGNOSTIC
+	mutex_enter(config_queues_lock);
 	for (dc = TAILQ_FIRST(deferred_config_queue); dc != NULL;
 	 dc = TAILQ_NEXT(dc, dc_queue)) {
 		if (dc-dc_dev == dev)
 			panic(config_defer: deferred twice);
 	}
+	mutex_exit(config_queues_lock);
 #endif
 
 	dc = kmem_alloc(sizeof(*dc), kmflags);
@@ -1664,7 +1692,11 @@
 
 	dc-dc_dev = dev;
 	dc-dc_func = func;
+
+	mutex_enter(config_queues_lock);
 	TAILQ_INSERT_TAIL(deferred_config_queue, dc, dc_queue);
+	mutex_exit(config_queues_lock);
+
 	config_pending_incr();
 }
 
@@ -1687,11 +1719,13 @@
 	}
 
 #ifdef DIAGNOSTIC
+	mutex_enter(config_queues_lock);
 	for (dc = TAILQ_FIRST(interrupt_config_queue); dc != NULL;
 	 dc = TAILQ_NEXT(dc, dc_queue)) {
 		if (dc-dc_dev == dev)
 			panic(config_interrupts: deferred twice);
 	}
+	mutex_exit(config_queues_lock);
 #endif
 
 	dc = kmem_alloc(sizeof(*dc), kmflags);
@@ -1700,7 +1734,9 @@
 
 	dc-dc_dev = dev;
 	dc-dc_func = func;
+	mutex_enter(config_queues_lock);
 	TAILQ_INSERT_TAIL(interrupt_config_queue, dc, dc_queue);
+	mutex_exit(config_queues_lock);
 	config_pending_incr();
 }
 
@@ -1713,15 +1749,21 @@
 {
 	struct deferred_config *dc, *ndc;
 
+	mutex_enter(config_queues_lock);
 	for (dc = TAILQ_FIRST(queue); dc != NULL; dc = ndc) {
 		ndc = TAILQ_NEXT(dc, dc_queue);
 		if (parent == NULL || dc-dc_dev-dv_parent == parent) {
 			TAILQ_REMOVE(queue, dc, dc_queue);
+			mutex_exit(config_queues_lock);
+			mutex_enter(dc_funcs_lock);
 			(*dc-dc_func)(dc-dc_dev);
+			mutex_exit(dc_funcs_lock);
 			kmem_free(dc, sizeof(*dc));
 			config_pending_decr();
+			mutex_enter(config_queues_lock);
 		}
 	}
+	mutex_exit(config_queues_lock);
 }
 
 /*



CVS commit: [matt-nb5-mips64] src/sys/kern

2011-02-07 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 06:05:00 UTC 2011

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_autoconf.c

Log Message:
- add config_queues_lock to serialize access to deferred_config_queue and
interrupt_config_queue for adds, deletes and (those DIAGNOSTIC) searches
- add dc_funcs_lock to serialize dispatch of deferred config functions
many (all?) of which may not be MP safe.


To generate a diff of this commit:
cvs rdiff -u -r1.163.4.2.4.1 -r1.163.4.2.4.2 src/sys/kern/subr_autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:13:45 UTC 2011

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_evcnt.c

Log Message:
- add evcnt_lock and use to protect the 'allevents' list
(pulled back fromk -current)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.94.1 src/sys/kern/subr_evcnt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_evcnt.c
diff -u src/sys/kern/subr_evcnt.c:1.4 src/sys/kern/subr_evcnt.c:1.4.94.1
--- src/sys/kern/subr_evcnt.c:1.4	Sun Dec 11 12:24:30 2005
+++ src/sys/kern/subr_evcnt.c	Sat Feb  5 06:13:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.4 2005/12/11 12:24:30 christos Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.4.94.1 2011/02/05 06:13:45 cliff Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,16 +77,18 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_evcnt.c,v 1.4 2005/12/11 12:24:30 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_evcnt.c,v 1.4.94.1 2011/02/05 06:13:45 cliff Exp $);
 
 #include opt_ddb.h
 
 #include sys/param.h
 #include sys/device.h
+#include sys/mutex.h
 #include sys/systm.h
 
 /* list of all events */
 struct evcntlist allevents = TAILQ_HEAD_INITIALIZER(allevents);
+static kmutex_t evcnt_lock;
 
 /*
  * We need a dummy object to stuff into the evcnt link set to
@@ -105,6 +107,8 @@
 	__link_set_decl(evcnts, struct evcnt);
 	struct evcnt * const *evp;
 
+	mutex_init(evcnt_lock, MUTEX_DEFAULT, IPL_NONE);
+
 	__link_set_foreach(evp, evcnts) {
 		if (*evp == dummy_static_evcnt)
 			continue;
@@ -121,6 +125,9 @@
 {
 	int len;
 
+#ifdef DEBUG	/* XXX TMP FIXME */
+	printf(%s: %p \%s\\n, __func__, ev, ev-ev_name);
+#endif
 	len = strlen(ev-ev_group);
 #ifdef DIAGNOSTIC
 	if (len = EVCNT_STRING_MAX)		/* ..._MAX includes NUL */
@@ -135,7 +142,9 @@
 #endif
 	ev-ev_namelen = len;
 
+	mutex_enter(evcnt_lock);
 	TAILQ_INSERT_TAIL(allevents, ev, ev_list);
+	mutex_exit(evcnt_lock);
 }
 
 /*
@@ -162,7 +171,9 @@
 evcnt_detach(struct evcnt *ev)
 {
 
+	mutex_enter(evcnt_lock);
 	TAILQ_REMOVE(allevents, ev, ev_list);
+	mutex_exit(evcnt_lock);
 }
 
 #ifdef DDB



CVS commit: [matt-nb5-mips64] src/sys/kern

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:54:58 UTC 2011

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_evcnt.c

Log Message:
- remove leftover debug print


To generate a diff of this commit:
cvs rdiff -u -r1.4.94.1 -r1.4.94.2 src/sys/kern/subr_evcnt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_evcnt.c
diff -u src/sys/kern/subr_evcnt.c:1.4.94.1 src/sys/kern/subr_evcnt.c:1.4.94.2
--- src/sys/kern/subr_evcnt.c:1.4.94.1	Sat Feb  5 06:13:45 2011
+++ src/sys/kern/subr_evcnt.c	Sat Feb  5 06:54:58 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.4.94.1 2011/02/05 06:13:45 cliff Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.4.94.2 2011/02/05 06:54:58 cliff Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_evcnt.c,v 1.4.94.1 2011/02/05 06:13:45 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_evcnt.c,v 1.4.94.2 2011/02/05 06:54:58 cliff Exp $);
 
 #include opt_ddb.h
 
@@ -125,9 +125,6 @@
 {
 	int len;
 
-#ifdef DEBUG	/* XXX TMP FIXME */
-	printf(%s: %p \%s\\n, __func__, ev, ev-ev_name);
-#endif
 	len = strlen(ev-ev_group);
 #ifdef DIAGNOSTIC
 	if (len = EVCNT_STRING_MAX)		/* ..._MAX includes NUL */



CVS commit: [matt-nb5-mips64] src/sys/kern

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:13:45 UTC 2011

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_evcnt.c

Log Message:
- add evcnt_lock and use to protect the 'allevents' list
(pulled back fromk -current)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.94.1 src/sys/kern/subr_evcnt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:54:58 UTC 2011

Modified Files:
src/sys/kern [matt-nb5-mips64]: subr_evcnt.c

Log Message:
- remove leftover debug print


To generate a diff of this commit:
cvs rdiff -u -r1.4.94.1 -r1.4.94.2 src/sys/kern/subr_evcnt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2010-08-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug 19 07:23:24 UTC 2010

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_exec.c

Log Message:
Add some more debug printfs for various failures.


To generate a diff of this commit:
cvs rdiff -u -r1.280.4.3.4.1 -r1.280.4.3.4.2 src/sys/kern/kern_exec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.280.4.3.4.1 src/sys/kern/kern_exec.c:1.280.4.3.4.2
--- src/sys/kern/kern_exec.c:1.280.4.3.4.1	Wed Apr 21 00:28:16 2010
+++ src/sys/kern/kern_exec.c	Thu Aug 19 07:23:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.280.4.3.4.1 2010/04/21 00:28:16 matt Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.280.4.3.4.2 2010/08/19 07:23:24 matt Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.280.4.3.4.1 2010/04/21 00:28:16 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.280.4.3.4.2 2010/08/19 07:23:24 matt Exp $);
 
 #include opt_ktrace.h
 #include opt_syscall_debug.h
@@ -1031,7 +1031,7 @@
 		(*pack.ep_esch-es_setregs)(l, pack, (u_long) stack);
 
 	/* map the process's signal trampoline code */
-	if (exec_sigcode_map(p, pack.ep_esch-es_emul)) {
+	if ((error = exec_sigcode_map(p, pack.ep_esch-es_emul)) != 0) {
 		DPRINTF((execve: map sigcode failed %d\n, error));
 		goto exec_abort;
 	}
@@ -1204,8 +1204,10 @@
 	nullp = NULL;
 	argc = arginfo-ps_nargvstr;
 	envc = arginfo-ps_nenvstr;
-	if ((error = copyout(argc, cpp++, sizeof(argc))) != 0)
+	if ((error = copyout(argc, cpp++, sizeof(argc))) != 0) {
+		DPRINTF((copyargs:%d copyout @%p %zu\n, __LINE__, cpp-1, sizeof(argc)));
 		return error;
+	}
 
 	dp = (char *) (cpp + argc + envc + 2 + pack-ep_esch-es_arglen);
 	sp = argp;
@@ -1213,23 +1215,39 @@
 	/* XXX don't copy them out, remap them! */
 	arginfo-ps_argvstr = cpp; /* remember location of argv for later */
 
-	for (; --argc = 0; sp += len, dp += len)
-		if ((error = copyout(dp, cpp++, sizeof(dp))) != 0 ||
-		(error = copyoutstr(sp, dp, ARG_MAX, len)) != 0)
+	for (; --argc = 0; sp += len, dp += len) {
+		if ((error = copyout(dp, cpp++, sizeof(dp))) != 0) {
+			DPRINTF((copyargs:%d copyout @%p %zu\n, __LINE__, cpp-1, sizeof(dp)));
+			return error;
+		}
+		if ((error = copyoutstr(sp, dp, ARG_MAX, len)) != 0) {
+			DPRINTF((copyargs:%d copyoutstr @%p %u\n, __LINE__, dp, ARG_MAX));
 			return error;
+		}
+	}
 
-	if ((error = copyout(nullp, cpp++, sizeof(nullp))) != 0)
+	if ((error = copyout(nullp, cpp++, sizeof(nullp))) != 0) {
+		DPRINTF((copyargs:%d copyout @%p %zu\n, __LINE__, cpp-1, sizeof(nullp)));
 		return error;
+	}
 
 	arginfo-ps_envstr = cpp; /* remember location of envp for later */
 
-	for (; --envc = 0; sp += len, dp += len)
-		if ((error = copyout(dp, cpp++, sizeof(dp))) != 0 ||
-		(error = copyoutstr(sp, dp, ARG_MAX, len)) != 0)
+	for (; --envc = 0; sp += len, dp += len) {
+		if ((error = copyout(dp, cpp++, sizeof(dp))) != 0) {
+			DPRINTF((copyargs:%d copyout @%p %zu\n, __LINE__, cpp-1, sizeof(dp)));
 			return error;
+		}
+		if ((error = copyoutstr(sp, dp, ARG_MAX, len)) != 0) {
+			DPRINTF((copyargs:%d copyoutstr @%p %u\n, __LINE__, dp, ARG_MAX));
+			return error;
+		}
+	}
 
-	if ((error = copyout(nullp, cpp++, sizeof(nullp))) != 0)
+	if ((error = copyout(nullp, cpp++, sizeof(nullp))) != 0) {
+		DPRINTF((copyargs:%d copyout @%p %zu\n, __LINE__, cpp-1, sizeof(nullp)));
 		return error;
+	}
 
 	*stackp = (char *)cpp;
 	return 0;
@@ -1665,6 +1683,10 @@
 			UVM_MAPFLAG(UVM_PROT_RX, UVM_PROT_RX, UVM_INH_SHARE,
 UVM_ADV_RANDOM, 0));
 	if (error) {
+		DPRINTF((exec_sigcode_map:%d map %p 
+		uvm_map %#PRIxVSIZE@%#PRIxVADDR failed %d\n,
+		__LINE__, p-p_vmspace-vm_map, round_page(sz), va,
+		error));
 		(*uobj-pgops-pgo_detach)(uobj);
 		return (error);
 	}



CVS commit: [matt-nb5-mips64] src/sys/kern

2010-08-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug 19 07:23:24 UTC 2010

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_exec.c

Log Message:
Add some more debug printfs for various failures.


To generate a diff of this commit:
cvs rdiff -u -r1.280.4.3.4.1 -r1.280.4.3.4.2 src/sys/kern/kern_exec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2010-06-09 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Jun 10 00:42:16 UTC 2010

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_subr.c

Log Message:
- in setroot(), in the `root on dev ...' case, if the lookup failed
and we have no rootdev, then we have to ASK.


To generate a diff of this commit:
cvs rdiff -u -r1.192.4.1.4.3 -r1.192.4.1.4.4 src/sys/kern/kern_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_subr.c
diff -u src/sys/kern/kern_subr.c:1.192.4.1.4.3 src/sys/kern/kern_subr.c:1.192.4.1.4.4
--- src/sys/kern/kern_subr.c:1.192.4.1.4.3	Tue Jun  8 18:29:11 2010
+++ src/sys/kern/kern_subr.c	Thu Jun 10 00:42:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_subr.c,v 1.192.4.1.4.3 2010/06/08 18:29:11 cliff Exp $	*/
+/*	$NetBSD: kern_subr.c,v 1.192.4.1.4.4 2010/06/10 00:42:16 cliff Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_subr.c,v 1.192.4.1.4.3 2010/06/08 18:29:11 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_subr.c,v 1.192.4.1.4.4 2010/06/10 00:42:16 cliff Exp $);
 
 #include opt_ddb.h
 #include opt_md.h
@@ -973,17 +973,28 @@
 		 * `root on dev ...'
 		 */
 
+		dv = finddevice(rootspec);
+
+		/*
+		 * if the lookup failed and we have no rootdev
+		 * then we have to ask
+		 */
+		if (dv == NULL  rootdev == NODEV) {
+			printf(device %s not configured\n, rootspec);
+			boothowto |= RB_ASKNAME;
+			goto top;
+		}
+
 		/*
 		 * If it's a network interface, we can bail out
 		 * early.
 		 */
-		dv = finddevice(rootspec);
 		if (dv != NULL  device_class(dv) == DV_IFNET) {
 			rootdv = dv;
 			goto haveroot;
 		}
 
-		if (rootdev == NODEV 
+		if (dv != NULL  rootdev == NODEV 
 		device_class(dv) == DV_DISK  device_is_a(dv, dk) 
 		(majdev = devsw_name2blk(device_xname(dv), NULL, 0)) = 0)
 			rootdev = makedev(majdev, device_unit(dv));



CVS commit: [matt-nb5-mips64] src/sys/kern

2010-06-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Jun  8 18:29:11 UTC 2010

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_subr.c

Log Message:
pulled fix from -current (1.207) back to setroot():
when there is a rootspec, but it's a disk, don't say it's not configured
just on the basis of finddevice() returning NULL -- that will always happen
when e.g. rootspec is sd0a and the device xname is sd0.


To generate a diff of this commit:
cvs rdiff -u -r1.192.4.1.4.2 -r1.192.4.1.4.3 src/sys/kern/kern_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_subr.c
diff -u src/sys/kern/kern_subr.c:1.192.4.1.4.2 src/sys/kern/kern_subr.c:1.192.4.1.4.3
--- src/sys/kern/kern_subr.c:1.192.4.1.4.2	Tue Jan 26 04:51:03 2010
+++ src/sys/kern/kern_subr.c	Tue Jun  8 18:29:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_subr.c,v 1.192.4.1.4.2 2010/01/26 04:51:03 cliff Exp $	*/
+/*	$NetBSD: kern_subr.c,v 1.192.4.1.4.3 2010/06/08 18:29:11 cliff Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_subr.c,v 1.192.4.1.4.2 2010/01/26 04:51:03 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_subr.c,v 1.192.4.1.4.3 2010/06/08 18:29:11 cliff Exp $);
 
 #include opt_ddb.h
 #include opt_md.h
@@ -974,20 +974,11 @@
 		 */
 
 		/*
-		 * if rootspec is not configured, ask (again)
-		 */
-		dv = finddevice(rootspec);
-		if (dv == NULL) {
-			printf(device %s not configured\n, rootspec);
-			boothowto |= RB_ASKNAME;
-			goto top;
-		}
-
-		/*
 		 * If it's a network interface, we can bail out
 		 * early.
 		 */
-		if (device_class(dv) == DV_IFNET) {
+		dv = finddevice(rootspec);
+		if (dv != NULL  device_class(dv) == DV_IFNET) {
 			rootdv = dv;
 			goto haveroot;
 		}



CVS commit: [matt-nb5-mips64] src/sys/kern

2010-06-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Jun  8 18:29:11 UTC 2010

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_subr.c

Log Message:
pulled fix from -current (1.207) back to setroot():
when there is a rootspec, but it's a disk, don't say it's not configured
just on the basis of finddevice() returning NULL -- that will always happen
when e.g. rootspec is sd0a and the device xname is sd0.


To generate a diff of this commit:
cvs rdiff -u -r1.192.4.1.4.2 -r1.192.4.1.4.3 src/sys/kern/kern_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2010-03-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar 16 16:08:29 UTC 2010

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_ktrace.c

Log Message:
Make sure kte_space has at least enough alignment to store a register_t.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.147.10.1 src/sys/kern/kern_ktrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_ktrace.c
diff -u src/sys/kern/kern_ktrace.c:1.147 src/sys/kern/kern_ktrace.c:1.147.10.1
--- src/sys/kern/kern_ktrace.c:1.147	Wed Oct 15 06:51:20 2008
+++ src/sys/kern/kern_ktrace.c	Tue Mar 16 16:08:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ktrace.c,v 1.147 2008/10/15 06:51:20 wrstuden Exp $	*/
+/*	$NetBSD: kern_ktrace.c,v 1.147.10.1 2010/03/16 16:08:29 matt Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_ktrace.c,v 1.147 2008/10/15 06:51:20 wrstuden Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_ktrace.c,v 1.147.10.1 2010/03/16 16:08:29 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -97,7 +97,7 @@
 	void	*kte_buf;
 	size_t	kte_bufsz;	
 #define	KTE_SPACE		32
-	uint8_t kte_space[KTE_SPACE];
+	uint8_t kte_space[KTE_SPACE] __aligned(sizeof(register_t));
 };
 
 struct ktr_desc {



CVS commit: [matt-nb5-mips64] src/sys/kern

2010-01-25 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Jan 26 04:41:07 UTC 2010

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_subr.c

Log Message:
fix bug in setroot() where device_class() would be called
with NULL pointer arg if root is specified in config but
the specified device does not exist in the system.


To generate a diff of this commit:
cvs rdiff -u -r1.192.4.1 -r1.192.4.1.4.1 src/sys/kern/kern_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/sys/kern

2010-01-25 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Jan 26 04:41:07 UTC 2010

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_subr.c

Log Message:
fix bug in setroot() where device_class() would be called
with NULL pointer arg if root is specified in config but
the specified device does not exist in the system.


To generate a diff of this commit:
cvs rdiff -u -r1.192.4.1 -r1.192.4.1.4.1 src/sys/kern/kern_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_subr.c
diff -u src/sys/kern/kern_subr.c:1.192.4.1 src/sys/kern/kern_subr.c:1.192.4.1.4.1
--- src/sys/kern/kern_subr.c:1.192.4.1	Mon Nov 17 18:56:05 2008
+++ src/sys/kern/kern_subr.c	Tue Jan 26 04:41:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_subr.c,v 1.192.4.1 2008/11/17 18:56:05 snj Exp $	*/
+/*	$NetBSD: kern_subr.c,v 1.192.4.1.4.1 2010/01/26 04:41:07 cliff Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_subr.c,v 1.192.4.1 2008/11/17 18:56:05 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_subr.c,v 1.192.4.1.4.1 2010/01/26 04:41:07 cliff Exp $);
 
 #include opt_ddb.h
 #include opt_md.h
@@ -786,6 +786,7 @@
 	 * find a reasonable network interface for rootspec.
 	 */
 	vops = vfs_getopsbyname(nfs);
+printf(%s:%d\n, __func__, __LINE__);
 	if (vops != NULL  vops-vfs_mountroot == mountroot 
 	rootspec == NULL 
 	(bootdv == NULL || device_class(bootdv) != DV_IFNET)) {
@@ -974,11 +975,20 @@
 		 */
 
 		/*
+		 * if rootspec is not configured, ask (again)
+		 */
+		dv = finddevice(rootspec);
+		if (dv == NULL) {
+			printf(device %s not configured\n, rootspec);
+			boothowto |= RB_ASKNAME;
+			goto top;
+		}
+
+		/*
 		 * If it's a network interface, we can bail out
 		 * early.
 		 */
-		dv = finddevice(rootspec);
-		if (dv != NULL  device_class(dv) == DV_IFNET) {
+		if (device_class(dv) == DV_IFNET) {
 			rootdv = dv;
 			goto haveroot;
 		}
@@ -1011,6 +1021,7 @@
 
 	root_device = rootdv;
 
+printf(%s:%d\n, __func__, __LINE__);
 	switch (device_class(rootdv)) {
 	case DV_IFNET:
 	case DV_DISK:



CVS commit: [matt-nb5-mips64] src/sys/kern

2010-01-25 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Jan 26 04:51:03 UTC 2010

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_subr.c

Log Message:
remove debug prints


To generate a diff of this commit:
cvs rdiff -u -r1.192.4.1.4.1 -r1.192.4.1.4.2 src/sys/kern/kern_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_subr.c
diff -u src/sys/kern/kern_subr.c:1.192.4.1.4.1 src/sys/kern/kern_subr.c:1.192.4.1.4.2
--- src/sys/kern/kern_subr.c:1.192.4.1.4.1	Tue Jan 26 04:41:07 2010
+++ src/sys/kern/kern_subr.c	Tue Jan 26 04:51:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_subr.c,v 1.192.4.1.4.1 2010/01/26 04:41:07 cliff Exp $	*/
+/*	$NetBSD: kern_subr.c,v 1.192.4.1.4.2 2010/01/26 04:51:03 cliff Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_subr.c,v 1.192.4.1.4.1 2010/01/26 04:41:07 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_subr.c,v 1.192.4.1.4.2 2010/01/26 04:51:03 cliff Exp $);
 
 #include opt_ddb.h
 #include opt_md.h
@@ -786,7 +786,6 @@
 	 * find a reasonable network interface for rootspec.
 	 */
 	vops = vfs_getopsbyname(nfs);
-printf(%s:%d\n, __func__, __LINE__);
 	if (vops != NULL  vops-vfs_mountroot == mountroot 
 	rootspec == NULL 
 	(bootdv == NULL || device_class(bootdv) != DV_IFNET)) {
@@ -1020,8 +1019,6 @@
  haveroot:
 
 	root_device = rootdv;
-
-printf(%s:%d\n, __func__, __LINE__);
 	switch (device_class(rootdv)) {
 	case DV_IFNET:
 	case DV_DISK:



CVS commit: [matt-nb5-mips64] src/sys/kern

2009-09-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Sep 12 16:53:50 UTC 2009

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_xxx.c

Log Message:
Print out syscallname on ret too.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.70.20.1 src/sys/kern/kern_xxx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_xxx.c
diff -u src/sys/kern/kern_xxx.c:1.70 src/sys/kern/kern_xxx.c:1.70.20.1
--- src/sys/kern/kern_xxx.c:1.70	Fri Apr 25 11:23:42 2008
+++ src/sys/kern/kern_xxx.c	Sat Sep 12 16:53:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_xxx.c,v 1.70 2008/04/25 11:23:42 ad Exp $	*/
+/*	$NetBSD: kern_xxx.c,v 1.70.20.1 2009/09/12 16:53:50 matt Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_xxx.c,v 1.70 2008/04/25 11:23:42 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_xxx.c,v 1.70.20.1 2009/09/12 16:53:50 matt Exp $);
 
 #include opt_syscall_debug.h
 
@@ -178,8 +178,9 @@
 	)
 		printf(OUT OF RANGE (%ld), (long)code);
 	else
-		printf(%ld ret: err = %d, rv = 0x%lx,0x%lx, (long)code,
-		error, (long)retval[0], (long)retval[1]);
+		printf(%ld ret %s: err = %d, rv = 0x%lx,0x%lx, (long)code,
+		em-e_syscallnames[code], error,
+		(long)retval[0], (long)retval[1]);
 	printf(\n);
 }
 #endif /* SYSCALL_DEBUG */



CVS commit: [matt-nb5-mips64] src/sys/kern

2009-09-02 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep  2 17:50:25 UTC 2009

Modified Files:
src/sys/kern [matt-nb5-mips64]: exec_elf32.c

Log Message:
If we have a ELF_MD_PROBE_FUNC, let it deal with ELF_INTERP_NON_RELOCATABLE.


To generate a diff of this commit:
cvs rdiff -u -r1.136.8.1 -r1.136.8.2 src/sys/kern/exec_elf32.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/exec_elf32.c
diff -u src/sys/kern/exec_elf32.c:1.136.8.1 src/sys/kern/exec_elf32.c:1.136.8.2
--- src/sys/kern/exec_elf32.c:1.136.8.1	Fri Aug 21 18:00:36 2009
+++ src/sys/kern/exec_elf32.c	Wed Sep  2 17:50:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf32.c,v 1.136.8.1 2009/08/21 18:00:36 matt Exp $	*/
+/*	$NetBSD: exec_elf32.c,v 1.136.8.2 2009/09/02 17:50:25 matt Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: exec_elf32.c,v 1.136.8.1 2009/08/21 18:00:36 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: exec_elf32.c,v 1.136.8.2 2009/09/02 17:50:25 matt Exp $);
 
 /* If not included by exec_elf64.c, ELFSIZE won't be defined. */
 #ifndef ELFSIZE
@@ -916,8 +916,7 @@
 #ifdef ELF_MD_PROBE_FUNC
 	if ((error = ELF_MD_PROBE_FUNC(l, epp, eh, itp, pos)) != 0)
 		return error;
-#endif
-#ifdef ELF_INTERP_NON_RELOCATABLE
+#elif defined(ELF_INTERP_NON_RELOCATABLE)
 	*pos = ELF_LINK_ADDR;
 #endif
 	return 0;



CVS commit: [matt-nb5-mips64] src/sys/kern

2009-08-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 22 00:22:41 UTC 2009

Modified Files:
src/sys/kern [matt-nb5-mips64]: init_sysent.c

Log Message:
Regen for new 64 arg stuff


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.229.8.1 src/sys/kern/init_sysent.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/init_sysent.c
diff -u src/sys/kern/init_sysent.c:1.229 src/sys/kern/init_sysent.c:1.229.8.1
--- src/sys/kern/init_sysent.c:1.229	Thu Oct 16 20:12:23 2008
+++ src/sys/kern/init_sysent.c	Sat Aug 22 00:22:40 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: init_sysent.c,v 1.229 2008/10/16 20:12:23 wrstuden Exp $ */
+/* $NetBSD: init_sysent.c,v 1.229.8.1 2009/08/22 00:22:40 matt Exp $ */
 
 /*
  * System call switch table.
@@ -8,7 +8,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: init_sysent.c,v 1.229 2008/10/16 20:12:23 wrstuden Exp $);
+__KERNEL_RCSID(0, $NetBSD: init_sysent.c,v 1.229.8.1 2009/08/22 00:22:40 matt Exp $);
 
 #include opt_nfsserver.h
 #include opt_ntp.h
@@ -489,9 +489,9 @@
 #endif
 	{ 0, 0, 0,
 	sys_nosys },			/* 172 = unimplemented */
-	{ ns(struct sys_pread_args), 0,
+	{ ns(struct sys_pread_args), SYCALL_NARGS64_VAL(1) | SYCALL_ARG4_64,
 	(sy_call_t *)sys_pread },		/* 173 = pread */
-	{ ns(struct sys_pwrite_args), 0,
+	{ ns(struct sys_pwrite_args), SYCALL_NARGS64_VAL(1) | SYCALL_ARG4_64,
 	(sy_call_t *)sys_pwrite },		/* 174 = pwrite */
 	{ ns(struct compat_30_sys_ntp_gettime_args), 0,
 	(sy_call_t *)compat_30(sys_ntp_gettime) },/* 175 = compat_30_ntp_gettime */
@@ -553,15 +553,15 @@
 	(sy_call_t *)sys_setrlimit },	/* 195 = setrlimit */
 	{ ns(struct compat_12_sys_getdirentries_args), 0,
 	(sy_call_t *)compat_12(sys_getdirentries) },/* 196 = compat_12_getdirentries */
-	{ ns(struct sys_mmap_args), 0,
+	{ ns(struct sys_mmap_args), SYCALL_NARGS64_VAL(1) | SYCALL_ARG6_64,
 	(sy_call_t *)sys_mmap },		/* 197 = mmap */
-	{ ns(struct sys___syscall_args), SYCALL_INDIRECT,
+	{ ns(struct sys___syscall_args), SYCALL_NARGS64_VAL(1) | SYCALL_ARG0_64 | SYCALL_RET_64 | SYCALL_INDIRECT,
 	(sy_call_t *)sys___syscall },	/* 198 = __syscall */
-	{ ns(struct sys_lseek_args), 0,
+	{ ns(struct sys_lseek_args), SYCALL_NARGS64_VAL(1) | SYCALL_ARG2_64 | SYCALL_RET_64,
 	(sy_call_t *)sys_lseek },		/* 199 = lseek */
-	{ ns(struct sys_truncate_args), 0,
+	{ ns(struct sys_truncate_args), SYCALL_NARGS64_VAL(1) | SYCALL_ARG2_64,
 	(sy_call_t *)sys_truncate },	/* 200 = truncate */
-	{ ns(struct sys_ftruncate_args), 0,
+	{ ns(struct sys_ftruncate_args), SYCALL_NARGS64_VAL(1) | SYCALL_ARG2_64,
 	(sy_call_t *)sys_ftruncate },	/* 201 = ftruncate */
 	{ ns(struct sys___sysctl_args), 0,
 	(sy_call_t *)sys___sysctl },	/* 202 = __sysctl */
@@ -816,9 +816,9 @@
 	(sy_call_t *)sys___clone },		/* 287 = __clone */
 	{ ns(struct sys_fktrace_args), 0,
 	(sy_call_t *)sys_fktrace },		/* 288 = fktrace */
-	{ ns(struct sys_preadv_args), 0,
+	{ ns(struct sys_preadv_args), SYCALL_NARGS64_VAL(1) | SYCALL_ARG4_64,
 	(sy_call_t *)sys_preadv },		/* 289 = preadv */
-	{ ns(struct sys_pwritev_args), 0,
+	{ ns(struct sys_pwritev_args), SYCALL_NARGS64_VAL(1) | SYCALL_ARG4_64,
 	(sy_call_t *)sys_pwritev },		/* 290 = pwritev */
 	{ ns(struct compat_16_sys___sigaction14_args), 0,
 	(sy_call_t *)compat_16(sys___sigaction14) },/* 291 = compat_16___sigaction14 */
@@ -961,7 +961,7 @@
 	sys_nosys },			/* 352 = unimplemented */
 	{ 0, 0, 0,
 	sys_nosys },			/* 353 = unimplemented */
-	{ ns(struct sys_fsync_range_args), 0,
+	{ ns(struct sys_fsync_range_args), SYCALL_NARGS64_VAL(2) | SYCALL_ARG3_64 | SYCALL_ARG2_64,
 	(sy_call_t *)sys_fsync_range },	/* 354 = fsync_range */
 	{ ns(struct sys_uuidgen_args), 0,
 	(sy_call_t *)sys_uuidgen },		/* 355 = uuidgen */
@@ -1085,7 +1085,7 @@
 	(sy_call_t *)sys_pset_assign },	/* 414 = pset_assign */
 	{ ns(struct sys__pset_bind_args), 0,
 	(sy_call_t *)sys__pset_bind },	/* 415 = _pset_bind */
-	{ ns(struct sys___posix_fadvise50_args), 0,
+	{ ns(struct sys___posix_fadvise50_args), SYCALL_NARGS64_VAL(2) | SYCALL_ARG3_64 | SYCALL_ARG2_64,
 	(sy_call_t *)sys___posix_fadvise50 },/* 416 = __posix_fadvise50 */
 	{ 0, 0, 0,
 	sys_nosys },			/* 417 = filler */