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.
This commit is contained in:
mrg 2011-08-15 02:19:44 +00:00
parent 17b414a01a
commit a086f3a52c
4 changed files with 33 additions and 8 deletions

View File

@ -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 @@ cpu_init_evcnt(struct cpu_info *cpi)
/*
* 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 @@ xcall(xcall_func_t func, xcall_trap_t trap, int arg0, int arg1, int arg2,
/* 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 @@ xcall(xcall_func_t func, xcall_trap_t trap, int arg0, int arg1, int arg2,
*/
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) {

View File

@ -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 @@ struct cpu_info {
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];

View File

@ -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_COUNT offsetof(struct cpu_info, ci_mtx_count)
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

View File

@ -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 @@ Lfp_finish:
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.