Source-Changes-HG archive

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

[src/trunk]: src/sys/arch PR port-sparc/54718 (sparc install hangs since rece...



details:   https://anonhg.NetBSD.org/src/rev/d6f2e5e5cb59
branches:  trunk
changeset: 846711:d6f2e5e5cb59
user:      ad <ad%NetBSD.org@localhost>
date:      Fri Nov 29 18:27:32 2019 +0000

description:
PR port-sparc/54718 (sparc install hangs since recent scheduler changes)

- userret() must be called every time we return to user, it's not optional.
- If clearing the AST with interrupts off, you must loop over userret().

diffstat:

 sys/arch/hppa/hppa/trap.c         |  13 +++++++------
 sys/arch/sh3/include/userret.h    |  13 +++++++++++--
 sys/arch/sh3/sh3/exception.c      |  16 +++-------------
 sys/arch/sparc/include/userret.h  |  13 +++++++------
 sys/arch/usermode/usermode/trap.c |  14 +++++++-------
 5 files changed, 35 insertions(+), 34 deletions(-)

diffs (168 lines):

diff -r c358abc30e6c -r d6f2e5e5cb59 sys/arch/hppa/hppa/trap.c
--- a/sys/arch/hppa/hppa/trap.c Fri Nov 29 17:44:27 2019 +0000
+++ b/sys/arch/hppa/hppa/trap.c Fri Nov 29 18:27:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.112 2019/11/21 19:24:00 ad Exp $    */
+/*     $NetBSD: trap.c,v 1.113 2019/11/29 18:27:32 ad Exp $    */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.112 2019/11/21 19:24:00 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.113 2019/11/29 18:27:32 ad Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -202,10 +202,11 @@
 {
        struct proc *p = l->l_proc;
 
-       l->l_md.md_astpending = 0;
-       //curcpu()->ci_data.cpu_nast++;
-
-       mi_userret(l);
+       do {
+               l->l_md.md_astpending = 0;
+               //curcpu()->ci_data.cpu_nast++;
+               mi_userret(l);
+       } while (l->l_md.md_astpending);
 
        /*
         * If profiling, charge recent system time to the trapped pc.
diff -r c358abc30e6c -r d6f2e5e5cb59 sys/arch/sh3/include/userret.h
--- a/sys/arch/sh3/include/userret.h    Fri Nov 29 17:44:27 2019 +0000
+++ b/sys/arch/sh3/include/userret.h    Fri Nov 29 18:27:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: userret.h,v 1.14 2016/11/02 00:11:59 pgoyette Exp $    */
+/*     $NetBSD: userret.h,v 1.15 2019/11/29 18:27:32 ad Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -52,7 +52,16 @@
 {
 
        /* Invoke MI userret code */
-       mi_userret(l);
+       do {
+               //curcpu()->ci_data.cpu_nast++;
+               l->l_md.md_astpending = 0;
+               mi_userret(l);
+       } while (l->l_md.md_astpending);
+
+       if (l->l_pflag & LP_OWEUPC) {
+               l->l_pflag &= ~LP_OWEUPC;
+               ADDUPROF(l);
+       }
 
 #ifdef PTRACE_HOOKS
        /* Check if lwp is being PT_STEP'ed */
diff -r c358abc30e6c -r d6f2e5e5cb59 sys/arch/sh3/sh3/exception.c
--- a/sys/arch/sh3/sh3/exception.c      Fri Nov 29 17:44:27 2019 +0000
+++ b/sys/arch/sh3/sh3/exception.c      Fri Nov 29 18:27:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exception.c,v 1.68 2019/11/21 19:24:01 ad Exp $        */
+/*     $NetBSD: exception.c,v 1.69 2019/11/29 18:27:33 ad Exp $        */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.68 2019/11/21 19:24:01 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.69 2019/11/29 18:27:33 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -471,15 +471,5 @@
        KDASSERT(l != NULL);
        KDASSERT(l->l_md.md_regs == tf);
 
-       while (l->l_md.md_astpending) {
-               //curcpu()->ci_data.cpu_nast++;
-               l->l_md.md_astpending = 0;
-
-               if (l->l_pflag & LP_OWEUPC) {
-                       l->l_pflag &= ~LP_OWEUPC;
-                       ADDUPROF(l);
-               }
-
-               userret(l);
-       }
+       userret(l);
 }
diff -r c358abc30e6c -r d6f2e5e5cb59 sys/arch/sparc/include/userret.h
--- a/sys/arch/sparc/include/userret.h  Fri Nov 29 17:44:27 2019 +0000
+++ b/sys/arch/sparc/include/userret.h  Fri Nov 29 18:27:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: userret.h,v 1.10 2019/11/23 16:50:39 ad Exp $ */
+/*     $NetBSD: userret.h,v 1.11 2019/11/29 18:27:33 ad Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -63,13 +63,14 @@
 {
        struct proc *p = l->l_proc;
 
-       while (cpuinfo.ci_want_ast) {
+       do {
                cpuinfo.ci_want_ast = 0;
                mi_userret(l);
-               if (l->l_pflag & LP_OWEUPC) {
-                       l->l_pflag &= ~LP_OWEUPC;
-                       ADDUPROF(l);
-               }
+       } while (cpuinfo.ci_want_ast);
+
+       if (l->l_pflag & LP_OWEUPC) {
+               l->l_pflag &= ~LP_OWEUPC;
+               ADDUPROF(l);
        }
 
        /*
diff -r c358abc30e6c -r d6f2e5e5cb59 sys/arch/usermode/usermode/trap.c
--- a/sys/arch/usermode/usermode/trap.c Fri Nov 29 17:44:27 2019 +0000
+++ b/sys/arch/usermode/usermode/trap.c Fri Nov 29 18:27:32 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.71 2019/11/21 19:24:02 ad Exp $ */
+/* $NetBSD: trap.c,v 1.72 2019/11/29 18:27:33 ad 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.71 2019/11/21 19:24:02 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.72 2019/11/29 18:27:33 ad Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -188,11 +188,12 @@
 {
        struct pcb *pcb;
 
-       if (!astpending)
-               return;
+       curcpu()->ci_data.cpu_ntrap++;
 
-       astpending = 0;
-       curcpu()->ci_data.cpu_ntrap++;
+       do {
+               astpending = 0;
+               mi_userret(l);
+       } while (astpending);
 
 #if 0
        /* profiling */
@@ -204,7 +205,6 @@
 
        KASSERT(l == curlwp); KASSERT(l);
        pcb = lwp_getpcb(l); KASSERT(pcb);
-       mi_userret(l);
 }
 
 



Home | Main Index | Thread Index | Old Index