Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode/usermode Fix IO lockups in NetBSD/usermode.



details:   https://anonhg.NetBSD.org/src/rev/8a5b1988aff9
branches:  trunk
changeset: 780716:8a5b1988aff9
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Sat Aug 04 14:53:32 2012 +0000

description:
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.

diffstat:

 sys/arch/usermode/usermode/trap.c |  20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diffs (50 lines):

diff -r c1ecbde50ec8 -r 8a5b1988aff9 sys/arch/usermode/usermode/trap.c
--- a/sys/arch/usermode/usermode/trap.c Sat Aug 04 13:03:38 2012 +0000
+++ b/sys/arch/usermode/usermode/trap.c Sat Aug 04 14:53:32 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.65 2012/03/03 21:29:02 reinoud Exp $ */
+/* $NetBSD: trap.c,v 1.66 2012/08/04 14:53:32 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk <reinoud%netbsd.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.65 2012/03/03 21:29:02 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.66 2012/08/04 14:53:32 reinoud Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -364,10 +364,6 @@
        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 @@
        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);



Home | Main Index | Thread Index | Old Index