Revert a change that crept in during MFC.

This commit is contained in:
attilio 2011-05-31 20:23:33 +00:00
parent b1bf71d3c5
commit 066c7ac96c
6 changed files with 13 additions and 99 deletions

View File

@ -432,10 +432,7 @@ options KTRACE_REQUEST_POOL=101
# defined by the KTR_* constants in <sys/ktr.h>. KTR_MASK defines the
# initial value of the ktr_mask variable which determines at runtime
# what events to trace. KTR_CPUMASK determines which CPU's log
# events, with bit X corresponding to CPU X. The layout of the string
# passed as KTR_CPUMASK must match a serie of bitmasks each of them
# separated by the ", " characters (ie:
# KTR_CPUMASK=("0xAF, 0xFFFFFFFFFFFFFFFF")). KTR_VERBOSE enables
# events, with bit X corresponding to CPU X. KTR_VERBOSE enables
# dumping of KTR events to the console by default. This functionality
# can be toggled via the debug.ktr_verbose sysctl and defaults to off
# if KTR_VERBOSE is not defined. See ktr(4) and ktrdump(8) for details.
@ -444,7 +441,7 @@ options KTR
options KTR_ENTRIES=1024
options KTR_COMPILE=(KTR_INTR|KTR_PROC)
options KTR_MASK=KTR_INTR
options KTR_CPUMASK=("0x3")
options KTR_CPUMASK=0x3
options KTR_VERBOSE
#

View File

@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
#include <sys/cpuset.h>
#include <sys/sx.h>
#include <sys/queue.h>
#include <sys/libkern.h>
#include <sys/limits.h>
#include <sys/bus.h>
#include <sys/interrupt.h>
@ -660,41 +659,6 @@ cpusetobj_strprint(char *buf, const cpuset_t *set)
return (buf);
}
/*
* Build a valid cpuset_t object from a string representation.
* It expects an incoming buffer at least sized as CPUSETBUFSIZ.
*/
int
cpusetobj_strscan(cpuset_t *set, const char *buf)
{
u_int nwords;
int i;
if (strlen(buf) > CPUSETBUFSIZ - 1)
return (-1);
/* Allow to pass a shorter version of the mask when necessary. */
nwords = 1;
for (i = 0; buf[i] != '\0'; i++)
if (buf[i] == ',')
nwords++;
if (nwords > _NCPUWORDS)
return (-1);
CPU_ZERO(set);
for (i = nwords - 1; i > 0; i--) {
if (!sscanf(buf, "%lx, ", &set->__bits[i]))
return (-1);
buf = strstr(buf, " ");
if (buf == NULL)
return (-1);
buf++;
}
if (!sscanf(buf, "%lx", &set->__bits[0]))
return (-1);
return (0);
}
/*
* Apply an anonymous mask to a single thread.
*/

View File

@ -40,10 +40,8 @@ __FBSDID("$FreeBSD$");
#include "opt_alq.h"
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/alq.h>
#include <sys/cons.h>
#include <sys/cpuset.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/libkern.h>
@ -70,6 +68,10 @@ __FBSDID("$FreeBSD$");
#define KTR_MASK (0)
#endif
#ifndef KTR_CPUMASK
#define KTR_CPUMASK (~0)
#endif
#ifndef KTR_TIME
#define KTR_TIME get_cyclecount()
#endif
@ -82,6 +84,11 @@ FEATURE(ktr, "Kernel support for KTR kernel tracing facility");
SYSCTL_NODE(_debug, OID_AUTO, ktr, CTLFLAG_RD, 0, "KTR options");
int ktr_cpumask = KTR_CPUMASK;
TUNABLE_INT("debug.ktr.cpumask", &ktr_cpumask);
SYSCTL_INT(_debug_ktr, OID_AUTO, cpumask, CTLFLAG_RW,
&ktr_cpumask, 0, "Bitmask of CPUs on which KTR logging is enabled");
int ktr_mask = KTR_MASK;
TUNABLE_INT("debug.ktr.mask", &ktr_mask);
SYSCTL_INT(_debug_ktr, OID_AUTO, mask, CTLFLAG_RW,
@ -99,54 +106,6 @@ int ktr_version = KTR_VERSION;
SYSCTL_INT(_debug_ktr, OID_AUTO, version, CTLFLAG_RD,
&ktr_version, 0, "Version of the KTR interface");
cpuset_t ktr_cpumask;
static char ktr_cpumask_str[CPUSETBUFSIZ];
TUNABLE_STR("debug.ktr.cpumask", ktr_cpumask_str, sizeof(ktr_cpumask_str));
static void
ktr_cpumask_initializer(void *dummy __unused)
{
CPU_FILL(&ktr_cpumask);
#ifdef KTR_CPUMASK
if (cpusetobj_strscan(&ktr_cpumask, KTR_CPUMASK) == -1)
CPU_FILL(&ktr_cpumask);
#endif
/*
* TUNABLE_STR() runs with SI_ORDER_MIDDLE priority, thus it must be
* already set, if necessary.
*/
if (ktr_cpumask_str[0] != '\0' &&
cpusetobj_strscan(&ktr_cpumask, ktr_cpumask_str) == -1)
CPU_FILL(&ktr_cpumask);
}
SYSINIT(ktr_cpumask_initializer, SI_SUB_TUNABLES, SI_ORDER_ANY,
ktr_cpumask_initializer, NULL);
static int
sysctl_debug_ktr_cpumask(SYSCTL_HANDLER_ARGS)
{
char lktr_cpumask_str[CPUSETBUFSIZ];
cpuset_t imask;
int error;
memset(lktr_cpumask_str, 0, sizeof(lktr_cpumask_str));
error = sysctl_handle_string(oidp, lktr_cpumask_str,
sizeof(lktr_cpumask_str), req);
if (error != 0 || req->newptr == NULL)
return (error);
if (cpusetobj_strscan(&imask, lktr_cpumask_str) == -1)
return (EINVAL);
CPU_COPY(&imask, &ktr_cpumask);
return (error);
}
SYSCTL_PROC(_debug_ktr, OID_AUTO, cpumask,
CTLFLAG_RW | CTLFLAG_MPSAFE | CTLTYPE_STRING, NULL, 0,
sysctl_debug_ktr_cpumask, "S",
"Bitmask of CPUs on which KTR logging is enabled");
volatile int ktr_idx = 0;
struct ktr_entry ktr_buf[KTR_ENTRIES];
@ -254,7 +213,7 @@ ktr_tracepoint(u_int mask, const char *file, int line, const char *format,
if ((ktr_mask & mask) == 0)
return;
cpu = KTR_CPU;
if (!CPU_ISSET(cpu, &ktr_cpumask))
if (((1 << cpu) & ktr_cpumask) == 0)
return;
#if defined(KTR_VERBOSE) || defined(KTR_ALQ)
td = curthread;

View File

@ -85,9 +85,7 @@ l2: add r2, 1, r3 ; \
lduw [PCPU(MID)], r1 ; \
mov 1, r2 ; \
sllx r2, r1, r1 ; \
#ifdef notyet \
TEST(ktr_cpumask, r1, r2, r3, l3) ; \
#endif \
ATR(desc, r1, r2, r3, l1, l2)
#endif /* LOCORE */

View File

@ -214,7 +214,6 @@ int cpuset_create_root(struct prison *, struct cpuset **);
int cpuset_setproc_update_set(struct proc *, struct cpuset *);
int cpusetobj_ffs(const cpuset_t *);
char *cpusetobj_strprint(char *, const cpuset_t *);
int cpusetobj_strscan(cpuset_t *, const char *);
#else
__BEGIN_DECLS

View File

@ -97,9 +97,6 @@
#ifndef LOCORE
#include <sys/param.h>
#include <sys/_cpuset.h>
struct ktr_entry {
u_int64_t ktr_timestamp;
int ktr_cpu;
@ -110,7 +107,7 @@ struct ktr_entry {
u_long ktr_parms[KTR_PARMS];
};
extern cpuset_t ktr_cpumask;
extern int ktr_cpumask;
extern int ktr_mask;
extern int ktr_entries;
extern int ktr_verbose;