in xcall(), use a (static) errbuf if we timeout, so we can build the whole

message up for a single call to printf_nolog().  this should get rid of
these messages that report no cpus answered.  eg:

	xcall(cpu0,0xf000868c): couldn't ping cpus:
vs
	xcall(cpu0,0xf000868c): couldn't ping cpus: cpu1
This commit is contained in:
mrg 2011-02-04 09:23:00 +00:00
parent 79aeb20cc3
commit f1ac58b963
1 changed files with 17 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.227 2011/01/27 06:24:59 mrg Exp $ */
/* $NetBSD: cpu.c,v 1.228 2011/02/04 09:23:00 mrg Exp $ */
/*
* Copyright (c) 1996
@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.227 2011/01/27 06:24:59 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.228 2011/02/04 09:23:00 mrg Exp $");
#include "opt_multiprocessor.h"
#include "opt_lockdebug.h"
@ -638,6 +638,9 @@ xcall(xcall_func_t func, xcall_trap_t trap, int arg0, int arg1, int arg2,
u_int pil;
int fasttrap;
int is_noop = func == (xcall_func_t)sparc_noop;
static char errbuf[160];
char *bufp = errbuf;
size_t bufsz = sizeof errbuf, wrsz;
mybit = (1 << cpuinfo.ci_cpuid);
callself = func && (cpuset & mybit) != 0;
@ -702,7 +705,6 @@ xcall(xcall_func_t func, xcall_trap_t trap, int arg0, int arg1, int arg2,
/*
* Second, call ourselves.
*/
p = &cpuinfo.msg.u.xpmsg_func;
if (callself)
(*func)(arg0, arg1, arg2);
@ -715,8 +717,11 @@ xcall(xcall_func_t func, xcall_trap_t trap, int arg0, int arg1, int arg2,
i = 100000; /* time-out, not too long, but still an _AGE_ */
while (!done) {
if (--i < 0) {
printf_nolog("xcall(cpu%d,%p): couldn't ping cpus:",
wrsz = snprintf(bufp, bufsz,
"xcall(cpu%d,%p): couldn't ping cpus:",
cpu_number(), func);
bufsz -= wrsz;
bufp += wrsz;
}
done = 1;
@ -726,7 +731,13 @@ xcall(xcall_func_t func, xcall_trap_t trap, int arg0, int arg1, int arg2,
if (cpi->msg.complete == 0) {
if (i < 0) {
printf_nolog(" cpu%d", cpi->ci_cpuid);
wrsz = snprintf(bufp, bufsz,
" cpu%d", cpi->ci_cpuid);
bufsz -= wrsz;
bufp += wrsz;
/* insanity */
if (bufsz < 0)
break;
} else {
done = 0;
break;
@ -735,8 +746,7 @@ xcall(xcall_func_t func, xcall_trap_t trap, int arg0, int arg1, int arg2,
}
}
if (i < 0)
printf_nolog("\n");
printf_nolog("%s\n", errbuf);
mutex_spin_exit(&xpmsg_mutex);
}