aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorStanislav Sedov <stas@FreeBSD.org>2015-12-01 00:24:54 +0000
committerStanislav Sedov <stas@FreeBSD.org>2015-12-01 00:24:54 +0000
commit314eeef29042a1bdbe1d9365eeba2649db63f662 (patch)
treecabe91fd15bce1860f34f30f23768b65ef9cca63 /sys
parent10b2e06e3ecb547f0ed75cac9eadde69eed7de47 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
index df485670abdd..348222c79c16 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
@@ -63,6 +63,7 @@
#ifndef illumos
#include <sys/dtrace_bsd.h>
#include <sys/eventhandler.h>
+#include <sys/sysctl.h>
#include <sys/u8_textprep.h>
#include <sys/user.h>
#include <vm/vm.h>
@@ -172,13 +173,14 @@ static volatile uint64_t fasttrap_mod_gen;
/*
* When the fasttrap provider is loaded, fasttrap_max is set to either
- * FASTTRAP_MAX_DEFAULT or the value for fasttrap-max-probes in the
- * fasttrap.conf file. Each time a probe is created, fasttrap_total is
- * incremented by the number of tracepoints that may be associated with that
- * probe; fasttrap_total is capped at fasttrap_max.
+ * FASTTRAP_MAX_DEFAULT, or the value for fasttrap-max-probes in the
+ * fasttrap.conf file (Illumos), or the value provied in the loader.conf (FreeBSD).
+ * Each time a probe is created, fasttrap_total is incremented by the number
+ * of tracepoints that may be associated with that probe; fasttrap_total is capped
+ * at fasttrap_max.
*/
#define FASTTRAP_MAX_DEFAULT 250000
-static uint32_t fasttrap_max;
+static uint32_t fasttrap_max = FASTTRAP_MAX_DEFAULT;
static uint32_t fasttrap_total;
/*
@@ -226,6 +228,17 @@ static kmutex_t fasttrap_cpuc_pid_lock[MAXCPU];
static eventhandler_tag fasttrap_thread_dtor_tag;
#endif
+static unsigned long tpoints_hash_size = FASTTRAP_TPOINTS_DEFAULT_SIZE;
+
+#ifdef __FreeBSD__
+SYSCTL_DECL(_kern_dtrace);
+SYSCTL_NODE(_kern_dtrace, OID_AUTO, fasttrap, CTLFLAG_RD, 0, "DTrace fasttrap parameters");
+SYSCTL_UINT(_kern_dtrace_fasttrap, OID_AUTO, max_probes, CTLFLAG_RWTUN, &fasttrap_max,
+ FASTTRAP_MAX_DEFAULT, "Maximum number of fasttrap probes");
+SYSCTL_ULONG(_kern_dtrace_fasttrap, OID_AUTO, tpoints_hash_size, CTLFLAG_RDTUN, &tpoints_hash_size,
+ FASTTRAP_TPOINTS_DEFAULT_SIZE, "Size of the tracepoint hash table");
+#endif
+
static int
fasttrap_highbit(ulong_t i)
{
@@ -2480,8 +2493,6 @@ fasttrap_load(void)
#ifdef illumos
fasttrap_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
"fasttrap-max-probes", FASTTRAP_MAX_DEFAULT);
-#else
- fasttrap_max = FASTTRAP_MAX_DEFAULT;
#endif
fasttrap_total = 0;
@@ -2492,12 +2503,14 @@ fasttrap_load(void)
nent = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
"fasttrap-hash-size", FASTTRAP_TPOINTS_DEFAULT_SIZE);
#else
- nent = FASTTRAP_TPOINTS_DEFAULT_SIZE;
+ nent = tpoints_hash_size;
#endif
if (nent == 0 || nent > 0x1000000)
nent = FASTTRAP_TPOINTS_DEFAULT_SIZE;
+ tpoints_hash_size = nent;
+
if (ISP2(nent))
fasttrap_tpoints.fth_nent = nent;
else