CVS commit: [netbsd-6] src/sys/arch/usermode/usermode

2012-08-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  8 15:32:25 UTC 2012

Modified Files:
src/sys/arch/usermode/usermode [netbsd-6]: trap.c

Log Message:
Pull up following revision(s) (requested by reinoud in ticket #463):
sys/arch/usermode/usermode/trap.c: revision 1.66
Fix IO lockups in NetBSD/usermode.
1) Don't block IO signals since the return path is not garanteed to enable the
signal again.
2) Since signals can get dropped, do a 2nd pass over the routines.


To generate a diff of this commit:
cvs rdiff -u -r1.63.2.2 -r1.63.2.3 src/sys/arch/usermode/usermode/trap.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/arch/usermode/usermode/trap.c
diff -u src/sys/arch/usermode/usermode/trap.c:1.63.2.2 src/sys/arch/usermode/usermode/trap.c:1.63.2.3
--- src/sys/arch/usermode/usermode/trap.c:1.63.2.2	Thu Mar  8 17:21:20 2012
+++ src/sys/arch/usermode/usermode/trap.c	Wed Aug  8 15:32:25 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.63.2.2 2012/03/08 17:21:20 riz Exp $ */
+/* $NetBSD: trap.c,v 1.63.2.3 2012/08/08 15:32:25 martin Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.63.2.2 2012/03/08 17:21:20 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.63.2.3 2012/08/08 15:32:25 martin Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -364,10 +364,6 @@ handle_signal(int sig, siginfo_t *info, 
 	thunk_sigemptyset(jump_ucp.uc_sigmask);
 	jump_ucp.uc_flags = _UC_STACK | _UC_CPU | _UC_SIGMASK;
 
-	/* prevent recursive IO signals */
-	if (sig == SIGIO)
-		thunk_sigaddset(jump_ucp.uc_sigmask, SIGIO);
-
 	thunk_makecontext(jump_ucp,
 			(void (*)(void)) f,
 		4, info, (void *) from_userland, (void *) pc, (void *) va);
@@ -612,13 +608,15 @@ sigio(siginfo_t *info, vaddr_t from_user
 	struct lwp *l = curlwp;
 	struct pcb *pcb = lwp_getpcb(l); KASSERT(pcb);
 	struct intr_handler *sih;
-	unsigned int n;
+	unsigned int n, pass;
 
 //	thunk_printf(%s: l %p, pcb %p\n, __func__, l, pcb);
-	for (n = 0; n  SIGIO_MAX_HANDLERS; n++) {
-		sih = sigio_intr_handler[n];
-		if (sih-func)
-			sih-func(sih-arg);
+	for (pass = 0; pass  2; pass++) {
+		for (n = 0; n  SIGIO_MAX_HANDLERS; n++) {
+			sih = sigio_intr_handler[n];
+			if (sih-func)
+sih-func(sih-arg);
+		}
 	}
 
 	KASSERT(l == curlwp);



CVS commit: [netbsd-6] src/sys/arch/usermode/usermode

2012-03-08 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Mar  8 17:21:20 UTC 2012

Modified Files:
src/sys/arch/usermode/usermode [netbsd-6]: trap.c

Log Message:
Pull up following revision(s) (requested by reinoud in ticket #91):
sys/arch/usermode/usermode/trap.c: revision 1.65
Use the signal's signo instead of just returning SIGSEGV and add a comment


To generate a diff of this commit:
cvs rdiff -u -r1.63.2.1 -r1.63.2.2 src/sys/arch/usermode/usermode/trap.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/arch/usermode/usermode/trap.c
diff -u src/sys/arch/usermode/usermode/trap.c:1.63.2.1 src/sys/arch/usermode/usermode/trap.c:1.63.2.2
--- src/sys/arch/usermode/usermode/trap.c:1.63.2.1	Wed Mar  7 23:44:23 2012
+++ src/sys/arch/usermode/usermode/trap.c	Thu Mar  8 17:21:20 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.63.2.1 2012/03/07 23:44:23 riz Exp $ */
+/* $NetBSD: trap.c,v 1.63.2.2 2012/03/08 17:21:20 riz Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.63.2.1 2012/03/07 23:44:23 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.63.2.2 2012/03/08 17:21:20 riz Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -480,7 +480,7 @@ pagefault(siginfo_t *info, vaddr_t from_
 
 	KASSERT(from_userland);
 	KSI_INIT_TRAP(ksi);
-	ksi.ksi_signo = SIGSEGV;
+	ksi.ksi_signo = info-si_signo;
 	ksi.ksi_trap = 0;	/* XXX */
 	ksi.ksi_code = (error == EPERM) ? SEGV_ACCERR : SEGV_MAPERR;
 	ksi.ksi_addr = (void *) va;
@@ -552,6 +552,11 @@ illegal_instruction(siginfo_t *info, vad
 }
 
 
+/*
+ * handle pass to userland signals
+ *
+ * arguments other than the origional siginfo_t are not used
+ */
 static void
 pass_on(siginfo_t *info, vaddr_t from_userland, vaddr_t pc, vaddr_t va)
 {



CVS commit: [netbsd-6] src/sys/arch/usermode/usermode

2012-03-07 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Mar  7 23:23:51 UTC 2012

Modified Files:
src/sys/arch/usermode/usermode [netbsd-6]: pmap.c

Log Message:
Pull up following revision(s) (requested by reinoud in ticket #78):
sys/arch/usermode/usermode/pmap.c: revision 1.103
Move from pool(9) to kmem_zalloc(9) for L2 page tables. A pool with PAGE_SIZE
elements is accepted but seems to panic now and then claiming it can't find
the header info.
XXX should this be PR'd?


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.102.2.1 src/sys/arch/usermode/usermode/pmap.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/arch/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.102 src/sys/arch/usermode/usermode/pmap.c:1.102.2.1
--- src/sys/arch/usermode/usermode/pmap.c:1.102	Sat Jan 14 17:42:52 2012
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Mar  7 23:23:50 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.102 2012/01/14 17:42:52 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.102.2.1 2012/03/07 23:23:50 riz Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.102 2012/01/14 17:42:52 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.102.2.1 2012/03/07 23:23:50 riz Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -37,6 +37,7 @@ __KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.1
 #include sys/param.h
 #include sys/mutex.h
 #include sys/buf.h
+#include sys/kmem.h
 #include sys/malloc.h
 #include sys/pool.h
 #include machine/thunk.h
@@ -95,7 +96,6 @@ static uint64_t pm_entries_size = 0;
 
 static struct pool pmap_pool;
 static struct pool pmap_l1_pool;
-static struct pool pmap_l2_pool;
 static struct pool pmap_pventry_pool;
 
 /* forwards */
@@ -451,8 +451,6 @@ pmap_deferred_init(void)
 	/* create pmap pool */
 	pool_init(pmap_pool, sizeof(struct pmap), 0, 0, 0,
 	pmappool, NULL, IPL_NONE);
-	pool_init(pmap_l2_pool, PMAP_L2_SIZE, 0, 0, 0,
-	pmapl2pool, NULL, IPL_HIGH);
 	pool_init(pmap_l1_pool, pm_l1_size, 0, 0, 0,
 	pmapl1pool, NULL, IPL_NONE);
 	pool_init(pmap_pventry_pool, sizeof(struct pv_entry), 0, 0, 0,
@@ -529,7 +527,7 @@ pmap_destroy(pmap_t pmap)
 		l2tbl = pmap-pm_l1[l1];
 		if (!l2tbl)
 			continue;
-		pool_put(pmap_l2_pool, l2tbl);
+		kmem_free(l2tbl, PMAP_L2_SIZE);
 	}
 	pool_put(pmap_l1_pool, pmap-pm_l1);
 	pool_put(pmap_pool, pmap);
@@ -623,8 +621,8 @@ pmap_set_pv(pmap_t pmap, uintptr_t lpn, 
 
 	l2tbl = pmap-pm_l1[l1];
 	if (!l2tbl) {
-		l2tbl = pmap-pm_l1[l1] = pool_get(pmap_l2_pool, PR_WAITOK);
-		memset(l2tbl, 0, PMAP_L2_SIZE);
+		l2tbl = pmap-pm_l1[l1] = kmem_zalloc(PMAP_L2_SIZE, KM_SLEEP);
+		/* should be zero filled */
 	}
 	l2tbl-pm_l2[l2] = pv;
 }