From owner-svn-src-stable-10@freebsd.org Fri Jan 8 03:45:29 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA4BEA67B11; Fri, 8 Jan 2016 03:45:29 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A698C14DD; Fri, 8 Jan 2016 03:45:29 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u083jSRA070676; Fri, 8 Jan 2016 03:45:28 GMT (envelope-from stas@FreeBSD.org) Received: (from stas@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u083jSIs070675; Fri, 8 Jan 2016 03:45:28 GMT (envelope-from stas@FreeBSD.org) Message-Id: <201601080345.u083jSIs070675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stas set sender to stas@FreeBSD.org using -f From: Stanislav Sedov Date: Fri, 8 Jan 2016 03:45:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293413 - stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2016 03:45:30 -0000 Author: stas Date: Fri Jan 8 03:45:28 2016 New Revision: 293413 URL: https://svnweb.freebsd.org/changeset/base/293413 Log: MFC r291545: make the number of fasttrap probes and the size of the trace points hash table tunable via sysctl or kernel tunables. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Fri Jan 8 03:02:19 2016 (r293412) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Fri Jan 8 03:45:28 2016 (r293413) @@ -63,6 +63,8 @@ #if !defined(sun) #include #include +#include +#include #include #include #include @@ -172,13 +174,14 @@ static volatile uint64_t fasttrap_mod_ge /* * 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 +229,17 @@ static kmutex_t fasttrap_cpuc_pid_lock[M 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) { @@ -2466,8 +2480,6 @@ fasttrap_load(void) #if defined(sun) 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; @@ -2478,12 +2490,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