Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 Increase an interrupt depth only in...



details:   https://anonhg.NetBSD.org/src/rev/44ca85675aa4
branches:  trunk
changeset: 791849:44ca85675aa4
user:      nakayama <nakayama%NetBSD.org@localhost>
date:      Fri Dec 06 21:11:06 2013 +0000

description:
Increase an interrupt depth only in the case of hardware interrupts,
and remove the ci_idepth trick in softint_fastintr.

Fixes the following diagnostic panic reported in port-sparc64.

  panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file
  "../../../../kern/subr_xcall.c", line 351

diffstat:

 sys/arch/sparc64/sparc64/locore.s |  35 +++++++++++++++++------------------
 1 files changed, 17 insertions(+), 18 deletions(-)

diffs (91 lines):

diff -r 2dbb4ce9e73b -r 44ca85675aa4 sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Fri Dec 06 14:01:12 2013 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Fri Dec 06 21:11:06 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.349 2013/05/24 23:02:27 nakayama Exp $    */
+/*     $NetBSD: locore.s,v 1.350 2013/12/06 21:11:06 nakayama Exp $    */
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -3288,12 +3288,6 @@
         LDPTR  [%g3 + %lo(CPUINFO_VA+CI_TICK_IH)], %g5
 0:
 
-       ! Increment the per-cpu interrupt level
-       sethi   %hi(CPUINFO_VA+CI_IDEPTH), %g1
-       ld      [%g1 + %lo(CPUINFO_VA+CI_IDEPTH)], %g2
-       inc     %g2
-       st      %g2, [%g1 + %lo(CPUINFO_VA+CI_IDEPTH)]
-
 #ifdef TRAPSTATS
        sethi   %hi(_C_LABEL(kintrcnt)), %g1
        sethi   %hi(_C_LABEL(uintrcnt)), %g2
@@ -3382,6 +3376,17 @@
        
        wrpr    %l6, %pil
 
+#define SOFTINT_INT \
+       (1<<IPL_SOFTCLOCK|1<<IPL_SOFTBIO|1<<IPL_SOFTNET|1<<IPL_SOFTSERIAL)
+
+       ! Increment the per-cpu interrupt depth in case of hardintrs
+       btst    SOFTINT_INT, %l3
+       bnz,pn  %icc, sparc_intr_retry
+        sethi  %hi(CPUINFO_VA+CI_IDEPTH), %l1
+       ld      [%l1 + %lo(CPUINFO_VA+CI_IDEPTH)], %l2
+       inc     %l2
+       st      %l2, [%l1 + %lo(CPUINFO_VA+CI_IDEPTH)]
+
 sparc_intr_retry:
        wr      %l3, 0, CLEAR_SOFTINT   ! (don't clear possible %tick IRQ)
        sethi   %hi(CPUINFO_VA+CI_INTRPENDING), %l4
@@ -3481,11 +3486,14 @@
        bnz,pn  %icc, sparc_intr_retry
         mov    1, %l5                  ! initialize intr count for next run
 
-       ! Decrement this cpu's interrupt depth
-       sethi   %hi(CPUINFO_VA+CI_IDEPTH), %l4
+       ! Decrement this cpu's interrupt depth in case of hardintrs
+       btst    SOFTINT_INT, %l3
+       bnz,pn  %icc, 1f
+        sethi  %hi(CPUINFO_VA+CI_IDEPTH), %l4
        ld      [%l4 + %lo(CPUINFO_VA+CI_IDEPTH)], %l5
        dec     %l5
        st      %l5, [%l4 + %lo(CPUINFO_VA+CI_IDEPTH)]
+1:
 
 #ifdef NOT_DEBUG
        set     _C_LABEL(intrdebug), %o2
@@ -5238,11 +5246,8 @@
        set     CPUINFO_VA, %l0                 ! l0 = curcpu()
        rdpr    %pil, %l7                       ! l7 = splhigh()
        wrpr    %g0, PIL_HIGH, %pil
-       ld      [%l0 + CI_IDEPTH], %l1
        LDPTR   [%l0 + CI_EINTSTACK], %l6       ! l6 = ci_eintstack
-       dec     %l1
        add     %sp, -CC64FSZ, %l2              ! ci_eintstack = sp - CC64FSZ
-       st      %l1, [%l0 + CI_IDEPTH]          ! adjust ci_idepth
        STPTR   %l2, [%l0 + CI_EINTSTACK]       ! save intstack for nexted intr
 
        mov     %i0, %o0                        ! o0/i0 = softint lwp
@@ -5287,10 +5292,7 @@
 
        restore                                 ! rewind register window
 
-       ld      [%l0 + CI_IDEPTH], %l1
        STPTR   %l6, [%l0 + CI_EINTSTACK]       ! restore ci_eintstack
-       inc     %l1
-       st      %l1, [%l0 + CI_IDEPTH]          ! re-adjust ci_idepth
        wrpr    %g0, %l7, %pil                  ! restore ipl
        ret
         restore        %g0, 1, %o0
@@ -5314,10 +5316,7 @@
        st      %o1, [%l0 + CI_MTX_COUNT]
        st      %g0, [%o0 + L_CTXSWTCH]         ! prev->l_ctxswtch = 0
 
-       ld      [%l0 + CI_IDEPTH], %l1
        STPTR   %l6, [%l0 + CI_EINTSTACK]       ! restore ci_eintstack
-       inc     %l1
-       st      %l1, [%l0 + CI_IDEPTH]          ! re-adjust ci_idepth
        wrpr    %g0, %l7, %pil                  ! restore ipl
        ret
         restore        %g0, 1, %o0



Home | Main Index | Thread Index | Old Index