Skip to contentSkip to conversation

tests: add more checks for finding the debugfs in script based tests

PATCH In review Jani Nikula 3 participants 13 messages Oct 13, 2016 – Oct 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 tests: add more checks for finding the debugfs in script based tests

While at it, make debugfs_path point at the debugfs root, not dri. This'll be handy in future work.

---
 tests/drm_lib.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
tests/drm_lib.sh +10 -6
index 113da4c7d645..87e3ad0ab547 100755
@@ -41,18 +41,22 @@ do_or_die() {
 	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
 }
 
-if [ -d /debug/dri ] ; then
-	debugfs_path=/debug/dri
+if [ -d /sys/kernel/debug ]; then
+	debugfs_path=/sys/kernel/debug
+elif [ -d /debug ]; then
+	debugfs_path=/debug
+else
+	skip "debugfs not found"
 fi
 
-if [ -d /sys/kernel/debug/dri ] ; then
-	debugfs_path=/sys/kernel/debug/dri
+if [ ! -d $debugfs_path/dri ]; then
+	skip "dri debugfs not found"
 fi
 
 i915_dfs_path=x
 for minor in `seq 0 16`; do
-	if [ -f $debugfs_path/$minor/i915_error_state ] ; then
-		i915_dfs_path=$debugfs_path/$minor
+	if [ -f $debugfs_path/dri/$minor/i915_error_state ] ; then
+		i915_dfs_path=$debugfs_path/dri/$minor
 		break
 	fi
 done
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/3 tests: add facility to enable/disable hda dynamic debug in script based tests

Test scripts can call hda_dynamic_debug_enable and hda_dynamic_debug_disable to enable/disable snd_hda_intel and snd_hda_core debug messages. The dynamic debug will be disabled automatically at test end by the exit handler.

---
 tests/drm_lib.sh | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
tests/drm_lib.sh +22 -0
index 87e3ad0ab547..8738827fc218 100755
@@ -5,6 +5,22 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
 
 NAME=$(basename "$0")
 
+dynamic_debug=
+
+hda_dynamic_debug_enable() {
+	if [ -e "$dynamic_debug" ]; then
+		echo -n "module snd_hda_intel +pf" > $dynamic_debug
+		echo -n "module snd_hda_core +pf" > $dynamic_debug
+	fi
+}
+
+hda_dynamic_debug_disable() {
+	if [ -e "$dynamic_debug" ]; then
+		echo -n "module snd_hda_core =_" > $dynamic_debug
+		echo -n "module snd_hda_intel =_" > $dynamic_debug
+	fi
+}
+
 KERN_EMER="<0>"
 KERN_ALERT="<1>"
 KERN_CRIT="<2>"
@@ -20,6 +36,7 @@ kmsg() {
 
 finish() {
 	exitcode=$?
+	hda_dynamic_debug_disable
 	kmsg "$KERN_INFO$NAME: exiting, ret=$exitcode"
 	exit $exitcode
 }
@@ -49,6 +66,11 @@ else
 	skip "debugfs not found"
 fi
 
+dynamic_debug=$debugfs_path/dynamic_debug/control
+if [ ! -e "$dynamic_debug" ]; then
+	echo "WARNING: dynamic debug control not available"
+fi
+
 if [ ! -d $debugfs_path/dri ]; then
 	skip "dri debugfs not found"
 fi
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 3/3 tests: enable hda dynamic debug for module reload test

In reply to Jani Nikula

Hopefully, this will provide more clues for figuring out why snd_hda_intel unload fails sporadically.

---
 tests/drv_module_reload_basic | 2 ++
 1 file changed, 2 insertions(+)
tests/drv_module_reload_basic +2 -0
index 93cf7c005638..a8d628dd96bd 100755
@@ -81,6 +81,8 @@ function finish_load() {
 	return $IGT_EXIT_SUCCESS
 }
 
+hda_dynamic_debug_enable
+
 reload || exit $?
 finish_load || exit $?
 
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
In reply to Jani Nikula
Quoted 28 lines · Jani Nikula

While at it, make debugfs_path point at the debugfs root, not dri. This'll be handy in future work.

---
 tests/drm_lib.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
tests/drm_lib.sh +6 -4
index 113da4c7d645..87e3ad0ab547 100755
@@ -41,18 +41,22 @@ do_or_die() {
 	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
 }
 
-if [ -d /debug/dri ] ; then
-	debugfs_path=/debug/dri
+if [ -d /sys/kernel/debug ]; then
+	debugfs_path=/sys/kernel/debug
+elif [ -d /debug ]; then
+	debugfs_path=/debug
+else
+	skip "debugfs not found"
 fi
 
-if [ -d /sys/kernel/debug/dri ] ; then
-	debugfs_path=/sys/kernel/debug/dri

tests/drm_lib.sh do_or_die() { · line 59

Quoted 10 lines
tests/drm_lib.sh +4 -2
+if [ ! -d $debugfs_path/dri ]; then
+	skip "dri debugfs not found"
 fi
 
 i915_dfs_path=x
 for minor in `seq 0 16`; do
-	if [ -f $debugfs_path/$minor/i915_error_state ] ; then
-		i915_dfs_path=$debugfs_path/$minor
+	if [ -f $debugfs_path/dri/$minor/i915_error_state ] ; then
+		i915_dfs_path=$debugfs_path/dri/$minor

Thinking of how to wean ourselves off i915_error_state; how about

if [ grep -s i915 $debugfs_path/dri/$minor/name ]; then

?
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 33 lines · Chris Wilson
Quoted 32 lines · Jani Nikula

While at it, make debugfs_path point at the debugfs root, not dri. This'll be handy in future work.

---
 tests/drm_lib.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
tests/drm_lib.sh +8 -4
index 113da4c7d645..87e3ad0ab547 100755
@@ -41,18 +41,22 @@ do_or_die() {
 	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
 }
 
-if [ -d /debug/dri ] ; then
-	debugfs_path=/debug/dri
+if [ -d /sys/kernel/debug ]; then
+	debugfs_path=/sys/kernel/debug
+elif [ -d /debug ]; then
+	debugfs_path=/debug
+else
+	skip "debugfs not found"
 fi
 
-if [ -d /sys/kernel/debug/dri ] ; then
-	debugfs_path=/sys/kernel/debug/dri
+if [ ! -d $debugfs_path/dri ]; then
+	skip "dri debugfs not found"
 fi
 
Quoted 8 lines

tests/drm_lib.sh do_or_die() { · line 59

Quoted 6 lines
tests/drm_lib.sh +2 -2
 i915_dfs_path=x
 for minor in `seq 0 16`; do
-	if [ -f $debugfs_path/$minor/i915_error_state ] ; then
-		i915_dfs_path=$debugfs_path/$minor
+	if [ -f $debugfs_path/dri/$minor/i915_error_state ] ; then
+		i915_dfs_path=$debugfs_path/dri/$minor

Thinking of how to wean ourselves off i915_error_state; how about

That's of course independent of this series.

Quoted 1 line

if [ grep -s i915 $debugfs_path/dri/$minor/name ]; then

For whatever reason, I got a machine here where that file is empty (not talking about the size, but cating the file actually produces nothing). And I've got another machine where that is not the case. *scratches head*.

BR,
Jani.

Quoted 3 lines

?
-Chris

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 6 lines · Jani Nikula
Quoted 4 lines · Chris Wilson

tests/drm_lib.sh do_or_die() { · line 59

Quoted 2 lines
tests/drm_lib.sh +2 -0
+	if [ -f $debugfs_path/dri/$minor/i915_error_state ] ; then
+		i915_dfs_path=$debugfs_path/dri/$minor

Thinking of how to wean ourselves off i915_error_state; how about

Quoted 8 lines

That's of course independent of this series.

Quoted 1 line

if [ grep -s i915 $debugfs_path/dri/$minor/name ]; then

For whatever reason, I got a machine here where that file is empty (not talking about the size, but cating the file actually produces nothing). And I've got another machine where that is not the case. *scratches head*.

Is the first i915.ko builtin?
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
In reply to Jani Nikula
Quoted 4 lines · Jani Nikula

For whatever reason, I got a machine here where that file is empty (not talking about the size, but cating the file actually produces nothing). And I've got another machine where that is not the case. *scratches head*.

Appears to be Daniel's regression:

commit 95c081c17f284de50eaca60d4d55643a64d39019

Author: Daniel Vetter <[email protected]>
Date:   Tue Jun 21 10:54:12 2016 +0200

drm: Move master pointer from drm_minor to drm_device

Too bad my name's on it as well. :|
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
Quoted 6 lines · Chris Wilson
Quoted 4 lines · Jani Nikula

For whatever reason, I got a machine here where that file is empty (not talking about the size, but cating the file actually produces nothing). And I've got another machine where that is not the case. *scratches head*.

Quoted 7 lines

Appears to be Daniel's regression:

commit 95c081c17f284de50eaca60d4d55643a64d39019

Author: Daniel Vetter <[email protected]>
Date:   Tue Jun 21 10:54:12 2016 +0200

drm: Move master pointer from drm_minor to drm_device

Ah, I guess I was just running an old kernel on the machine where it still worked.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
In reply to Jani Nikula
Quoted 15 lines · Jani Nikula

While at it, make debugfs_path point at the debugfs root, not dri. This'll be handy in future work.

---
 tests/drm_lib.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
tests/drm_lib.sh +0 -0
index 113da4c7d645..87e3ad0ab547 100755
@@ -41,18 +41,22 @@ do_or_die() {
 	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
 }

tests/drm_lib.sh do_or_die() { · line 50

Quoted 10 lines
tests/drm_lib.sh +6 -2
 
-if [ -d /debug/dri ] ; then
-	debugfs_path=/debug/dri
+if [ -d /sys/kernel/debug ]; then
+	debugfs_path=/sys/kernel/debug
+elif [ -d /debug ]; then
+	debugfs_path=/debug
+else
+	skip "debugfs not found"
 fi

Would parsing the output of mount -t debugfs be an option?

--
Petri Latvala

Quoted 23 lines
tests/drm_lib.sh +4 -4
-if [ -d /sys/kernel/debug/dri ] ; then
-	debugfs_path=/sys/kernel/debug/dri
+if [ ! -d $debugfs_path/dri ]; then
+	skip "dri debugfs not found"
 fi
 
 i915_dfs_path=x
 for minor in `seq 0 16`; do
-	if [ -f $debugfs_path/$minor/i915_error_state ] ; then
-		i915_dfs_path=$debugfs_path/$minor
+	if [ -f $debugfs_path/dri/$minor/i915_error_state ] ; then
+		i915_dfs_path=$debugfs_path/dri/$minor
 		break
 	fi
 done
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw
Quoted 17 lines · Petri Latvala
Quoted 16 lines · Jani Nikula

While at it, make debugfs_path point at the debugfs root, not dri. This'll be handy in future work.

---
 tests/drm_lib.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
tests/drm_lib.sh +0 -0
index 113da4c7d645..87e3ad0ab547 100755
@@ -41,18 +41,22 @@ do_or_die() {
 	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
 }
 
Quoted 11 lines

tests/drm_lib.sh do_or_die() { · line 50

Quoted 9 lines
tests/drm_lib.sh +6 -2
-if [ -d /debug/dri ] ; then
-	debugfs_path=/debug/dri
+if [ -d /sys/kernel/debug ]; then
+	debugfs_path=/sys/kernel/debug
+elif [ -d /debug ]; then
+	debugfs_path=/debug
+else
+	skip "debugfs not found"
 fi

Would parsing the output of mount -t debugfs be an option?

I contemplated that, but decided that should be a separate change later on. I can send a patch on top if you like.

BR,
Jani.

Quoted 30 lines

--
Petri Latvala

Quoted 23 lines
tests/drm_lib.sh +4 -4
-if [ -d /sys/kernel/debug/dri ] ; then
-	debugfs_path=/sys/kernel/debug/dri
+if [ ! -d $debugfs_path/dri ]; then
+	skip "dri debugfs not found"
 fi
 
 i915_dfs_path=x
 for minor in `seq 0 16`; do
-	if [ -f $debugfs_path/$minor/i915_error_state ] ; then
-		i915_dfs_path=$debugfs_path/$minor
+	if [ -f $debugfs_path/dri/$minor/i915_error_state ] ; then
+		i915_dfs_path=$debugfs_path/dri/$minor
 		break
 	fi
 done
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw
Quoted 30 lines · Jani Nikula
Quoted 17 lines · Petri Latvala
Quoted 16 lines · Jani Nikula

While at it, make debugfs_path point at the debugfs root, not dri. This'll be handy in future work.

---
 tests/drm_lib.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
tests/drm_lib.sh +0 -0
index 113da4c7d645..87e3ad0ab547 100755
@@ -41,18 +41,22 @@ do_or_die() {
 	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
 }
 
Quoted 11 lines

tests/drm_lib.sh do_or_die() { · line 50

Quoted 9 lines
tests/drm_lib.sh +6 -2
-if [ -d /debug/dri ] ; then
-	debugfs_path=/debug/dri
+if [ -d /sys/kernel/debug ]; then
+	debugfs_path=/sys/kernel/debug
+elif [ -d /debug ]; then
+	debugfs_path=/debug
+else
+	skip "debugfs not found"
 fi

Would parsing the output of mount -t debugfs be an option?

Quoted 2 lines

I contemplated that, but decided that should be a separate change later on. I can send a patch on top if you like.

Something like this (untested):

tests/drm_lib.sh +9 -9
index af104ad791b7..6db604e22abf 100755
@@ -58,11 +58,15 @@ do_or_die() {
 	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
 }
 
-if [ -d /sys/kernel/debug ]; then
-	debugfs_path=/sys/kernel/debug
-elif [ -d /debug ]; then
-	debugfs_path=/debug
-else
+debugfs_path=
+for path in $(mount -t debugfs | cut -d " " -f 3) /sys/kernel/debug /debug; do
+	if [ -d "$path" -a -d "$path/dri" ]; then
+		debugfs_path=$path
+		break
+	fi
+done
+
+if [ -z "$debugfs_path" ]; then
 	skip "debugfs not found"
 fi
 
@@ -71,10 +75,6 @@ if [ ! -e "$dynamic_debug" ]; then
 	echo "WARNING: dynamic debug control not available"
 fi
 
-if [ ! -d $debugfs_path/dri ]; then
-	skip "dri debugfs not found"
-fi
-
 i915_dfs_path=x
 for minor in `seq 0 16`; do
 	if [ -f $debugfs_path/dri/$minor/i915_error_state ] ; then
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by
#11 lore raw
In reply to Jani Nikula
Quoted 30 lines · Jani Nikula
Quoted 17 lines · Petri Latvala
Quoted 16 lines · Jani Nikula

While at it, make debugfs_path point at the debugfs root, not dri. This'll be handy in future work.

---
 tests/drm_lib.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
tests/drm_lib.sh +0 -0
index 113da4c7d645..87e3ad0ab547 100755
@@ -41,18 +41,22 @@ do_or_die() {
 	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
 }
 
Quoted 11 lines

tests/drm_lib.sh do_or_die() { · line 50

Quoted 9 lines
tests/drm_lib.sh +6 -2
-if [ -d /debug/dri ] ; then
-	debugfs_path=/debug/dri
+if [ -d /sys/kernel/debug ]; then
+	debugfs_path=/sys/kernel/debug
+elif [ -d /debug ]; then
+	debugfs_path=/debug
+else
+	skip "debugfs not found"
 fi

Would parsing the output of mount -t debugfs be an option?

Quoted 2 lines

I contemplated that, but decided that should be a separate change later on. I can send a patch on top if you like.

Yes, separate patch, but no hurry on that one. Another patch for making the same change in tools/intel_gpu_abrt would also be nice.

The series is

Quoted 30 lines

BR,
Jani.

Quoted 26 lines

--
Petri Latvala

Quoted 19 lines
tests/drm_lib.sh +4 -4
-if [ -d /sys/kernel/debug/dri ] ; then
-	debugfs_path=/sys/kernel/debug/dri
+if [ ! -d $debugfs_path/dri ]; then
+	skip "dri debugfs not found"
 fi
 
 i915_dfs_path=x
 for minor in `seq 0 16`; do
-	if [ -f $debugfs_path/$minor/i915_error_state ] ; then
-		i915_dfs_path=$debugfs_path/$minor
+	if [ -f $debugfs_path/dri/$minor/i915_error_state ] ; then
+		i915_dfs_path=$debugfs_path/dri/$minor
 		break
 	fi
 done
Signature · 1 line
2.1.4
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw
Quoted 35 lines · Petri Latvala
Quoted 30 lines · Jani Nikula
Quoted 17 lines · Petri Latvala
Quoted 16 lines · Jani Nikula

While at it, make debugfs_path point at the debugfs root, not dri. This'll be handy in future work.

---
 tests/drm_lib.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
tests/drm_lib.sh +0 -0
index 113da4c7d645..87e3ad0ab547 100755
@@ -41,18 +41,22 @@ do_or_die() {
 	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
 }
 
Quoted 11 lines

tests/drm_lib.sh do_or_die() { · line 50

Quoted 9 lines
tests/drm_lib.sh +6 -2
-if [ -d /debug/dri ] ; then
-	debugfs_path=/debug/dri
+if [ -d /sys/kernel/debug ]; then
+	debugfs_path=/sys/kernel/debug
+elif [ -d /debug ]; then
+	debugfs_path=/debug
+else
+	skip "debugfs not found"
 fi

Would parsing the output of mount -t debugfs be an option?

Quoted 2 lines

I contemplated that, but decided that should be a separate change later on. I can send a patch on top if you like.

Quoted 7 lines

Yes, separate patch, but no hurry on that one. Another patch for making the same change in tools/intel_gpu_abrt would also be nice.

The series is

Thanks, pushed.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx