Skip to contentSkip to conversation

selftests: add sleep between detach and usbip list -l

PATCH In review Shuah Khan 2 participants 5 messages May 2, 2019 – May 6, 2019

Subsystems (3)
lore
Share & tools
lore

Shuah Khan

author maintainer
#0 lore raw

PATCH 1/1 selftests: add sleep between detach and usbip list -l

Add a sleep between detach and check for exportable devices to avoid the following segfault from libc-2.27.so

[ 6268.136108] usbip[5565]: segfault at 0 ip 00007f2a947bddfd sp 00007ffd1a8705e8 error 4 in libc-2.27.so[7f2a94703000+1e7000]
Signed-off-by Shuah Khan <skhan at linuxfoundation.org>
---
 tools/testing/selftests/drivers/usb/usbip/usbip_test.sh | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/drivers/usb/usbip/usbip_test.sh +4 -0
index 128f0ab24307..beacf24a8df7 100755
@@ -171,10 +171,14 @@ echo "Detach invalid port tests - expect invalid port error message";
 src/usbip detach -p 100;
 echo "=============================================================="
 
+# let detach complete. Avoid segfaults from libc-2.27.so
+sleep 3;
+
 echo "Expect to see export-able devices";
 src/usbip list -l;
 echo "=============================================================="
 
+
 echo "Remove usbip_host module";
 rmmod usbip_host;
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 15 lines · Shuah Khan

Add a sleep between detach and check for exportable devices to avoid the following segfault from libc-2.27.so

[ 6268.136108] usbip[5565]: segfault at 0 ip 00007f2a947bddfd sp 00007ffd1a8705e8 error 4 in libc-2.27.so[7f2a94703000+1e7000]
Signed-off-by Shuah Khan <skhan at linuxfoundation.org>
---
 tools/testing/selftests/drivers/usb/usbip/usbip_test.sh | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/drivers/usb/usbip/usbip_test.sh +0 -0
index 128f0ab24307..beacf24a8df7 100755

tools/testing/selftests/drivers/usb/usbip/usbip_test.sh echo "Detach invalid port tests - expect invalid port error message"; · line 175

Quoted 5 lines
tools/testing/selftests/drivers/usb/usbip/usbip_test.sh +2 -0
@@ -171,10 +171,14 @@ echo "Detach invalid port tests - expect invalid port error message";
 src/usbip detach -p 100;
 echo "=============================================================="
 
+# let detach complete. Avoid segfaults from libc-2.27.so
+sleep 3;

That feels very "arbitrary", why do we "know" it will take at most 3 seconds? I guess there's not much else we can do here except maybe somehow watch sysfs until the device is really gone?

thanks,

greg k-h

author maintainer
#2 lore raw
Quoted 19 lines · Greg KH
Quoted 18 lines · Shuah Khan

Add a sleep between detach and check for exportable devices to avoid the following segfault from libc-2.27.so

[ 6268.136108] usbip[5565]: segfault at 0 ip 00007f2a947bddfd sp 00007ffd1a8705e8 error 4 in libc-2.27.so[7f2a94703000+1e7000]
Signed-off-by Shuah Khan <skhan at linuxfoundation.org>
---
  tools/testing/selftests/drivers/usb/usbip/usbip_test.sh | 4 ++++
  1 file changed, 4 insertions(+)
tools/testing/selftests/drivers/usb/usbip/usbip_test.sh +0 -0
index 128f0ab24307..beacf24a8df7 100755
@@ -171,10 +171,14 @@ echo "Detach invalid port tests - expect invalid port error message";
  src/usbip detach -p 100;
  echo "=============================================================="
 
Quoted 7 lines

tools/testing/selftests/drivers/usb/usbip/usbip_test.sh echo "Detach invalid port tests - expect invalid port error message"; · line 175

Quoted 2 lines
tools/testing/selftests/drivers/usb/usbip/usbip_test.sh +2 -0
+# let detach complete. Avoid segfaults from libc-2.27.so
+sleep 3;

That feels very "arbitrary", why do we "know" it will take at most 3 seconds? I guess there's not much else we can do here except maybe somehow watch sysfs until the device is really gone?

Yeah. Number 3 is somewhat arbitrary. It helps the host process the detach request from the client and update the sysfs. Detach returns as soon as client side is done, and the test is running the next command on the host side. If I were run these commands manually, it gives enough settling time. I am looking for a quick way to allow settling time in this automated test.

thanks,
-- Shuah

#3 lore raw
Quoted 27 lines · Shuah Khan
Quoted 11 lines · Greg KH
Quoted 10 lines · Shuah Khan

Add a sleep between detach and check for exportable devices to avoid the following segfault from libc-2.27.so

[ 6268.136108] usbip[5565]: segfault at 0 ip 00007f2a947bddfd sp 00007ffd1a8705e8 error 4 in libc-2.27.so[7f2a94703000+1e7000]
Signed-off-by Shuah Khan <skhan at linuxfoundation.org>
---
  tools/testing/selftests/drivers/usb/usbip/usbip_test.sh | 4 ++++
  1 file changed, 4 insertions(+)
Quoted 14 lines

tools/testing/selftests/drivers/usb/usbip/usbip_test.sh echo "Detach invalid port tests - expect invalid port error message"; · line 174

Quoted 9 lines
tools/testing/selftests/drivers/usb/usbip/usbip_test.sh +2 -0
index 128f0ab24307..beacf24a8df7 100755
@@ -171,10 +171,14 @@ echo "Detach invalid port tests - expect invalid port error message";
  src/usbip detach -p 100;
  echo "=============================================================="
+# let detach complete. Avoid segfaults from libc-2.27.so
+sleep 3;

That feels very "arbitrary", why do we "know" it will take at most 3 seconds? I guess there's not much else we can do here except maybe somehow watch sysfs until the device is really gone?

Quoted 6 lines

Yeah. Number 3 is somewhat arbitrary. It helps the host process the detach request from the client and update the sysfs. Detach returns as soon as client side is done, and the test is running the next command on the host side. If I were run these commands manually, it gives enough settling time. I am looking for a quick way to allow settling time in this automated test.

Ok, you might want to document that you know it's a random number :)

thanks,

greg k-h

author maintainer
#4 lore raw
Quoted 28 lines · Greg KH
Quoted 27 lines · Shuah Khan
Quoted 25 lines · Greg KH
Quoted 15 lines · Shuah Khan

Add a sleep between detach and check for exportable devices to avoid the following segfault from libc-2.27.so

[ 6268.136108] usbip[5565]: segfault at 0 ip 00007f2a947bddfd sp 00007ffd1a8705e8 error 4 in libc-2.27.so[7f2a94703000+1e7000]
Signed-off-by Shuah Khan <skhan at linuxfoundation.org>
---
   tools/testing/selftests/drivers/usb/usbip/usbip_test.sh | 4 ++++
   1 file changed, 4 insertions(+)
tools/testing/selftests/drivers/usb/usbip/usbip_test.sh +0 -0
index 128f0ab24307..beacf24a8df7 100755

tools/testing/selftests/drivers/usb/usbip/usbip_test.sh echo "Detach invalid port tests - expect invalid port error message"; · line 174

Quoted 4 lines
tools/testing/selftests/drivers/usb/usbip/usbip_test.sh +2 -0
@@ -171,10 +171,14 @@ echo "Detach invalid port tests - expect invalid port error message";
   src/usbip detach -p 100;
   echo "=============================================================="
+# let detach complete. Avoid segfaults from libc-2.27.so
+sleep 3;

That feels very "arbitrary", why do we "know" it will take at most 3 seconds? I guess there's not much else we can do here except maybe somehow watch sysfs until the device is really gone?

Quoted 9 lines
Quoted 6 lines

Yeah. Number 3 is somewhat arbitrary. It helps the host process the detach request from the client and update the sysfs. Detach returns as soon as client side is done, and the test is running the next command on the host side. If I were run these commands manually, it gives enough settling time. I am looking for a quick way to allow settling time in this automated test.

Ok, you might want to document that you know it's a random number :)

Okay. Will do. I will send v2. :)

thanks,
-- Shuah