linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: add sleep between detach and usbip list -l
@ 2019-05-02 19:47 Shuah Khan
  2019-05-05  9:13 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2019-05-02 19:47 UTC (permalink / raw)
  To: valentina.manea.m, shuah
  Cc: Shuah Khan, linux-usb, linux-kselftest, linux-kernel

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@linuxfoundation.org>
---
 tools/testing/selftests/drivers/usb/usbip/usbip_test.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh b/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
index 128f0ab24307..beacf24a8df7 100755
--- a/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
+++ b/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
@@ -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;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests: add sleep between detach and usbip list -l
  2019-05-02 19:47 [PATCH] selftests: add sleep between detach and usbip list -l Shuah Khan
@ 2019-05-05  9:13 ` Greg KH
  2019-05-06 14:47   ` Shuah Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2019-05-05  9:13 UTC (permalink / raw)
  To: Shuah Khan
  Cc: valentina.manea.m, shuah, linux-usb, linux-kselftest, linux-kernel

On Thu, May 02, 2019 at 01:47:40PM -0600, Shuah Khan wrote:
> 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@linuxfoundation.org>
> ---
>  tools/testing/selftests/drivers/usb/usbip/usbip_test.sh | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh b/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
> index 128f0ab24307..beacf24a8df7 100755
> --- a/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
> +++ b/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
> @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests: add sleep between detach and usbip list -l
  2019-05-05  9:13 ` Greg KH
@ 2019-05-06 14:47   ` Shuah Khan
  2019-05-06 15:15     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2019-05-06 14:47 UTC (permalink / raw)
  To: Greg KH
  Cc: valentina.manea.m, shuah, linux-usb, linux-kselftest,
	linux-kernel, Shuah Khan

On 5/5/19 3:13 AM, Greg KH wrote:
> On Thu, May 02, 2019 at 01:47:40PM -0600, Shuah Khan wrote:
>> 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@linuxfoundation.org>
>> ---
>>   tools/testing/selftests/drivers/usb/usbip/usbip_test.sh | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh b/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
>> index 128f0ab24307..beacf24a8df7 100755
>> --- a/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
>> +++ b/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
>> @@ -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?
> 

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests: add sleep between detach and usbip list -l
  2019-05-06 14:47   ` Shuah Khan
@ 2019-05-06 15:15     ` Greg KH
  2019-05-06 15:18       ` Shuah Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2019-05-06 15:15 UTC (permalink / raw)
  To: Shuah Khan
  Cc: valentina.manea.m, shuah, linux-usb, linux-kselftest, linux-kernel

On Mon, May 06, 2019 at 08:47:15AM -0600, Shuah Khan wrote:
> On 5/5/19 3:13 AM, Greg KH wrote:
> > On Thu, May 02, 2019 at 01:47:40PM -0600, Shuah Khan wrote:
> > > 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@linuxfoundation.org>
> > > ---
> > >   tools/testing/selftests/drivers/usb/usbip/usbip_test.sh | 4 ++++
> > >   1 file changed, 4 insertions(+)
> > > 
> > > diff --git a/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh b/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
> > > index 128f0ab24307..beacf24a8df7 100755
> > > --- a/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
> > > +++ b/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
> > > @@ -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?
> > 
> 
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests: add sleep between detach and usbip list -l
  2019-05-06 15:15     ` Greg KH
@ 2019-05-06 15:18       ` Shuah Khan
  0 siblings, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2019-05-06 15:18 UTC (permalink / raw)
  To: Greg KH
  Cc: valentina.manea.m, shuah, linux-usb, linux-kselftest,
	linux-kernel, Shuah Khan

On 5/6/19 9:15 AM, Greg KH wrote:
> On Mon, May 06, 2019 at 08:47:15AM -0600, Shuah Khan wrote:
>> On 5/5/19 3:13 AM, Greg KH wrote:
>>> On Thu, May 02, 2019 at 01:47:40PM -0600, Shuah Khan wrote:
>>>> 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@linuxfoundation.org>
>>>> ---
>>>>    tools/testing/selftests/drivers/usb/usbip/usbip_test.sh | 4 ++++
>>>>    1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh b/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
>>>> index 128f0ab24307..beacf24a8df7 100755
>>>> --- a/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
>>>> +++ b/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
>>>> @@ -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?
>>>
>>
>> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-05-06 15:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-02 19:47 [PATCH] selftests: add sleep between detach and usbip list -l Shuah Khan
2019-05-05  9:13 ` Greg KH
2019-05-06 14:47   ` Shuah Khan
2019-05-06 15:15     ` Greg KH
2019-05-06 15:18       ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).