Module Name: src Committed By: mrg Date: Mon Aug 15 02:19:45 UTC 2011
Modified Files: src/sys/arch/sparc/sparc: cpu.c cpuvar.h genassym.cf locore.s Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.233 -r1.234 src/sys/arch/sparc/sparc/cpu.c cvs rdiff -u -r1.89 -r1.90 src/sys/arch/sparc/sparc/cpuvar.h cvs rdiff -u -r1.66 -r1.67 src/sys/arch/sparc/sparc/genassym.cf cvs rdiff -u -r1.264 -r1.265 src/sys/arch/sparc/sparc/locore.s 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/sparc/sparc/cpu.c diff -u src/sys/arch/sparc/sparc/cpu.c:1.233 src/sys/arch/sparc/sparc/cpu.c:1.234 --- src/sys/arch/sparc/sparc/cpu.c:1.233 Sun Jul 17 23:18:23 2011 +++ src/sys/arch/sparc/sparc/cpu.c Mon Aug 15 02:19:44 2011 @@ -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) { Index: src/sys/arch/sparc/sparc/cpuvar.h diff -u src/sys/arch/sparc/sparc/cpuvar.h:1.89 src/sys/arch/sparc/sparc/cpuvar.h:1.90 --- src/sys/arch/sparc/sparc/cpuvar.h:1.89 Sun Feb 20 10:02:01 2011 +++ src/sys/arch/sparc/sparc/cpuvar.h Mon Aug 15 02:19:44 2011 @@ -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]; Index: src/sys/arch/sparc/sparc/genassym.cf diff -u src/sys/arch/sparc/sparc/genassym.cf:1.66 src/sys/arch/sparc/sparc/genassym.cf:1.67 --- src/sys/arch/sparc/sparc/genassym.cf:1.66 Fri Jul 1 18:51:51 2011 +++ src/sys/arch/sparc/sparc/genassym.cf Mon Aug 15 02:19:44 2011 @@ -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 Index: src/sys/arch/sparc/sparc/locore.s diff -u src/sys/arch/sparc/sparc/locore.s:1.264 src/sys/arch/sparc/sparc/locore.s:1.265 --- src/sys/arch/sparc/sparc/locore.s:1.264 Sun Feb 20 10:26:26 2011 +++ src/sys/arch/sparc/sparc/locore.s Mon Aug 15 02:19:44 2011 @@ -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.