Sun Feb 20 10:02:02 2011 UTC ()
remove the evcnt for NULL struct fpstate * ipi, and switch over to an
explicit panic() if we get one.

i'm pretty sure that converting xmpsg_lock from IPL_VM to IPL_SCHED
fixed this problem properly.  i have not seen the evcnt trigger since
that change, nor have several others queried.


(mrg)
diff -r1.230 -r1.231 src/sys/arch/sparc/sparc/cpu.c
diff -r1.88 -r1.89 src/sys/arch/sparc/sparc/cpuvar.h
diff -r1.64 -r1.65 src/sys/arch/sparc/sparc/genassym.cf
diff -r1.262 -r1.263 src/sys/arch/sparc/sparc/locore.s

cvs diff -r1.230 -r1.231 src/sys/arch/sparc/sparc/cpu.c (expand / switch to unified diff)

--- src/sys/arch/sparc/sparc/cpu.c 2011/02/15 09:05:14 1.230
+++ src/sys/arch/sparc/sparc/cpu.c 2011/02/20 10:02:01 1.231
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpu.c,v 1.230 2011/02/15 09:05:14 mrg Exp $ */ 1/* $NetBSD: cpu.c,v 1.231 2011/02/20 10:02:01 mrg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 4 * Copyright (c) 1996
5 * The President and Fellows of Harvard College. All rights reserved. 5 * The President and Fellows of Harvard College. All rights reserved.
6 * Copyright (c) 1992, 1993 6 * Copyright (c) 1992, 1993
7 * The Regents of the University of California. All rights reserved. 7 * The Regents of the University of California. All rights reserved.
8 * 8 *
9 * This software was developed by the Computer Systems Engineering group 9 * This software was developed by the Computer Systems Engineering group
10 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 10 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
11 * contributed to Berkeley. 11 * contributed to Berkeley.
12 * 12 *
13 * All advertising materials mentioning features or use of this software 13 * All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement: 14 * must display the following acknowledgement:
@@ -42,27 +42,27 @@ @@ -42,27 +42,27 @@
42 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 42 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 43 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
44 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
45 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 45 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
46 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 46 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
47 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 47 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 * SUCH DAMAGE. 48 * SUCH DAMAGE.
49 * 49 *
50 * @(#)cpu.c 8.5 (Berkeley) 11/23/93 50 * @(#)cpu.c 8.5 (Berkeley) 11/23/93
51 * 51 *
52 */ 52 */
53 53
54#include <sys/cdefs.h> 54#include <sys/cdefs.h>
55__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.230 2011/02/15 09:05:14 mrg Exp $"); 55__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.231 2011/02/20 10:02:01 mrg Exp $");
56 56
57#include "opt_multiprocessor.h" 57#include "opt_multiprocessor.h"
58#include "opt_lockdebug.h" 58#include "opt_lockdebug.h"
59#include "opt_ddb.h" 59#include "opt_ddb.h"
60#include "opt_sparc_arch.h" 60#include "opt_sparc_arch.h"
61 61
62#include <sys/param.h> 62#include <sys/param.h>
63#include <sys/systm.h> 63#include <sys/systm.h>
64#include <sys/device.h> 64#include <sys/device.h>
65#include <sys/malloc.h> 65#include <sys/malloc.h>
66#include <sys/kernel.h> 66#include <sys/kernel.h>
67#include <sys/evcnt.h> 67#include <sys/evcnt.h>
68#include <sys/xcall.h> 68#include <sys/xcall.h>
@@ -332,34 +332,29 @@ static const char * const soft_intr_name @@ -332,34 +332,29 @@ static const char * const soft_intr_name
332 "lev12 soft", 332 "lev12 soft",
333 "xcall std", 333 "xcall std",
334 "xcall fast", 334 "xcall fast",
335 "nmi soft", 335 "nmi soft",
336}; 336};
337 337
338static void 338static void
339cpu_init_evcnt(struct cpu_info *cpi) 339cpu_init_evcnt(struct cpu_info *cpi)
340{ 340{
341 int i; 341 int i;
342 342
343 /* 343 /*
344 * Setup the per-cpu counters. 344 * Setup the per-cpu counters.
345 * 
346 * The "savefp null" counter should go away when the NULL 
347 * struct fpstate * bug is fixed. 
348 */ 345 */
349 evcnt_attach_dynamic(&cpi->ci_savefpstate, EVCNT_TYPE_MISC, 346 evcnt_attach_dynamic(&cpi->ci_savefpstate, EVCNT_TYPE_MISC,
350 NULL, cpu_name(cpi), "savefp ipi"); 347 NULL, cpu_name(cpi), "savefp ipi");
351 evcnt_attach_dynamic(&cpi->ci_savefpstate_null, EVCNT_TYPE_MISC, 
352 NULL, cpu_name(cpi), "savefp null ipi"); 
353 evcnt_attach_dynamic(&cpi->ci_xpmsg_mutex_fail, EVCNT_TYPE_MISC, 348 evcnt_attach_dynamic(&cpi->ci_xpmsg_mutex_fail, EVCNT_TYPE_MISC,
354 NULL, cpu_name(cpi), "IPI mutex_trylock fail"); 349 NULL, cpu_name(cpi), "IPI mutex_trylock fail");
355 evcnt_attach_dynamic(&cpi->ci_xpmsg_mutex_fail_call, EVCNT_TYPE_MISC, 350 evcnt_attach_dynamic(&cpi->ci_xpmsg_mutex_fail_call, EVCNT_TYPE_MISC,
356 NULL, cpu_name(cpi), "IPI mutex_trylock fail/call"); 351 NULL, cpu_name(cpi), "IPI mutex_trylock fail/call");
357 352
358 /* 353 /*
359 * These are the per-cpu per-IPL hard & soft interrupt counters. 354 * These are the per-cpu per-IPL hard & soft interrupt counters.
360 */ 355 */
361 for (i = 0; i < 16; i++) { 356 for (i = 0; i < 16; i++) {
362 evcnt_attach_dynamic(&cpi->ci_intrcnt[i], EVCNT_TYPE_INTR, 357 evcnt_attach_dynamic(&cpi->ci_intrcnt[i], EVCNT_TYPE_INTR,
363 NULL, cpu_name(cpi), hard_intr_names[i]); 358 NULL, cpu_name(cpi), hard_intr_names[i]);
364 evcnt_attach_dynamic(&cpi->ci_sintrcnt[i], EVCNT_TYPE_INTR, 359 evcnt_attach_dynamic(&cpi->ci_sintrcnt[i], EVCNT_TYPE_INTR,
365 NULL, cpu_name(cpi), soft_intr_names[i]); 360 NULL, cpu_name(cpi), soft_intr_names[i]);

cvs diff -r1.88 -r1.89 src/sys/arch/sparc/sparc/cpuvar.h (expand / switch to unified diff)

--- src/sys/arch/sparc/sparc/cpuvar.h 2011/02/15 09:05:14 1.88
+++ src/sys/arch/sparc/sparc/cpuvar.h 2011/02/20 10:02:01 1.89
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpuvar.h,v 1.88 2011/02/15 09:05:14 mrg Exp $ */ 1/* $NetBSD: cpuvar.h,v 1.89 2011/02/20 10:02:01 mrg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Paul Kranenburg. 8 * by Paul Kranenburg.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -327,27 +327,26 @@ struct cpu_info { @@ -327,27 +327,26 @@ struct cpu_info {
327 /* Module Control Registers */ 327 /* Module Control Registers */
328 /*bus_space_handle_t*/ long ci_mbusport; 328 /*bus_space_handle_t*/ long ci_mbusport;
329 /*bus_space_handle_t*/ long ci_mxccregs; 329 /*bus_space_handle_t*/ long ci_mxccregs;
330 330
331 u_int ci_tt; /* Last trap (if tracing) */ 331 u_int ci_tt; /* Last trap (if tracing) */
332 332
333 /* 333 /*
334 * Start/End VA's of this cpu_info region; we upload the other pages 334 * Start/End VA's of this cpu_info region; we upload the other pages
335 * in this region that aren't part of the cpu_info to uvm. 335 * in this region that aren't part of the cpu_info to uvm.
336 */ 336 */
337 vaddr_t ci_free_sva1, ci_free_eva1, ci_free_sva2, ci_free_eva2; 337 vaddr_t ci_free_sva1, ci_free_eva1, ci_free_sva2, ci_free_eva2;
338 338
339 struct evcnt ci_savefpstate; 339 struct evcnt ci_savefpstate;
340 struct evcnt ci_savefpstate_null; 
341 struct evcnt ci_xpmsg_mutex_fail; 340 struct evcnt ci_xpmsg_mutex_fail;
342 struct evcnt ci_xpmsg_mutex_fail_call; 341 struct evcnt ci_xpmsg_mutex_fail_call;
343 struct evcnt ci_intrcnt[16]; 342 struct evcnt ci_intrcnt[16];
344 struct evcnt ci_sintrcnt[16]; 343 struct evcnt ci_sintrcnt[16];
345}; 344};
346 345
347/* 346/*
348 * CPU architectures 347 * CPU architectures
349 */ 348 */
350#define CPUARCH_UNKNOWN 0 349#define CPUARCH_UNKNOWN 0
351#define CPUARCH_SUN4 1 350#define CPUARCH_SUN4 1
352#define CPUARCH_SUN4C 2 351#define CPUARCH_SUN4C 2
353#define CPUARCH_SUN4M 3 352#define CPUARCH_SUN4M 3

cvs diff -r1.64 -r1.65 src/sys/arch/sparc/sparc/genassym.cf (expand / switch to unified diff)

--- src/sys/arch/sparc/sparc/genassym.cf 2011/01/27 06:24:59 1.64
+++ src/sys/arch/sparc/sparc/genassym.cf 2011/02/20 10:02:01 1.65
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: genassym.cf,v 1.64 2011/01/27 06:24:59 mrg Exp $ 1# $NetBSD: genassym.cf,v 1.65 2011/02/20 10:02:01 mrg Exp $
2 2
3# 3#
4# Copyright (c) 1998 The NetBSD Foundation, Inc. 4# Copyright (c) 1998 The NetBSD Foundation, Inc.
5# All rights reserved. 5# All rights reserved.
6# 6#
7# This code is derived from software contributed to The NetBSD Foundation 7# This code is derived from software contributed to The NetBSD Foundation
8# by Christos Zoulas. 8# by Christos Zoulas.
9# 9#
10# Redistribution and use in source and binary forms, with or without 10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted provided that the following conditions 11# modification, are permitted provided that the following conditions
12# are met: 12# are met:
13# 1. Redistributions of source code must retain the above copyright 13# 1. Redistributions of source code must retain the above copyright
14# notice, this list of conditions and the following disclaimer. 14# notice, this list of conditions and the following disclaimer.
@@ -161,27 +161,26 @@ define CPUINFO_TT offsetof(struct cpu_i @@ -161,27 +161,26 @@ define CPUINFO_TT offsetof(struct cpu_i
161define CPUINFO_CACHE_LINESZ offsetof(struct cpu_info, cacheinfo.c_linesize) 161define CPUINFO_CACHE_LINESZ offsetof(struct cpu_info, cacheinfo.c_linesize)
162define CPUINFO_CACHE_NLINES offsetof(struct cpu_info, cacheinfo.c_nlines) 162define CPUINFO_CACHE_NLINES offsetof(struct cpu_info, cacheinfo.c_nlines)
163define CPUINFO_XMSG_FUNC offsetof(struct cpu_info, msg.u.xpmsg_func.func) 163define CPUINFO_XMSG_FUNC offsetof(struct cpu_info, msg.u.xpmsg_func.func)
164define CPUINFO_XMSG_TRAP offsetof(struct cpu_info, msg.u.xpmsg_func.trap) 164define CPUINFO_XMSG_TRAP offsetof(struct cpu_info, msg.u.xpmsg_func.trap)
165define CPUINFO_XMSG_ARG0 offsetof(struct cpu_info, msg.u.xpmsg_func.arg0) 165define CPUINFO_XMSG_ARG0 offsetof(struct cpu_info, msg.u.xpmsg_func.arg0)
166define CPUINFO_XMSG_ARG1 offsetof(struct cpu_info, msg.u.xpmsg_func.arg1) 166define CPUINFO_XMSG_ARG1 offsetof(struct cpu_info, msg.u.xpmsg_func.arg1)
167define CPUINFO_XMSG_ARG2 offsetof(struct cpu_info, msg.u.xpmsg_func.arg2) 167define CPUINFO_XMSG_ARG2 offsetof(struct cpu_info, msg.u.xpmsg_func.arg2)
168define CPUINFO_XMSG_CMPLT offsetof(struct cpu_info, msg.complete) 168define CPUINFO_XMSG_CMPLT offsetof(struct cpu_info, msg.complete)
169define CPUINFO_IDLESPIN offsetof(struct cpu_info, idlespin) 169define CPUINFO_IDLESPIN offsetof(struct cpu_info, idlespin)
170define CPUINFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count) 170define CPUINFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count)
171define CPUINFO_MTX_OLDSPL offsetof(struct cpu_info, ci_mtx_oldspl) 171define CPUINFO_MTX_OLDSPL offsetof(struct cpu_info, ci_mtx_oldspl)
172define CPUINFO_IDEPTH offsetof(struct cpu_info, ci_idepth) 172define CPUINFO_IDEPTH offsetof(struct cpu_info, ci_idepth)
173define CPUINFO_SAVEFPSTATE offsetof(struct cpu_info, ci_savefpstate) 173define CPUINFO_SAVEFPSTATE offsetof(struct cpu_info, ci_savefpstate)
174define CPUINFO_SAVEFPSTATE_NULL offsetof(struct cpu_info, ci_savefpstate_null) 
175 174
176# PTE bits and related information 175# PTE bits and related information
177define PG_W PG_W 176define PG_W PG_W
178define PG_VSHIFT PG_VSHIFT 177define PG_VSHIFT PG_VSHIFT
179define PG_PROTSHIFT PG_PROTSHIFT 178define PG_PROTSHIFT PG_PROTSHIFT
180define PG_PROTUREAD PG_PROTUREAD 179define PG_PROTUREAD PG_PROTUREAD
181define PG_PROTUWRITE PG_PROTUWRITE 180define PG_PROTUWRITE PG_PROTUWRITE
182 181
183define SRMMU_TETYPE SRMMU_TETYPE 182define SRMMU_TETYPE SRMMU_TETYPE
184define SRMMU_TEPTE SRMMU_TEPTE 183define SRMMU_TEPTE SRMMU_TEPTE
185define SRMMU_PROT_MASK SRMMU_PROT_MASK 184define SRMMU_PROT_MASK SRMMU_PROT_MASK
186define PPROT_R_RW PPROT_R_RW 185define PPROT_R_RW PPROT_R_RW
187define PPROT_RX_RX PPROT_RX_RX 186define PPROT_RX_RX PPROT_RX_RX

cvs diff -r1.262 -r1.263 src/sys/arch/sparc/sparc/locore.s (expand / switch to unified diff)

--- src/sys/arch/sparc/sparc/locore.s 2011/02/15 11:30:21 1.262
+++ src/sys/arch/sparc/sparc/locore.s 2011/02/20 10:02:01 1.263
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: locore.s,v 1.262 2011/02/15 11:30:21 mrg Exp $ */ 1/* $NetBSD: locore.s,v 1.263 2011/02/20 10:02:01 mrg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 Paul Kranenburg 4 * Copyright (c) 1996 Paul Kranenburg
5 * Copyright (c) 1996 5 * Copyright (c) 1996
6 * The President and Fellows of Harvard College. All rights reserved. 6 * The President and Fellows of Harvard College. All rights reserved.
7 * Copyright (c) 1992, 1993 7 * Copyright (c) 1992, 1993
8 * The Regents of the University of California. All rights reserved. 8 * The Regents of the University of California. All rights reserved.
9 * 9 *
10 * This software was developed by the Computer Systems Engineering group 10 * This software was developed by the Computer Systems Engineering group
11 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 11 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
12 * contributed to Berkeley. 12 * contributed to Berkeley.
13 * 13 *
14 * All advertising materials mentioning features or use of this software 14 * All advertising materials mentioning features or use of this software
@@ -5902,44 +5902,33 @@ Lfp_finish: @@ -5902,44 +5902,33 @@ Lfp_finish:
5902 std %f12, [%o0 + FS_REGS + (4*12)] 5902 std %f12, [%o0 + FS_REGS + (4*12)]
5903 std %f14, [%o0 + FS_REGS + (4*14)] 5903 std %f14, [%o0 + FS_REGS + (4*14)]
5904 std %f16, [%o0 + FS_REGS + (4*16)] 5904 std %f16, [%o0 + FS_REGS + (4*16)]
5905 std %f18, [%o0 + FS_REGS + (4*18)] 5905 std %f18, [%o0 + FS_REGS + (4*18)]
5906 std %f20, [%o0 + FS_REGS + (4*20)] 5906 std %f20, [%o0 + FS_REGS + (4*20)]
5907 std %f22, [%o0 + FS_REGS + (4*22)] 5907 std %f22, [%o0 + FS_REGS + (4*22)]
5908 std %f24, [%o0 + FS_REGS + (4*24)] 5908 std %f24, [%o0 + FS_REGS + (4*24)]
5909 std %f26, [%o0 + FS_REGS + (4*26)] 5909 std %f26, [%o0 + FS_REGS + (4*26)]
5910 std %f28, [%o0 + FS_REGS + (4*28)] 5910 std %f28, [%o0 + FS_REGS + (4*28)]
5911 retl 5911 retl
5912 std %f30, [%o0 + FS_REGS + (4*30)] 5912 std %f30, [%o0 + FS_REGS + (4*30)]
5913 5913
5914/* 5914/*
5915 * We really should panic here but while we figure out what the bug is 5915 * We got a NULL struct fpstate * on the IPI. We panic.
5916 * that a remote CPU gets a NULL struct fpstate *, this lets the system 
5917 * work at least seemingly stably. 
5918 */ 5916 */
5919Lfp_null_fpstate: 5917Lfp_null_fpstate:
5920#if 1 
5921 sethi %hi(CPUINFO_VA), %o5 
5922 ldd [%o5 + CPUINFO_SAVEFPSTATE_NULL], %o2 
5923 inccc %o3 
5924 addx %o2, 0, %o2 
5925 retl 
5926 std %o2, [%o5 + CPUINFO_SAVEFPSTATE_NULL] 
5927#else 
5928 ld [%o5 + CPUINFO_CPUNO], %o1 5918 ld [%o5 + CPUINFO_CPUNO], %o1
5929 sethi %hi(Lpanic_savefpstate), %o0 5919 sethi %hi(Lpanic_savefpstate), %o0
5930 call _C_LABEL(panic) 5920 call _C_LABEL(panic)
5931 or %o0, %lo(Lpanic_savefpstate), %o0 5921 or %o0, %lo(Lpanic_savefpstate), %o0
5932#endif 
59331: 59221:
5934 5923
5935/* 5924/*
5936 * Store the (now known nonempty) FP queue. 5925 * Store the (now known nonempty) FP queue.
5937 * We have to reread the fsr each time in order to get the new QNE bit. 5926 * We have to reread the fsr each time in order to get the new QNE bit.
5938 */ 5927 */
5939Lfp_storeq: 5928Lfp_storeq:
5940 add %o0, FS_QUEUE, %o1 ! q = &f->fs_queue[0]; 5929 add %o0, FS_QUEUE, %o1 ! q = &f->fs_queue[0];
59411: 59301:
5942 std %fq, [%o1 + %o3] ! q[qsize++] = fsr_qfront(); 5931 std %fq, [%o1 + %o3] ! q[qsize++] = fsr_qfront();
5943 st %fsr, [%o0 + FS_FSR] ! reread fsr 5932 st %fsr, [%o0 + FS_FSR] ! reread fsr
5944 ld [%o0 + FS_FSR], %o4 ! if fsr & QNE, loop 5933 ld [%o0 + FS_FSR], %o4 ! if fsr & QNE, loop
5945 btst %o5, %o4 5934 btst %o5, %o4