Skip to contentSkip to conversation

tests: do snd_hda_intel unbind before unload in module reload test

PATCH Superseded Jani Nikula 2 participants 7 messages Oct 31, 2016 – Nov 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: do snd_hda_intel unbind before unload in module reload test

Try to make sure the snd_hda_intel module is not in use, and can be unloaded.

Cc Keqiao Zhang <[email protected]>
Cc Libin Yang <[email protected]>

---

Keqiao, Libin, here's the script this patch is against:

https://cgit.freedesktop.org/drm/igt-gpu-tools/tree/tests/drv_module_reload_basic

---
 tests/drv_module_reload_basic | 3 +++
 1 file changed, 3 insertions(+)
tests/drv_module_reload_basic +3 -0
index b8cad88133e9..c0676fc65db0 100755
@@ -33,6 +33,9 @@ function reload() {
 	pkill alsactl
 	snd_hda_intel_unloaded=0
 	if mod_loaded snd_hda_intel; then
+		if [ -e /sys/bus/pci/drivers/snd_hda_intel/unbind ]; then
+			echo "0000:00:03.0" > /sys/bus/pci/drivers/snd_hda_intel/unbind
+		fi
 		if rmmod snd_hda_intel; then
 			snd_hda_intel_unloaded=1
 		else
Signature · 6 lines
2.1.4

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

PATCH 1/1 tests: add more debugs on failure to unload snd_hda_intel

List open files under sound devices.

---
 tests/drv_module_reload_basic | 1 +
 1 file changed, 1 insertion(+)
tests/drv_module_reload_basic +1 -0
index c0676fc65db0..bbe11f7fe5bd 100755
@@ -40,6 +40,7 @@ function reload() {
 			snd_hda_intel_unloaded=1
 		else
 			lsmod >&2
+			lsof /dev/snd/* >&2
 		fi
 	fi
 
Signature · 6 lines
2.1.4

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

-----Original Message-----
From: Nikula, Jani
Sent: Monday, October 31, 2016 4:40 PM
To: [email protected]
Cc: Nikula, Jani <[email protected]>; Zhang, Keqiao <[email protected]>; Yang, Libin <[email protected]>
Subject: [i-g-t PATCH] tests: do snd_hda_intel unbind before unload in module reload test

Try to make sure the snd_hda_intel module is not in use, and can be unloaded.

Cc Keqiao Zhang <[email protected]>
Cc Libin Yang <[email protected]>

---

Keqiao, Libin, here's the script this patch is against:

https://cgit.freedesktop.org/drm/igt-gpu-
tools/tree/tests/drv_module_reload_basic

---
 tests/drv_module_reload_basic | 3 +++
 1 file changed, 3 insertions(+)
tests/drv_module_reload_basic +0 -0
index b8cad88133e9..c0676fc65db0 100755

tests/drv_module_reload_basic function reload() { · line 37

Quoted 5 lines
tests/drv_module_reload_basic +2 -0
@@ -33,6 +33,9 @@ function reload() {
 	pkill alsactl
 	snd_hda_intel_unloaded=0
 	if mod_loaded snd_hda_intel; then
+		if [ -e /sys/bus/pci/drivers/snd_hda_intel/unbind ]; then
+			echo "0000:00:03.0" >

"0000:00:03.0" is platform related.
We should check lspci -vvv |grep Audio to get the number.
Or we can check /sys/bus/pci/drivers/snd_hda_intel/ folder to get the number. And sometimes there are 2 sound cards to unbind.

Regards,
Libin

Quoted 7 lines

/sys/bus/pci/drivers/snd_hda_intel/unbind

tests/drv_module_reload_basic +1 -1
+		fi
 		if rmmod snd_hda_intel; then
 			snd_hda_intel_unloaded=1
 		else
--

2.1.4

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

#3 lore raw
Quoted 26 lines · Libin
Quoted 26 lines

-----Original Message-----
From: Nikula, Jani
Sent: Monday, October 31, 2016 4:40 PM
To: [email protected]
Cc: Nikula, Jani <[email protected]>; Zhang, Keqiao <[email protected]>; Yang, Libin <[email protected]>
Subject: [i-g-t PATCH] tests: do snd_hda_intel unbind before unload in module reload test

Try to make sure the snd_hda_intel module is not in use, and can be unloaded.

Cc Keqiao Zhang <[email protected]>
Cc Libin Yang <[email protected]>

---

Keqiao, Libin, here's the script this patch is against:

https://cgit.freedesktop.org/drm/igt-gpu-
tools/tree/tests/drv_module_reload_basic

---
 tests/drv_module_reload_basic | 3 +++
 1 file changed, 3 insertions(+)
Quoted 15 lines

tests/drv_module_reload_basic function reload() { · line 37

Quoted 10 lines
tests/drv_module_reload_basic +2 -0
index b8cad88133e9..c0676fc65db0 100755
@@ -33,6 +33,9 @@ function reload() {
 	pkill alsactl
 	snd_hda_intel_unloaded=0
 	if mod_loaded snd_hda_intel; then
+		if [ -e /sys/bus/pci/drivers/snd_hda_intel/unbind ]; then
+			echo "0000:00:03.0" >

"0000:00:03.0" is platform related.
We should check lspci -vvv |grep Audio to get the number.
Or we can check /sys/bus/pci/drivers/snd_hda_intel/ folder to get the number. And sometimes there are 2 sound cards to unbind.

How about this?

for f in $(find /sys/bus/pci/drivers/snd_hda_intel -name "0000:*" -printf %f); do
echo $f > /sys/bus/pci/drivers/snd_hda_intel/unbind
done

BR,
Jani.

Quoted 12 lines

Regards,
Libin

Quoted 7 lines

/sys/bus/pci/drivers/snd_hda_intel/unbind

tests/drv_module_reload_basic +1 -1
+		fi
 		if rmmod snd_hda_intel; then
 			snd_hda_intel_unloaded=1
 		else
--

2.1.4

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

PATCH v2 1/1 tests: do snd_hda_intel unbind before unload in module reload test

In reply to Jani Nikula

Try to make sure the snd_hda_intel module is not in use, and can be unloaded.

v2: unbind all cards (Libin)

Cc Keqiao Zhang <[email protected]>
Cc Libin Yang <[email protected]>

---

Keqiao, Libin, here's the script this patch is against:

https://cgit.freedesktop.org/drm/igt-gpu-tools/tree/tests/drv_module_reload_basic

---
 tests/drv_module_reload_basic | 5 +++++
 1 file changed, 5 insertions(+)
tests/drv_module_reload_basic +5 -0
index b8cad88133e9..105852a56b46 100755
@@ -33,6 +33,11 @@ function reload() {
 	pkill alsactl
 	snd_hda_intel_unloaded=0
 	if mod_loaded snd_hda_intel; then
+		# unbind sound cards
+		for card in $(find /sys/bus/pci/drivers/snd_hda_intel -name "0000:*" -printf "%f\n"); do
+			echo $card > /sys/bus/pci/drivers/snd_hda_intel/unbind
+		done
+
 		if rmmod snd_hda_intel; then
 			snd_hda_intel_unloaded=1
 		else
Signature · 6 lines
2.1.4

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

Regards,
Libin

Quoted 47 lines

-----Original Message-----
From: Nikula, Jani
Sent: Monday, October 31, 2016 7:00 PM
To: Nikula, Jani <[email protected]>; [email protected]
Cc: Zhang, Keqiao <[email protected]>; Yang, Libin <[email protected]>
Subject: [i-g-t PATCH v2] tests: do snd_hda_intel unbind before unload in module reload test

Try to make sure the snd_hda_intel module is not in use, and can be unloaded.

v2: unbind all cards (Libin)

Cc Keqiao Zhang <[email protected]>
Cc Libin Yang <[email protected]>

---

Keqiao, Libin, here's the script this patch is against:

https://cgit.freedesktop.org/drm/igt-gpu-
tools/tree/tests/drv_module_reload_basic

---
 tests/drv_module_reload_basic | 5 +++++
 1 file changed, 5 insertions(+)
tests/drv_module_reload_basic +2 -0
index b8cad88133e9..105852a56b46 100755
@@ -33,6 +33,11 @@ function reload() {
 	pkill alsactl
 	snd_hda_intel_unloaded=0
 	if mod_loaded snd_hda_intel; then
+		# unbind sound cards
+		for card in $(find /sys/bus/pci/drivers/snd_hda_intel -name

"0000:*" -printf "%f\n"); do

tests/drv_module_reload_basic +1 -0
+			echo $card >

/sys/bus/pci/drivers/snd_hda_intel/unbind

tests/drv_module_reload_basic +2 -1
+		done
+
 		if rmmod snd_hda_intel; then
 			snd_hda_intel_unloaded=1
 		else
--
Quoted 1 line

2.1.4

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

#6 lore raw
Quoted 1 line · Libin

Pushed both patches to igt, thanks for the review.

BR,
Jani.

Quoted 54 lines

Regards,
Libin

Quoted 48 lines

-----Original Message-----
From: Nikula, Jani
Sent: Monday, October 31, 2016 7:00 PM
To: Nikula, Jani <[email protected]>; [email protected]
Cc: Zhang, Keqiao <[email protected]>; Yang, Libin <[email protected]>
Subject: [i-g-t PATCH v2] tests: do snd_hda_intel unbind before unload in module reload test

Try to make sure the snd_hda_intel module is not in use, and can be unloaded.

v2: unbind all cards (Libin)

Cc Keqiao Zhang <[email protected]>
Cc Libin Yang <[email protected]>

---

Keqiao, Libin, here's the script this patch is against:

https://cgit.freedesktop.org/drm/igt-gpu-
tools/tree/tests/drv_module_reload_basic

---
 tests/drv_module_reload_basic | 5 +++++
 1 file changed, 5 insertions(+)
tests/drv_module_reload_basic +2 -0
index b8cad88133e9..105852a56b46 100755
@@ -33,6 +33,11 @@ function reload() {
 	pkill alsactl
 	snd_hda_intel_unloaded=0
 	if mod_loaded snd_hda_intel; then
+		# unbind sound cards
+		for card in $(find /sys/bus/pci/drivers/snd_hda_intel -name

"0000:*" -printf "%f\n"); do

tests/drv_module_reload_basic +1 -0
+			echo $card >

/sys/bus/pci/drivers/snd_hda_intel/unbind

tests/drv_module_reload_basic +2 -1
+		done
+
 		if rmmod snd_hda_intel; then
 			snd_hda_intel_unloaded=1
 		else
--

2.1.4

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