Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/sparc re-introduce the NULL savefpstate IPI c...



details:   https://anonhg.NetBSD.org/src/rev/aa6333af8801
branches:  trunk
changeset: 768349:aa6333af8801
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Aug 15 02:19:44 2011 +0000

description:
re-introduce the NULL savefpstate IPI checks and evcnts.  something
is Wrong with GCC 4.5.3 and these trigger.  i haven't seen anything
else particularly wrong so for now this will allow sparc to switch
to GCC 4.5, which otherwise seems to be working very well for me.

sigh.  i'm going to file a PR to research what is really wrong here.

diffstat:

 sys/arch/sparc/sparc/cpu.c       |  20 ++++++++++++++++----
 sys/arch/sparc/sparc/cpuvar.h    |   3 ++-
 sys/arch/sparc/sparc/genassym.cf |   3 ++-
 sys/arch/sparc/sparc/locore.s    |  15 +++++++++++++--
 4 files changed, 33 insertions(+), 8 deletions(-)

diffs (129 lines):

diff -r 38d9967a2998 -r aa6333af8801 sys/arch/sparc/sparc/cpu.c
--- a/sys/arch/sparc/sparc/cpu.c        Mon Aug 15 01:04:04 2011 +0000
+++ b/sys/arch/sparc/sparc/cpu.c        Mon Aug 15 02:19:44 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.233 2011/07/17 23:18:23 mrg Exp $ */
+/*     $NetBSD: cpu.c,v 1.234 2011/08/15 02:19:44 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.233 2011/07/17 23:18:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.234 2011/08/15 02:19:44 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -346,9 +346,14 @@
 
        /*
         * Setup the per-cpu counters.
+        *
+        * The "savefp null" counter should go away when the NULL
+        * struct fpstate * bug is fixed.
         */
        evcnt_attach_dynamic(&cpi->ci_savefpstate, EVCNT_TYPE_MISC,
                             NULL, cpu_name(cpi), "savefp ipi");
+       evcnt_attach_dynamic(&cpi->ci_savefpstate_null, EVCNT_TYPE_MISC,
+                            NULL, cpu_name(cpi), "savefp null ipi");
        evcnt_attach_dynamic(&cpi->ci_xpmsg_mutex_fail, EVCNT_TYPE_MISC,
                             NULL, cpu_name(cpi), "IPI mutex_trylock fail");
        evcnt_attach_dynamic(&cpi->ci_xpmsg_mutex_fail_call, EVCNT_TYPE_MISC,
@@ -647,7 +652,6 @@
        /* Mask any CPUs that are not ready */
        cpuset &= cpu_ready_mask;
 
-       /* prevent interrupts that grab the kernel lock */
 #if 0
        mutex_spin_enter(&xpmsg_mutex);
 #else
@@ -664,9 +668,17 @@
         */
        pil = (getpsr() & PSR_PIL) >> 8;
        
-       if (cold || pil < 13)
+       if (cold || pil <= IPL_SCHED)
                mutex_spin_enter(&xpmsg_mutex);
        else {
+#ifdef DEBUG
+               u_int pc;
+
+               /* warn about xcall at high IPL */
+               __asm("mov %%i7, %0" : "=r" (pc) : );
+               printf_nolog("%d: xcall at lvl %u from 0x%x\n",
+                   cpu_number(), pil, pc);
+#endif
                while (mutex_tryenter(&xpmsg_mutex) == 0) {
                        cpuinfo.ci_xpmsg_mutex_fail.ev_count++;
                        if (cpuinfo.msg.tag) {
diff -r 38d9967a2998 -r aa6333af8801 sys/arch/sparc/sparc/cpuvar.h
--- a/sys/arch/sparc/sparc/cpuvar.h     Mon Aug 15 01:04:04 2011 +0000
+++ b/sys/arch/sparc/sparc/cpuvar.h     Mon Aug 15 02:19:44 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpuvar.h,v 1.89 2011/02/20 10:02:01 mrg Exp $ */
+/*     $NetBSD: cpuvar.h,v 1.90 2011/08/15 02:19:44 mrg Exp $ */
 
 /*
  *  Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -337,6 +337,7 @@
        vaddr_t ci_free_sva1, ci_free_eva1, ci_free_sva2, ci_free_eva2;
 
        struct evcnt ci_savefpstate;
+       struct evcnt ci_savefpstate_null;
        struct evcnt ci_xpmsg_mutex_fail;
        struct evcnt ci_xpmsg_mutex_fail_call;
        struct evcnt ci_intrcnt[16];
diff -r 38d9967a2998 -r aa6333af8801 sys/arch/sparc/sparc/genassym.cf
--- a/sys/arch/sparc/sparc/genassym.cf  Mon Aug 15 01:04:04 2011 +0000
+++ b/sys/arch/sparc/sparc/genassym.cf  Mon Aug 15 02:19:44 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.66 2011/07/01 18:51:51 dyoung Exp $
+#      $NetBSD: genassym.cf,v 1.67 2011/08/15 02:19:44 mrg Exp $
 
 #
 # Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -171,6 +171,7 @@
 define CPUINFO_MTX_OLDSPL      offsetof(struct cpu_info, ci_mtx_oldspl)
 define CPUINFO_IDEPTH          offsetof(struct cpu_info, ci_idepth)
 define CPUINFO_SAVEFPSTATE     offsetof(struct cpu_info, ci_savefpstate)
+define CPUINFO_SAVEFPSTATE_NULL offsetof(struct cpu_info, ci_savefpstate_null)
 
 # PTE bits and related information
 define PG_W            PG_W
diff -r 38d9967a2998 -r aa6333af8801 sys/arch/sparc/sparc/locore.s
--- a/sys/arch/sparc/sparc/locore.s     Mon Aug 15 01:04:04 2011 +0000
+++ b/sys/arch/sparc/sparc/locore.s     Mon Aug 15 02:19:44 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.264 2011/02/20 10:26:26 mrg Exp $ */
+/*     $NetBSD: locore.s,v 1.265 2011/08/15 02:19:44 mrg Exp $ */
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -5912,13 +5912,24 @@
         std    %f30, [%o0 + FS_REGS + (4*30)]
 
 /*
- * We got a NULL struct fpstate * on the IPI.  We panic.
+ * We really should panic here but while we figure out what the bug is
+ * that a remote CPU gets a NULL struct fpstate *, this lets the system
+ * work at least seemingly stably.
  */
 Lfp_null_fpstate:
+#if 1
+       sethi   %hi(CPUINFO_VA), %o5
+       ldd     [%o5 + CPUINFO_SAVEFPSTATE_NULL], %o2
+       inccc   %o3
+       addx    %o2, 0, %o2
+       retl
+        std    %o2, [%o5 + CPUINFO_SAVEFPSTATE_NULL]
+#else
        ld      [%o5 + CPUINFO_CPUNO], %o1
        sethi   %hi(Lpanic_savefpstate), %o0
        call    _C_LABEL(panic)
         or     %o0, %lo(Lpanic_savefpstate), %o0
+#endif
 
 /*
  * Store the (now known nonempty) FP queue.



Home | Main Index | Thread Index | Old Index