Skip to contentSkip to conversation

try two methods to disable set_ftrace_pid

PATCH In review Han Pingtian 2 participants 5 messages Feb 22, 2011 – Feb 23, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 try two methods to disable set_ftrace_pid

On older kernel, we should use "echo -1 > ..." to disable set_ftrace_pid, but on the latest kernel we must use "echo > ..." to disable it. So we have to try both methods for disabling it in ftrace stress test.

---
 .../ftrace_stress/ftrace_set_ftrace_pid.sh         |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_ftrace_pid.sh +7 -1
index 541215c..2ab6cf2 100755
@@ -36,7 +36,13 @@ for ((; ; ))
 			eval echo $str >> "$TRACING_PATH"/set_ftrace_pid
 		}
 
-		echo > "$TRACING_PATH"/set_ftrace_pid
+		if ! echo > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1; then
+			echo -1 > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1 
+
+			if [ $? -ne 0 ]; then
+				tst_resm TBROK "Cannot disable set_ftrace_pid!"
+			fi
+		fi
 	}
 
 	sleep 1
Signature · 12 lines
1.7.1

------------------------------------------------------------------------------
Index, Search & Analyze Logs and other IT data in Real-Time with Splunk 
Collect, index and harness all the fast moving IT data generated by your 
applications, servers and devices whether physical, virtual or in the cloud.
Deliver compliance at lower cost and gain new business insights. 
Free Software Download: http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 15 lines · Han Pingtian

On older kernel, we should use "echo -1 > ..." to disable set_ftrace_pid, but on the latest kernel we must use "echo > ..." to disable it. So we have to try both methods for disabling it in ftrace stress test.

---
.../ftrace_stress/ftrace_set_ftrace_pid.sh | 8 +++++++-

1 files changed, 7 insertions(+), 1 deletions(-)
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_ftrace_pid.sh +0 -0
index 541215c..2ab6cf2 100755

testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_ftrace_pid.sh for ((; ; )) · line 43

Quoted 9 lines
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_ftrace_pid.sh +5 -1
@@ -36,7 +36,13 @@ for ((; ; ))
 			eval echo $str >> "$TRACING_PATH"/set_ftrace_pid
 		}
 
-		echo > "$TRACING_PATH"/set_ftrace_pid
+		if ! echo > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1; then
+			echo -1 > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1 
+
+			if [ $? -ne 0 ]; then
+				tst_resm TBROK "Cannot disable set_ftrace_pid!"

Unlike the C APIs, this will never exit. Yes, I realize this is dumb.
Thanks,
-Garrett
------------------------------------------------------------------------------
Index, Search & Analyze Logs and other IT data in Real-Time with Splunk Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. Free Software Download: http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
Quoted 20 lines · Garrett Cooper
Quoted 18 lines · Han Pingtian

On older kernel, we should use "echo -1 > ..." to disable set_ftrace_pid, but on the latest kernel we must use "echo > ..." to disable it. So we have to try both methods for disabling it in ftrace stress test.

---
.../ftrace_stress/ftrace_set_ftrace_pid.sh | 8 +++++++-

1 files changed, 7 insertions(+), 1 deletions(-)
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_ftrace_pid.sh +0 -0
index 541215c..2ab6cf2 100755
@@ -36,7 +36,13 @@ for ((; ; ))
 			eval echo $str >> "$TRACING_PATH"/set_ftrace_pid
 		}
 
Quoted 10 lines

testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_ftrace_pid.sh for ((; ; )) · line 43

Quoted 6 lines
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_ftrace_pid.sh +5 -1
-		echo > "$TRACING_PATH"/set_ftrace_pid
+		if ! echo > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1; then
+			echo -1 > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1 
+
+			if [ $? -ne 0 ]; then
+				tst_resm TBROK "Cannot disable set_ftrace_pid!"

Unlike the C APIs, this will never exit. Yes, I realize this is dumb.
Thanks,
-Garrett

I have updated the patch, please have a review. Thanks.

Signature · 5 lines
Han Pingtian
Quality Engineer
hpt @ #kernel-qe
Red Hat, Inc
Freedom ... courage ... Commitment ... ACCOUNTABILITY

From 7db898dbc4b57e20bca4fc5d2f736eef81b21c85 Mon Sep 17 00:00:00 2001
From: Han Pingtian <[email protected]>
Date: Tue, 22 Feb 2011 14:22:52 +0800
Subject: [PATCH] try two methods to disable set_ftrace_pid

On older kernel, we should use "echo -1 > ..." to disable set_ftrace_pid, but on the latest kernel we must use "echo > ..." to disable it. So we have to try both methods for disabling it in ftrace stress test.

And if we failed to disable the set_ftrace_pid, will try to report test failure to the user.

---
 .../ftrace_stress/ftrace_set_ftrace_pid.sh         |    7 +++-
 .../ftrace_stress_test/ftrace_stress_test.sh       |   40 +++++++++++--------
 2 files changed, 29 insertions(+), 18 deletions(-)
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_ftrace_pid.sh +6 -1
index 541215c..7bc76d9 100755
@@ -36,7 +36,12 @@ for ((; ; ))
 			eval echo $str >> "$TRACING_PATH"/set_ftrace_pid
 		}
 
-		echo > "$TRACING_PATH"/set_ftrace_pid
+		if ! echo > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1; then
+			if ! echo -1 > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1; then
+				tst_resm TBROK "Cannot disable set_ftrace_pid!"
+				exit 1
+			fi
+		fi
 	}
 
 	sleep 1
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress_test.sh +23 -17
index 874268e..b4b115a 100755
@@ -34,6 +34,7 @@ export TRACING_PATH="$PWD/debugfs/tracing"
 export SPATH="$TPATH/ftrace_stress"
 
 test_interval=$1
+test_success=true
 
 save_old_setting()
 {
@@ -100,22 +101,22 @@ restore_old_setting()
 
 clean_up()
 {
-	kill -KILL $pid1
-	kill -KILL $pid2
-	kill -KILL $pid3
-	kill -KILL $pid4
-	kill -KILL $pid5
-	kill -KILL $pid6
-	kill -KILL $pid7
-	kill -KILL $pid8
-	kill -KILL $pid9
-	kill -KILL $pid10
-	kill -KILL $pid11
-	kill -USR1 $pid12
-	kill -KILL $pid13
-	kill -KILL $pid14
-	kill -KILL $pid15
-	kill -KILL $pid16
+	kill -KILL $pid1 || test_success=false
+	kill -KILL $pid2 || test_success=false
+	kill -KILL $pid3 || test_success=false
+	kill -KILL $pid4 || test_success=false
+	kill -KILL $pid5 || test_success=false
+	kill -KILL $pid6 || test_success=false
+	kill -KILL $pid7 || test_success=false
+	kill -KILL $pid8 || test_success=false
+	kill -KILL $pid9 || test_success=false
+	kill -KILL $pid10 || test_success=false
+	kill -KILL $pid11 || test_success=false
+	kill -USR1 $pid12 || test_success=false
+	kill -KILL $pid13 || test_success=false
+	kill -KILL $pid14 || test_success=false
+	kill -KILL $pid15 || test_success=false
+	kill -KILL $pid16 || test_success=false
 
 	sleep 2
 	restore_old_setting
@@ -233,5 +234,10 @@ clean_up
 
 echo "Ftrace Stress Test End"
 
-tst_resm TPASS "finished running the test. Run dmesg to double-check for bugs"
+if $test_success; then
+	tst_resm TPASS "finished running the test. Run dmesg to double-check for bugs"
+else
+	tst_resm TFAIL "please check log message."
+	exit 1
+fi
 
Signature · 1 line
1.7.1

------------------------------------------------------------------------------
Index, Search & Analyze Logs and other IT data in Real-Time with Splunk Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. Free Software Download: http://p.sf.net/sfu/splunk-dev2dev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
Quoted 7 lines · Han Pingtian
Quoted 6 lines · Garrett Cooper
Quoted 4 lines · Han Pingtian

On older kernel, we should use "echo -1 > ..." to disable set_ftrace_pid, but on the latest kernel we must use "echo > ..." to disable it. So we have to try both methods for disabling it in ftrace stress test.

Committed -- thanks!
-Garrett

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#4 lore raw
Quoted 11 lines · Garrett Cooper
Quoted 7 lines · Han Pingtian
Quoted 6 lines · Garrett Cooper
Quoted 4 lines · Han Pingtian

On older kernel, we should use "echo -1 > ..." to disable set_ftrace_pid, but on the latest kernel we must use "echo > ..." to disable it. So we have to try both methods for disabling it in ftrace stress test.

Committed -- thanks!
-Garrett

Thanks so much!

Signature · 16 lines
Han Pingtian
Quality Engineer
hpt @ #kernel-qe
Red Hat, Inc
Freedom ... courage ... Commitment ... ACCOUNTABILITY

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list