[ltt-dev] [Ltt-dev] [PATCH] Remove ltt-armall/disarmall's unwanted error messages

Zhaolei zhaolei at cn.fujitsu.com
Wed Oct 15 05:18:45 EDT 2008


Hi,

when we run ltt-armall, install a module and run ltt-armall again, we
 will see following error message:
# ltt-armall
Connecting all markers
Connecting input_event
Connecting kernel_arch_ipc_call
...
# modprobe fs_trace
# ltt-armall
Connecting all markers
Connecting fs_buffer_wait_end
Connecting fs_buffer_wait_start
...
Connecting input_event
/usr/local/bin/ltt-armall.old: line 30: echo: write error: File exists
Connecting kernel_arch_ipc_call
/usr/local/bin/ltt-armall.old: line 30: echo: write error: File exists
Connecting kernel_arch_kthread_create
...
#

Same sort of thing happened when we run ltt-armall/ltt-disarmall twice.

It can be fixed by following patch. Applies on top of ltt-control-0.54-10102008.

Signed-off-by: Zhaolei <zhaolei at cn.fujitsu.com>
---
diff -Nur ltt-control-0.54-10102008.org/lttctl/ltt-armall.sh ltt-control-0.54-10102008/lttctl/ltt-armall.sh
--- ltt-control-0.54-10102008.org/lttctl/ltt-armall.sh	2008-10-15 15:29:54.000000000 +0800
+++ ltt-control-0.54-10102008/lttctl/ltt-armall.sh	2008-10-15 15:28:04.000000000 +0800
@@ -2,13 +2,31 @@
 #excluding locking markers (high traffic)
 
 echo Connecting all markers
-MARKERS=`cat /proc/ltt|grep -v %k|awk '{print $2}'|sort -u|grep -v ^core_|grep -v ^locking_|grep -v ^lockdep_`
+MARKERS=`cat /proc/ltt|grep -v %k|sort -u \
+	| grep -v "^marker: core_" \
+	| grep -v "^marker: locking_" \
+	| grep -v "^marker: lockdep_"`
+
+echo "$MARKERS" | while read mark_line
+do
+	if [ -z "$mark_line" ]
+	then
+		continue
+	fi
+
+	mark_name=$(eval "set $mark_line;echo \$2")
+	mark_status=$(eval "set $mark_line;echo \$6")
+
+	if [ "$mark_status" == "1" ]
+	then
+		echo "  $mark_name already connected"
+		continue
+	fi
 
-for a in $MARKERS; do
-	echo Connecting $a
+	echo "  Connecting $mark_name"
 
 	#redirect markers carrying state information to dedicated channels
-	case $a in
+	case $mark_name in
 	list_process_state|list_file_descriptor|user_generic_thread_brand|fs_exec|kernel_process_fork|kernel_process_free|kernel_process_exit|kernel_arch_kthread_create|list_statedump_end|list_vm_map)
 		CHANNEL=processes
 		;;
@@ -26,27 +44,42 @@
 		;;
 	esac
 
-	echo "connect $a default dynamic $CHANNEL" > /proc/ltt
-done
 
+	echo "connect $mark_name default dynamic $CHANNEL" > /proc/ltt
+done
 
 # Connect the interesting high-speed markers to the marker tap.
 # Markers starting with "tap_" are considered high-speed.
 echo Connecting high-rate markers to tap
-MARKERS=`cat /proc/ltt|grep -v %k|awk '{print $2}'|sort -u |grep ^tap_`
+MARKERS=`cat /proc/ltt|grep -v %k|sort -u |grep ^tap_`
 
 #Uncomment the following to also record lockdep events.
-#MARKERS=`cat /proc/ltt|grep -v %k|awk '{print $2}'|sort -u|grep -e ^tap_ -e ^lockdep`
+#MARKERS=`cat /proc/ltt|grep -v %k|sort -u|grep -e ^tap_ -e ^lockdep`
+
+echo "$MARKERS" | while read mark_line
+do
+	if [ -z "$mark_line" ]
+	then
+		continue
+	fi
+
+	mark_name=$(eval "set $mark_line;echo \$2")
+	mark_status=$(eval "set $mark_line;echo \$6")
+
+	if [ "$mark_status" == "1" ]
+	then
+		echo "  $mark_name already connected"
+		continue
+	fi
 
-for a in $MARKERS; do
-	echo Connecting $a
+	echo "  Connecting $mark_name"
 
 	#redirect markers carrying state information to dedicated channels
-	case $a in
+	case $mark_name in
 	*)
 		CHANNEL=
 		;;
 	esac
 
-	echo "connect $a ltt_tap_marker dynamic $CHANNEL" > /proc/ltt
+	echo "connect $mark_name ltt_tap_marker dynamic $CHANNEL" > /proc/ltt
 done
diff -Nur ltt-control-0.54-10102008.org/lttctl/ltt-disarmall.sh ltt-control-0.54-10102008/lttctl/ltt-disarmall.sh
--- ltt-control-0.54-10102008.org/lttctl/ltt-disarmall.sh	2008-10-15 15:29:54.000000000 +0800
+++ ltt-control-0.54-10102008/lttctl/ltt-disarmall.sh	2008-10-15 15:28:09.000000000 +0800
@@ -1,18 +1,57 @@
 #excluding locking
 #excluding core markers, not connected to default.
+
 echo Disconnecting all markers
-MARKERS=`cat /proc/ltt|grep -v %k|awk '{print $2}'|sort -u|grep -v ^core_|grep -v ^locking_|grep -v ^lockdep_|grep -v ^lockdep|grep -v ^tap_`
-for a in $MARKERS; do echo Disconnecting $a; echo "disconnect $a" > /proc/ltt; done
+MARKERS=`cat /proc/ltt|grep -v %k|sort -u \
+	| grep -v "^marker: core_" \
+	| grep -v "^marker: locking_" \
+	| grep -v "^marker: lockdep_" \
+	| grep -v "^marker: lockdep" \
+	| grep -v "^marker: tap_"`
+
+echo "$MARKERS" | while read mark_line
+do
+	if [ -z "$mark_line" ]
+	then
+		continue
+	fi
+
+	mark_name=$(eval "set $mark_line;echo \$2")
+	mark_status=$(eval "set $mark_line;echo \$6")
+
+	if [ "$mark_status" == "0" ]
+	then
+		echo "  $mark_name already disconnected"
+		continue
+	fi
+
+	echo "  Disconnecting $mark_name"
+	echo "disconnect $mark_name" > /proc/ltt
+done
 
 # Markers starting with "tap_" are considered high-speed.
 echo Disconnecting high-rate markers to tap
-MARKERS=`cat /proc/ltt|grep -v %k|awk '{print $2}'|sort -u |grep ^tap_`
+MARKERS=`cat /proc/ltt|grep -v %k|sort -u |grep ^tap_`
 
 #Uncomment the following to also stop recording lockdep events.
-#MARKERS=`cat /proc/ltt|grep -v %k|awk '{print $2}'|sort -u|grep -e ^tap_ -e ^lockdep`
+#MARKERS=`cat /proc/ltt|grep -v %k|sort -u|grep -e ^tap_ -e ^lockdep`
+
+echo "$MARKERS" | while read mark_line
+do
+	if [ -z "$mark_line" ]
+	then
+		continue
+	fi
+
+	mark_name=$(eval "set $mark_line;echo \$2")
+	mark_status=$(eval "set $mark_line;echo \$6")
 
-for a in $MARKERS; do
-	echo Disconnecting $a
+	if [ "$mark_status" == "0" ]
+	then
+		echo "  $mark_name already disconnected"
+		continue
+	fi
 
-	echo "disconnect $a ltt_tap_marker" > /proc/ltt
+	echo "  Disconnecting $mark_name"
+	echo "disconnect $mark_name ltt_tap_marker" > /proc/ltt
 done






More information about the lttng-dev mailing list