[DTrace-devel] [PATCH 06/16] cpc: Put in a temporary safeguard against some mystery bug

eugene.loh at oracle.com eugene.loh at oracle.com
Fri Jan 27 02:23:19 UTC 2023


From: Eugene Loh <eugene.loh at oracle.com>

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 test/unittest/cpc/tst.branches.x     |  3 ++-
 test/unittest/cpc/tst.instructions.x |  3 ++-
 test/utils/cpc_get_events.sh         | 14 +++++++++-----
 test/utils/cpc_temp_skip_bug.sh      | 25 +++++++++++++++++++++++++
 4 files changed, 38 insertions(+), 7 deletions(-)
 create mode 100755 test/utils/cpc_temp_skip_bug.sh

diff --git a/test/unittest/cpc/tst.branches.x b/test/unittest/cpc/tst.branches.x
index a8e07af1..4b235055 100755
--- a/test/unittest/cpc/tst.branches.x
+++ b/test/unittest/cpc/tst.branches.x
@@ -10,4 +10,5 @@ if ! perf list hw | grep -qw branches; then
 	exit 2
 fi
 
-exit 0
+test/utils/cpc_temp_skip_bug.sh
+exit $?
diff --git a/test/unittest/cpc/tst.instructions.x b/test/unittest/cpc/tst.instructions.x
index d47b7d99..c3a2ede3 100755
--- a/test/unittest/cpc/tst.instructions.x
+++ b/test/unittest/cpc/tst.instructions.x
@@ -10,4 +10,5 @@ if ! perf list hw | grep -qw instructions; then
 	exit 2
 fi
 
-exit 0
+test/utils/cpc_temp_skip_bug.sh
+exit $?
diff --git a/test/utils/cpc_get_events.sh b/test/utils/cpc_get_events.sh
index 4303c826..80d3584b 100755
--- a/test/utils/cpc_get_events.sh
+++ b/test/utils/cpc_get_events.sh
@@ -9,10 +9,14 @@
 # Use at least cpu-clock but also try "perf list" for some others.
 
 eventnamelist="cpu-clock"
-for eventname in branches instructions; do
-	if perf list hw | grep -qw $eventname; then
-		eventnamelist="$eventnamelist $eventname"
-	fi
-done
+
+$(dirname $0)/cpc_temp_skip_bug.sh > /dev/null
+if [ $? -eq 0 ]; then
+	for eventname in branches instructions; do
+		if perf list hw | grep -qw $eventname; then
+			eventnamelist="$eventnamelist $eventname"
+		fi
+	done
+fi
 
 echo $eventnamelist
diff --git a/test/utils/cpc_temp_skip_bug.sh b/test/utils/cpc_temp_skip_bug.sh
new file mode 100755
index 00000000..2e63bb52
--- /dev/null
+++ b/test/utils/cpc_temp_skip_bug.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+# Licensed under the Universal Permissive License v 1.0 as shown at
+# http://oss.oracle.com/licenses/upl.
+
+# Temporarily skip due to some bug we do not yet understand.  It seems cpc
+# probes fire only once per process on x86/UEKR6 when using hardware counters.
+
+if [[ `uname -m` != "x86_64" ]]; then
+        exit 0
+fi
+
+read MAJOR MINOR <<< `uname -r | grep -Eo '^[0-9]+\.[0-9]+' | tr '.' ' '`
+
+if [ $MAJOR -gt 5 ]; then
+        exit 0
+fi
+if [ $MAJOR -eq 5 -a $MINOR -ge 15 ]; then
+        exit 0
+fi
+
+echo mystery bug with hardware counters on x86 and UEKR6
+exit 2
-- 
2.18.4




More information about the DTrace-devel mailing list