Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

OS-1545 dtrace_dof_maxsize is far too small

  • Loading branch information...
commit 90243ddad5368179c88a70d5d223a1348a797bd4 1 parent 055048e
Bryan Cantrill authored September 18, 2012
97  usr/src/cmd/dtrace/test/tst/common/misc/tst.dofmax.ksh
... ...
@@ -0,0 +1,97 @@
  1
+#
  2
+# CDDL HEADER START
  3
+#
  4
+# The contents of this file are subject to the terms of the
  5
+# Common Development and Distribution License (the "License").
  6
+# You may not use this file except in compliance with the License.
  7
+#
  8
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  9
+# or http://www.opensolaris.org/os/licensing.
  10
+# See the License for the specific language governing permissions
  11
+# and limitations under the License.
  12
+#
  13
+# When distributing Covered Code, include this CDDL HEADER in each
  14
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15
+# If applicable, add the following below this CDDL HEADER, with the
  16
+# fields enclosed by brackets "[]" replaced with your own identifying
  17
+# information: Portions Copyright [yyyy] [name of copyright owner]
  18
+#
  19
+# CDDL HEADER END
  20
+#
  21
+
  22
+#
  23
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
  24
+#
  25
+
  26
+let j=8
  27
+
  28
+enable()
  29
+{
  30
+	prog=/var/tmp/dtest.$$.d
  31
+	err=/var/tmp/dtest.$$.err
  32
+
  33
+	nawk -v nprobes=$1 'BEGIN { \
  34
+		for (i = 0; i < nprobes - 1; i++) { 		\
  35
+			printf("dtrace:::BEGIN,\n");		\
  36
+		}						\
  37
+								\
  38
+		printf("dtrace:::BEGIN { exit(0); }\n");	\
  39
+	}' /dev/null > $prog
  40
+
  41
+	dtrace -qs $prog > /dev/null 2> $err
  42
+
  43
+	if [[ "$?" -eq 0 ]]; then
  44
+		return 0
  45
+	else
  46
+		if ! grep "DIF program exceeds maximum program size" $err \
  47
+		    1> /dev/null 2>&1 ; then 
  48
+			echo "failed to enable $prog: `cat $err`"
  49
+			exit 1
  50
+		fi
  51
+
  52
+		return 1
  53
+	fi
  54
+}
  55
+
  56
+#
  57
+# First, establish an upper bound
  58
+#
  59
+let upper=1
  60
+
  61
+while enable $upper ; do
  62
+	let lower=upper
  63
+	let upper=upper+upper
  64
+	echo success at $lower, raised to $upper
  65
+done
  66
+
  67
+#
  68
+# Now search for the highest value that can be enabled
  69
+#
  70
+while [[ "$lower" -lt "$upper" ]]; do
  71
+	let guess=$(((lower + upper) / 2))
  72
+	echo "lower is $lower; upper is $upper; guess is $guess\c"
  73
+
  74
+	if enable $guess ; then
  75
+		if [[ $((upper - lower)) -le 2 ]]; then
  76
+			let upper=guess
  77
+		fi
  78
+
  79
+		echo " (success)"
  80
+		let lower=guess
  81
+	else
  82
+		echo " (failure)"
  83
+		let upper=guess
  84
+	fi
  85
+done
  86
+
  87
+let expected=10000
  88
+
  89
+if [[ "$lower" -lt "$expected" ]]; then
  90
+	echo "expected support for enablings of at least $expected probes; \c"
  91
+	echo "found $lower"
  92
+	exit 1
  93
+fi
  94
+
  95
+echo "maximum supported enabled probes found to be $lower"
  96
+exit 0
  97
+
2  usr/src/uts/common/dtrace/dtrace.c
@@ -116,7 +116,7 @@
116 116
 int		dtrace_destructive_disallow = 0;
117 117
 dtrace_optval_t	dtrace_nonroot_maxsize = (16 * 1024 * 1024);
118 118
 size_t		dtrace_difo_maxsize = (256 * 1024);
119  
-dtrace_optval_t	dtrace_dof_maxsize = (256 * 1024);
  119
+dtrace_optval_t	dtrace_dof_maxsize = (8 * 1024 * 1024);
120 120
 size_t		dtrace_global_maxsize = (16 * 1024);
121 121
 size_t		dtrace_actions_max = (16 * 1024);
122 122
 size_t		dtrace_retain_max = 1024;

1 note on commit 90243dd

Pedro Palazón Candel
Owner

Thanks!

Please sign in to comment.
Something went wrong with that request. Please try again.