From owner-svn-src-all@freebsd.org Wed Jul 1 14:10:00 2015 Return-Path: Delivered-To: svn-src-all@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 40F3799121D; Wed, 1 Jul 2015 14:10:00 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 1864B279D; Wed, 1 Jul 2015 14:10:00 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t61E9x0L046924; Wed, 1 Jul 2015 14:09:59 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t61E9xfX046922; Wed, 1 Jul 2015 14:09:59 GMT (envelope-from br@FreeBSD.org) Message-Id: <201507011409.t61E9xfX046922@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 1 Jul 2015 14:09:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285004 - head/sys/cddl/dev/fbt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2015 14:10:00 -0000 Author: br Date: Wed Jul 1 14:09:59 2015 New Revision: 285004 URL: https://svnweb.freebsd.org/changeset/base/285004 Log: Add a central location for exclusion checks. We check here if function is excluded from FBT instrumentation. Reviewed by: andrew, emaste, markj Differential Revision: https://reviews.freebsd.org/D2899 Modified: head/sys/cddl/dev/fbt/fbt.c head/sys/cddl/dev/fbt/fbt.h Modified: head/sys/cddl/dev/fbt/fbt.c ============================================================================== --- head/sys/cddl/dev/fbt/fbt.c Wed Jul 1 13:59:26 2015 (r285003) +++ head/sys/cddl/dev/fbt/fbt.c Wed Jul 1 14:09:59 2015 (r285004) @@ -111,6 +111,37 @@ static struct cdev *fbt_cdev; static int fbt_probetab_size; static int fbt_verbose = 0; +int +fbt_excluded(const char *name) +{ + + if (strncmp(name, "dtrace_", 7) == 0 && + strncmp(name, "dtrace_safe_", 12) != 0) { + /* + * Anything beginning with "dtrace_" may be called + * from probe context unless it explicitly indicates + * that it won't be called from probe context by + * using the prefix "dtrace_safe_". + */ + return (1); + } + + /* Exclude some internal functions */ + if (name[0] == '_' && name[1] == '_') + return (1); + + /* + * When DTrace is built into the kernel we need to exclude + * the FBT functions from instrumentation. + */ +#ifndef _KLD_MODULE + if (strncmp(name, "fbt_", 4) == 0) + return (1); +#endif + + return (0); +} + static void fbt_doubletrap(void) { Modified: head/sys/cddl/dev/fbt/fbt.h ============================================================================== --- head/sys/cddl/dev/fbt/fbt.h Wed Jul 1 13:59:26 2015 (r285003) +++ head/sys/cddl/dev/fbt/fbt.h Wed Jul 1 14:09:59 2015 (r285004) @@ -58,6 +58,7 @@ int fbt_invop(uintptr_t, uintptr_t *, ui void fbt_patch_tracepoint(fbt_probe_t *, fbt_patchval_t); int fbt_provide_module_function(struct linker_file *, int, struct linker_symval *, void *); +int fbt_excluded(const char *name); extern dtrace_provider_id_t fbt_id; extern fbt_probe_t **fbt_probetab;