Re: [PATCH 8/8] ntb_test: Add a selftest script for the NTB subsystem

2016-06-14 Thread Logan Gunthorpe


On 14/06/16 09:47 AM, Allen Hubbe wrote:
> From: Logan Gunthorpe
>> This script automates testing doorbells, scratchpads and memory windows
>> for an NTB device. It can be run locally, with the NTB looped
>> back to the same host or use SSH to remotely control the second host.
>>
>> In the single host case, the script just needs to be passed two
>> arguments: a PCI ID for each side of the link. In the two host case
>> the -r option must be used to specify the remote hostname (which must
>> be SSH accessible and should probably have ssh-keys exchanged).
>>
>> A sample run looks like this:
>>
>> $ sudo ./ntb_test.sh :03:00.1 :83:00.1 -p 29
>> Starting ntb_tool tests...
>> Running db tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running db tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running spad tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running spad tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running mw0 tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running mw0 tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running mw1 tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running mw1 tests on: :83:00.1 / :03:00.1
>>   Passed
>>
>> Starting ntb_pingpong tests...
>> Running ping pong tests on: :03:00.1 / :83:00.1
>>   Passed
>>
>> Starting ntb_perf tests...
>> Running local perf test without DMA
>>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>>   Passed
>> Running remote perf test without DMA
>>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>>   Passed
>>
>> Signed-off-by: Logan Gunthorpe 
>> ---
>>  MAINTAINERS |   1 +
>>  tools/testing/selftests/ntb/ntb_test.sh | 386 
>> 
>>  2 files changed, 387 insertions(+)
>>  create mode 100755 tools/testing/selftests/ntb/ntb_test.sh
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 9c567a4..f178e7e 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -7846,6 +7846,7 @@ F: drivers/ntb/
>>  F:  drivers/net/ntb_netdev.c
>>  F:  include/linux/ntb.h
>>  F:  include/linux/ntb_transport.h
>> +F:  tools/testing/selftests/ntb/
>>
>>  NTB INTEL DRIVER
>>  M:  Jon Mason 
>> diff --git a/tools/testing/selftests/ntb/ntb_test.sh
>> b/tools/testing/selftests/ntb/ntb_test.sh
>> new file mode 100755
>> index 000..e4a89e9
>> --- /dev/null
>> +++ b/tools/testing/selftests/ntb/ntb_test.sh
>> @@ -0,0 +1,386 @@
>> +#!/bin/bash
>> +# Copyright (c) 2016 Microsemi. All Rights Reserved.
>> +#
>> +# This program is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU General Public License as
>> +# published by the Free Software Foundation; either version 2 of
>> +# the License, or (at your option) any later version.
>> +#
>> +# This program is distributed in the hope that it would be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +# GNU General Public License for more details.
>> +#
>> +# Author: Logan Gunthorpe 
>> +
>> +REMOTE_HOST=
>> +LIST_DEVS=FALSE
>> +
>> +DEBUGFS=${DEBUGFS-/sys/kernel/debug}
>> +
>> +PERF_RUN_ORDER=32
>> +MAX_MW_SIZE=0
>> +RUN_DMA_TESTS=
>> +DONT_CLEANUP=
>> +
>> +function show_help()
>> +{
>> +echo "Usage: $0 [OPTIONS] LOCAL_DEV REMOTE_DEV"
>> +echo "Run tests on a pair of NTB endpoints."
>> +echo
>> +echo "If the NTB device loops back to the same host then,"
>> +echo "just specifying the two PCI ids on the command line is"
>> +echo "sufficient. Otherwise, if the NTB link spans two hosts"
>> +echo "use the -r option to specify the hostname for the remote"
>> +echo "device. SSH will then be used to test the remote side."
>> +echo "An SSH key between the root users of the host would then"
>> +echo "be highly recommended."
>> +echo
>> +echo "Options:"
>> +echo "  -C  don't cleanup ntb modules on exit"
>> +echo "  -d  run dma tests"
>> +echo "  -h  show this help message"
>> +echo "  -l  list available local and remote PCI ids"
>> +echo "  -r REMOTE_HOST  specify the remote's hostname to connect"
>> +echo "  to for the test (using ssh)"
>> +echo "  -p NUM  ntb_perf run order (default: $PERF_RUN_ORDER)"
>> +echo "  -w max_mw_size  maxmium memory window size"
>> +echo
>> +}
>> +
>> +function parse_args()
>> +{
>> +OPTIND=0
>> +while getopts "Cdhlr:p:w:" opt; do
>> +case "$opt" in
>> +C)  DONT_CLEANUP=1 ;;
>> +d)  RUN_DMA_TESTS=1 ;;
>> +h)  show_help; exit 0 ;;
>> +l)  LIST_DEVS=TRUE ;;
>> +r)  REMOTE_HOST=${OPTARG} ;;
>> +p)  PERF_RUN_ORDER=${OPTARG} ;;
>> +w)  MAX_MW_SIZE=${OPTARG} ;;
>> +\?)
>> +echo "Invalid option: 

Re: [PATCH 8/8] ntb_test: Add a selftest script for the NTB subsystem

2016-06-14 Thread Logan Gunthorpe


On 14/06/16 09:47 AM, Allen Hubbe wrote:
> From: Logan Gunthorpe
>> This script automates testing doorbells, scratchpads and memory windows
>> for an NTB device. It can be run locally, with the NTB looped
>> back to the same host or use SSH to remotely control the second host.
>>
>> In the single host case, the script just needs to be passed two
>> arguments: a PCI ID for each side of the link. In the two host case
>> the -r option must be used to specify the remote hostname (which must
>> be SSH accessible and should probably have ssh-keys exchanged).
>>
>> A sample run looks like this:
>>
>> $ sudo ./ntb_test.sh :03:00.1 :83:00.1 -p 29
>> Starting ntb_tool tests...
>> Running db tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running db tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running spad tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running spad tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running mw0 tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running mw0 tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running mw1 tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running mw1 tests on: :83:00.1 / :03:00.1
>>   Passed
>>
>> Starting ntb_pingpong tests...
>> Running ping pong tests on: :03:00.1 / :83:00.1
>>   Passed
>>
>> Starting ntb_perf tests...
>> Running local perf test without DMA
>>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>>   Passed
>> Running remote perf test without DMA
>>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>>   Passed
>>
>> Signed-off-by: Logan Gunthorpe 
>> ---
>>  MAINTAINERS |   1 +
>>  tools/testing/selftests/ntb/ntb_test.sh | 386 
>> 
>>  2 files changed, 387 insertions(+)
>>  create mode 100755 tools/testing/selftests/ntb/ntb_test.sh
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 9c567a4..f178e7e 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -7846,6 +7846,7 @@ F: drivers/ntb/
>>  F:  drivers/net/ntb_netdev.c
>>  F:  include/linux/ntb.h
>>  F:  include/linux/ntb_transport.h
>> +F:  tools/testing/selftests/ntb/
>>
>>  NTB INTEL DRIVER
>>  M:  Jon Mason 
>> diff --git a/tools/testing/selftests/ntb/ntb_test.sh
>> b/tools/testing/selftests/ntb/ntb_test.sh
>> new file mode 100755
>> index 000..e4a89e9
>> --- /dev/null
>> +++ b/tools/testing/selftests/ntb/ntb_test.sh
>> @@ -0,0 +1,386 @@
>> +#!/bin/bash
>> +# Copyright (c) 2016 Microsemi. All Rights Reserved.
>> +#
>> +# This program is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU General Public License as
>> +# published by the Free Software Foundation; either version 2 of
>> +# the License, or (at your option) any later version.
>> +#
>> +# This program is distributed in the hope that it would be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +# GNU General Public License for more details.
>> +#
>> +# Author: Logan Gunthorpe 
>> +
>> +REMOTE_HOST=
>> +LIST_DEVS=FALSE
>> +
>> +DEBUGFS=${DEBUGFS-/sys/kernel/debug}
>> +
>> +PERF_RUN_ORDER=32
>> +MAX_MW_SIZE=0
>> +RUN_DMA_TESTS=
>> +DONT_CLEANUP=
>> +
>> +function show_help()
>> +{
>> +echo "Usage: $0 [OPTIONS] LOCAL_DEV REMOTE_DEV"
>> +echo "Run tests on a pair of NTB endpoints."
>> +echo
>> +echo "If the NTB device loops back to the same host then,"
>> +echo "just specifying the two PCI ids on the command line is"
>> +echo "sufficient. Otherwise, if the NTB link spans two hosts"
>> +echo "use the -r option to specify the hostname for the remote"
>> +echo "device. SSH will then be used to test the remote side."
>> +echo "An SSH key between the root users of the host would then"
>> +echo "be highly recommended."
>> +echo
>> +echo "Options:"
>> +echo "  -C  don't cleanup ntb modules on exit"
>> +echo "  -d  run dma tests"
>> +echo "  -h  show this help message"
>> +echo "  -l  list available local and remote PCI ids"
>> +echo "  -r REMOTE_HOST  specify the remote's hostname to connect"
>> +echo "  to for the test (using ssh)"
>> +echo "  -p NUM  ntb_perf run order (default: $PERF_RUN_ORDER)"
>> +echo "  -w max_mw_size  maxmium memory window size"
>> +echo
>> +}
>> +
>> +function parse_args()
>> +{
>> +OPTIND=0
>> +while getopts "Cdhlr:p:w:" opt; do
>> +case "$opt" in
>> +C)  DONT_CLEANUP=1 ;;
>> +d)  RUN_DMA_TESTS=1 ;;
>> +h)  show_help; exit 0 ;;
>> +l)  LIST_DEVS=TRUE ;;
>> +r)  REMOTE_HOST=${OPTARG} ;;
>> +p)  PERF_RUN_ORDER=${OPTARG} ;;
>> +w)  MAX_MW_SIZE=${OPTARG} ;;
>> +\?)
>> +echo "Invalid option: -$OPTARG" >&2
>> +exit 1
>> +;;

RE: [PATCH 8/8] ntb_test: Add a selftest script for the NTB subsystem

2016-06-14 Thread Allen Hubbe
From: Logan Gunthorpe
> This script automates testing doorbells, scratchpads and memory windows
> for an NTB device. It can be run locally, with the NTB looped
> back to the same host or use SSH to remotely control the second host.
> 
> In the single host case, the script just needs to be passed two
> arguments: a PCI ID for each side of the link. In the two host case
> the -r option must be used to specify the remote hostname (which must
> be SSH accessible and should probably have ssh-keys exchanged).
> 
> A sample run looks like this:
> 
> $ sudo ./ntb_test.sh :03:00.1 :83:00.1 -p 29
> Starting ntb_tool tests...
> Running db tests on: :03:00.1 / :83:00.1
>   Passed
> Running db tests on: :83:00.1 / :03:00.1
>   Passed
> Running spad tests on: :03:00.1 / :83:00.1
>   Passed
> Running spad tests on: :83:00.1 / :03:00.1
>   Passed
> Running mw0 tests on: :03:00.1 / :83:00.1
>   Passed
> Running mw0 tests on: :83:00.1 / :03:00.1
>   Passed
> Running mw1 tests on: :03:00.1 / :83:00.1
>   Passed
> Running mw1 tests on: :83:00.1 / :03:00.1
>   Passed
> 
> Starting ntb_pingpong tests...
> Running ping pong tests on: :03:00.1 / :83:00.1
>   Passed
> 
> Starting ntb_perf tests...
> Running local perf test without DMA
>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>   Passed
> Running remote perf test without DMA
>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>   Passed
> 
> Signed-off-by: Logan Gunthorpe 
> ---
>  MAINTAINERS |   1 +
>  tools/testing/selftests/ntb/ntb_test.sh | 386 
> 
>  2 files changed, 387 insertions(+)
>  create mode 100755 tools/testing/selftests/ntb/ntb_test.sh
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9c567a4..f178e7e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7846,6 +7846,7 @@ F:  drivers/ntb/
>  F:   drivers/net/ntb_netdev.c
>  F:   include/linux/ntb.h
>  F:   include/linux/ntb_transport.h
> +F:   tools/testing/selftests/ntb/
> 
>  NTB INTEL DRIVER
>  M:   Jon Mason 
> diff --git a/tools/testing/selftests/ntb/ntb_test.sh
> b/tools/testing/selftests/ntb/ntb_test.sh
> new file mode 100755
> index 000..e4a89e9
> --- /dev/null
> +++ b/tools/testing/selftests/ntb/ntb_test.sh
> @@ -0,0 +1,386 @@
> +#!/bin/bash
> +# Copyright (c) 2016 Microsemi. All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# Author: Logan Gunthorpe 
> +
> +REMOTE_HOST=
> +LIST_DEVS=FALSE
> +
> +DEBUGFS=${DEBUGFS-/sys/kernel/debug}
> +
> +PERF_RUN_ORDER=32
> +MAX_MW_SIZE=0
> +RUN_DMA_TESTS=
> +DONT_CLEANUP=
> +
> +function show_help()
> +{
> + echo "Usage: $0 [OPTIONS] LOCAL_DEV REMOTE_DEV"
> + echo "Run tests on a pair of NTB endpoints."
> + echo
> + echo "If the NTB device loops back to the same host then,"
> + echo "just specifying the two PCI ids on the command line is"
> + echo "sufficient. Otherwise, if the NTB link spans two hosts"
> + echo "use the -r option to specify the hostname for the remote"
> + echo "device. SSH will then be used to test the remote side."
> + echo "An SSH key between the root users of the host would then"
> + echo "be highly recommended."
> + echo
> + echo "Options:"
> + echo "  -C  don't cleanup ntb modules on exit"
> + echo "  -d  run dma tests"
> + echo "  -h  show this help message"
> + echo "  -l  list available local and remote PCI ids"
> + echo "  -r REMOTE_HOST  specify the remote's hostname to connect"
> +echo "  to for the test (using ssh)"
> + echo "  -p NUM  ntb_perf run order (default: $PERF_RUN_ORDER)"
> + echo "  -w max_mw_size  maxmium memory window size"
> + echo
> +}
> +
> +function parse_args()
> +{
> + OPTIND=0
> + while getopts "Cdhlr:p:w:" opt; do
> + case "$opt" in
> + C)  DONT_CLEANUP=1 ;;
> + d)  RUN_DMA_TESTS=1 ;;
> + h)  show_help; exit 0 ;;
> + l)  LIST_DEVS=TRUE ;;
> + r)  REMOTE_HOST=${OPTARG} ;;
> + p)  PERF_RUN_ORDER=${OPTARG} ;;
> + w)  MAX_MW_SIZE=${OPTARG} ;;
> + \?)
> + echo "Invalid option: -$OPTARG" >&2
> + exit 1
> + ;;
> + esac
> + done
> +}
> +
> +parse_args "$@"
> +shift 

RE: [PATCH 8/8] ntb_test: Add a selftest script for the NTB subsystem

2016-06-14 Thread Allen Hubbe
From: Logan Gunthorpe
> This script automates testing doorbells, scratchpads and memory windows
> for an NTB device. It can be run locally, with the NTB looped
> back to the same host or use SSH to remotely control the second host.
> 
> In the single host case, the script just needs to be passed two
> arguments: a PCI ID for each side of the link. In the two host case
> the -r option must be used to specify the remote hostname (which must
> be SSH accessible and should probably have ssh-keys exchanged).
> 
> A sample run looks like this:
> 
> $ sudo ./ntb_test.sh :03:00.1 :83:00.1 -p 29
> Starting ntb_tool tests...
> Running db tests on: :03:00.1 / :83:00.1
>   Passed
> Running db tests on: :83:00.1 / :03:00.1
>   Passed
> Running spad tests on: :03:00.1 / :83:00.1
>   Passed
> Running spad tests on: :83:00.1 / :03:00.1
>   Passed
> Running mw0 tests on: :03:00.1 / :83:00.1
>   Passed
> Running mw0 tests on: :83:00.1 / :03:00.1
>   Passed
> Running mw1 tests on: :03:00.1 / :83:00.1
>   Passed
> Running mw1 tests on: :83:00.1 / :03:00.1
>   Passed
> 
> Starting ntb_pingpong tests...
> Running ping pong tests on: :03:00.1 / :83:00.1
>   Passed
> 
> Starting ntb_perf tests...
> Running local perf test without DMA
>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>   Passed
> Running remote perf test without DMA
>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>   Passed
> 
> Signed-off-by: Logan Gunthorpe 
> ---
>  MAINTAINERS |   1 +
>  tools/testing/selftests/ntb/ntb_test.sh | 386 
> 
>  2 files changed, 387 insertions(+)
>  create mode 100755 tools/testing/selftests/ntb/ntb_test.sh
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9c567a4..f178e7e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7846,6 +7846,7 @@ F:  drivers/ntb/
>  F:   drivers/net/ntb_netdev.c
>  F:   include/linux/ntb.h
>  F:   include/linux/ntb_transport.h
> +F:   tools/testing/selftests/ntb/
> 
>  NTB INTEL DRIVER
>  M:   Jon Mason 
> diff --git a/tools/testing/selftests/ntb/ntb_test.sh
> b/tools/testing/selftests/ntb/ntb_test.sh
> new file mode 100755
> index 000..e4a89e9
> --- /dev/null
> +++ b/tools/testing/selftests/ntb/ntb_test.sh
> @@ -0,0 +1,386 @@
> +#!/bin/bash
> +# Copyright (c) 2016 Microsemi. All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# Author: Logan Gunthorpe 
> +
> +REMOTE_HOST=
> +LIST_DEVS=FALSE
> +
> +DEBUGFS=${DEBUGFS-/sys/kernel/debug}
> +
> +PERF_RUN_ORDER=32
> +MAX_MW_SIZE=0
> +RUN_DMA_TESTS=
> +DONT_CLEANUP=
> +
> +function show_help()
> +{
> + echo "Usage: $0 [OPTIONS] LOCAL_DEV REMOTE_DEV"
> + echo "Run tests on a pair of NTB endpoints."
> + echo
> + echo "If the NTB device loops back to the same host then,"
> + echo "just specifying the two PCI ids on the command line is"
> + echo "sufficient. Otherwise, if the NTB link spans two hosts"
> + echo "use the -r option to specify the hostname for the remote"
> + echo "device. SSH will then be used to test the remote side."
> + echo "An SSH key between the root users of the host would then"
> + echo "be highly recommended."
> + echo
> + echo "Options:"
> + echo "  -C  don't cleanup ntb modules on exit"
> + echo "  -d  run dma tests"
> + echo "  -h  show this help message"
> + echo "  -l  list available local and remote PCI ids"
> + echo "  -r REMOTE_HOST  specify the remote's hostname to connect"
> +echo "  to for the test (using ssh)"
> + echo "  -p NUM  ntb_perf run order (default: $PERF_RUN_ORDER)"
> + echo "  -w max_mw_size  maxmium memory window size"
> + echo
> +}
> +
> +function parse_args()
> +{
> + OPTIND=0
> + while getopts "Cdhlr:p:w:" opt; do
> + case "$opt" in
> + C)  DONT_CLEANUP=1 ;;
> + d)  RUN_DMA_TESTS=1 ;;
> + h)  show_help; exit 0 ;;
> + l)  LIST_DEVS=TRUE ;;
> + r)  REMOTE_HOST=${OPTARG} ;;
> + p)  PERF_RUN_ORDER=${OPTARG} ;;
> + w)  MAX_MW_SIZE=${OPTARG} ;;
> + \?)
> + echo "Invalid option: -$OPTARG" >&2
> + exit 1
> + ;;
> + esac
> + done
> +}
> +
> +parse_args "$@"
> +shift $((OPTIND-1))
> +LOCAL_DEV=$1
> +shift
> +parse_args "$@"
> 

Re: [PATCH 8/8] ntb_test: Add a selftest script for the NTB subsystem

2016-06-14 Thread Logan Gunthorpe
On 14/06/16 08:16 AM, Shuah Khan wrote:
> On 06/14/2016 08:06 AM, Jon Mason wrote:
>> On Fri, Jun 10, 2016 at 6:54 PM, Logan Gunthorpe  wrote:
>>> This script automates testing doorbells, scratchpads and memory windows
>>> for an NTB device. It can be run locally, with the NTB looped
>>> back to the same host or use SSH to remotely control the second host.
>>>
>>> In the single host case, the script just needs to be passed two
>>> arguments: a PCI ID for each side of the link. In the two host case
>>> the -r option must be used to specify the remote hostname (which must
>>> be SSH accessible and should probably have ssh-keys exchanged).
>>
>> I appreciate the work that you are putting in here, but test shell
>> scripts are not accepted into the kernel source.

Yeah, I wasn't aware of this rule. I previously did some work on a very
similar shell script for NVM fabrics. Though that hasn't made it to
upstream yet.

> I don't see any reason for this script to be not part of kernel selftests.
> I think it will be a good addition. We probably don't want to include it in
> the auto run of the selftest suite.
> Jon! I you would like to take this script through your ntb tree, here is
> my ack for the script for kselftest part.
> 
> Acked-by: Shuah Khan 
> 

Thanks Shauh!

>> I think a better place for this to be shared would be on the github
>> account wiki, https://github.com/jonmason/ntb/wiki
>> In fact, I'd really like for someone to add some pages there on using
>> the ntb tools and testing.  If you are willing, I'd be most
>> appreciative.

I can probably make some time for this later in the week.


Logan



Re: [PATCH 8/8] ntb_test: Add a selftest script for the NTB subsystem

2016-06-14 Thread Logan Gunthorpe
On 14/06/16 08:16 AM, Shuah Khan wrote:
> On 06/14/2016 08:06 AM, Jon Mason wrote:
>> On Fri, Jun 10, 2016 at 6:54 PM, Logan Gunthorpe  wrote:
>>> This script automates testing doorbells, scratchpads and memory windows
>>> for an NTB device. It can be run locally, with the NTB looped
>>> back to the same host or use SSH to remotely control the second host.
>>>
>>> In the single host case, the script just needs to be passed two
>>> arguments: a PCI ID for each side of the link. In the two host case
>>> the -r option must be used to specify the remote hostname (which must
>>> be SSH accessible and should probably have ssh-keys exchanged).
>>
>> I appreciate the work that you are putting in here, but test shell
>> scripts are not accepted into the kernel source.

Yeah, I wasn't aware of this rule. I previously did some work on a very
similar shell script for NVM fabrics. Though that hasn't made it to
upstream yet.

> I don't see any reason for this script to be not part of kernel selftests.
> I think it will be a good addition. We probably don't want to include it in
> the auto run of the selftest suite.
> Jon! I you would like to take this script through your ntb tree, here is
> my ack for the script for kselftest part.
> 
> Acked-by: Shuah Khan 
> 

Thanks Shauh!

>> I think a better place for this to be shared would be on the github
>> account wiki, https://github.com/jonmason/ntb/wiki
>> In fact, I'd really like for someone to add some pages there on using
>> the ntb tools and testing.  If you are willing, I'd be most
>> appreciative.

I can probably make some time for this later in the week.


Logan



Re: [PATCH 8/8] ntb_test: Add a selftest script for the NTB subsystem

2016-06-14 Thread Shuah Khan
On 06/14/2016 08:06 AM, Jon Mason wrote:
> On Fri, Jun 10, 2016 at 6:54 PM, Logan Gunthorpe  wrote:
>> This script automates testing doorbells, scratchpads and memory windows
>> for an NTB device. It can be run locally, with the NTB looped
>> back to the same host or use SSH to remotely control the second host.
>>
>> In the single host case, the script just needs to be passed two
>> arguments: a PCI ID for each side of the link. In the two host case
>> the -r option must be used to specify the remote hostname (which must
>> be SSH accessible and should probably have ssh-keys exchanged).
> 
> I appreciate the work that you are putting in here, but test shell
> scripts are not accepted into the kernel source.

I don't see any reason for this script to be not part of kernel selftests.
I think it will be a good addition. We probably don't want to include it in
the auto run of the selftest suite.

Jon! I you would like to take this script through your ntb tree, here is
my ack for the script for kselftest part.

Acked-by: Shuah Khan 

thanks,
-- Shuah

> 
> I think a better place for this to be shared would be on the github
> account wiki, https://github.com/jonmason/ntb/wiki
> In fact, I'd really like for someone to add some pages there on using
> the ntb tools and testing.  If you are willing, I'd be most
> appreciative.
> 
> Thanks,
> Jon
> 
>>
>> A sample run looks like this:
>>
>> $ sudo ./ntb_test.sh :03:00.1 :83:00.1 -p 29
>> Starting ntb_tool tests...
>> Running db tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running db tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running spad tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running spad tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running mw0 tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running mw0 tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running mw1 tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running mw1 tests on: :83:00.1 / :03:00.1
>>   Passed
>>
>> Starting ntb_pingpong tests...
>> Running ping pong tests on: :03:00.1 / :83:00.1
>>   Passed
>>
>> Starting ntb_perf tests...
>> Running local perf test without DMA
>>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>>   Passed
>> Running remote perf test without DMA
>>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>>   Passed
>>
>> Signed-off-by: Logan Gunthorpe 
>> ---
>>  MAINTAINERS |   1 +
>>  tools/testing/selftests/ntb/ntb_test.sh | 386 
>> 
>>  2 files changed, 387 insertions(+)
>>  create mode 100755 tools/testing/selftests/ntb/ntb_test.sh
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 9c567a4..f178e7e 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -7846,6 +7846,7 @@ F:drivers/ntb/
>>  F: drivers/net/ntb_netdev.c
>>  F: include/linux/ntb.h
>>  F: include/linux/ntb_transport.h
>> +F: tools/testing/selftests/ntb/
>>
>>  NTB INTEL DRIVER
>>  M: Jon Mason 
>> diff --git a/tools/testing/selftests/ntb/ntb_test.sh 
>> b/tools/testing/selftests/ntb/ntb_test.sh
>> new file mode 100755
>> index 000..e4a89e9
>> --- /dev/null
>> +++ b/tools/testing/selftests/ntb/ntb_test.sh
>> @@ -0,0 +1,386 @@
>> +#!/bin/bash
>> +# Copyright (c) 2016 Microsemi. All Rights Reserved.
>> +#
>> +# This program is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU General Public License as
>> +# published by the Free Software Foundation; either version 2 of
>> +# the License, or (at your option) any later version.
>> +#
>> +# This program is distributed in the hope that it would be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +# GNU General Public License for more details.
>> +#
>> +# Author: Logan Gunthorpe 
>> +
>> +REMOTE_HOST=
>> +LIST_DEVS=FALSE
>> +
>> +DEBUGFS=${DEBUGFS-/sys/kernel/debug}
>> +
>> +PERF_RUN_ORDER=32
>> +MAX_MW_SIZE=0
>> +RUN_DMA_TESTS=
>> +DONT_CLEANUP=
>> +
>> +function show_help()
>> +{
>> +   echo "Usage: $0 [OPTIONS] LOCAL_DEV REMOTE_DEV"
>> +   echo "Run tests on a pair of NTB endpoints."
>> +   echo
>> +   echo "If the NTB device loops back to the same host then,"
>> +   echo "just specifying the two PCI ids on the command line is"
>> +   echo "sufficient. Otherwise, if the NTB link spans two hosts"
>> +   echo "use the -r option to specify the hostname for the remote"
>> +   echo "device. SSH will then be used to test the remote side."
>> +   echo "An SSH key between the root users of the host would then"
>> +   echo "be highly recommended."
>> +   echo
>> +   echo "Options:"
>> +   echo "  -C  don't cleanup ntb modules on exit"
>> +   echo "  -d  run dma tests"
>> +   

Re: [PATCH 8/8] ntb_test: Add a selftest script for the NTB subsystem

2016-06-14 Thread Shuah Khan
On 06/14/2016 08:06 AM, Jon Mason wrote:
> On Fri, Jun 10, 2016 at 6:54 PM, Logan Gunthorpe  wrote:
>> This script automates testing doorbells, scratchpads and memory windows
>> for an NTB device. It can be run locally, with the NTB looped
>> back to the same host or use SSH to remotely control the second host.
>>
>> In the single host case, the script just needs to be passed two
>> arguments: a PCI ID for each side of the link. In the two host case
>> the -r option must be used to specify the remote hostname (which must
>> be SSH accessible and should probably have ssh-keys exchanged).
> 
> I appreciate the work that you are putting in here, but test shell
> scripts are not accepted into the kernel source.

I don't see any reason for this script to be not part of kernel selftests.
I think it will be a good addition. We probably don't want to include it in
the auto run of the selftest suite.

Jon! I you would like to take this script through your ntb tree, here is
my ack for the script for kselftest part.

Acked-by: Shuah Khan 

thanks,
-- Shuah

> 
> I think a better place for this to be shared would be on the github
> account wiki, https://github.com/jonmason/ntb/wiki
> In fact, I'd really like for someone to add some pages there on using
> the ntb tools and testing.  If you are willing, I'd be most
> appreciative.
> 
> Thanks,
> Jon
> 
>>
>> A sample run looks like this:
>>
>> $ sudo ./ntb_test.sh :03:00.1 :83:00.1 -p 29
>> Starting ntb_tool tests...
>> Running db tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running db tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running spad tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running spad tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running mw0 tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running mw0 tests on: :83:00.1 / :03:00.1
>>   Passed
>> Running mw1 tests on: :03:00.1 / :83:00.1
>>   Passed
>> Running mw1 tests on: :83:00.1 / :03:00.1
>>   Passed
>>
>> Starting ntb_pingpong tests...
>> Running ping pong tests on: :03:00.1 / :83:00.1
>>   Passed
>>
>> Starting ntb_perf tests...
>> Running local perf test without DMA
>>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>>   Passed
>> Running remote perf test without DMA
>>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>>   Passed
>>
>> Signed-off-by: Logan Gunthorpe 
>> ---
>>  MAINTAINERS |   1 +
>>  tools/testing/selftests/ntb/ntb_test.sh | 386 
>> 
>>  2 files changed, 387 insertions(+)
>>  create mode 100755 tools/testing/selftests/ntb/ntb_test.sh
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 9c567a4..f178e7e 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -7846,6 +7846,7 @@ F:drivers/ntb/
>>  F: drivers/net/ntb_netdev.c
>>  F: include/linux/ntb.h
>>  F: include/linux/ntb_transport.h
>> +F: tools/testing/selftests/ntb/
>>
>>  NTB INTEL DRIVER
>>  M: Jon Mason 
>> diff --git a/tools/testing/selftests/ntb/ntb_test.sh 
>> b/tools/testing/selftests/ntb/ntb_test.sh
>> new file mode 100755
>> index 000..e4a89e9
>> --- /dev/null
>> +++ b/tools/testing/selftests/ntb/ntb_test.sh
>> @@ -0,0 +1,386 @@
>> +#!/bin/bash
>> +# Copyright (c) 2016 Microsemi. All Rights Reserved.
>> +#
>> +# This program is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU General Public License as
>> +# published by the Free Software Foundation; either version 2 of
>> +# the License, or (at your option) any later version.
>> +#
>> +# This program is distributed in the hope that it would be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +# GNU General Public License for more details.
>> +#
>> +# Author: Logan Gunthorpe 
>> +
>> +REMOTE_HOST=
>> +LIST_DEVS=FALSE
>> +
>> +DEBUGFS=${DEBUGFS-/sys/kernel/debug}
>> +
>> +PERF_RUN_ORDER=32
>> +MAX_MW_SIZE=0
>> +RUN_DMA_TESTS=
>> +DONT_CLEANUP=
>> +
>> +function show_help()
>> +{
>> +   echo "Usage: $0 [OPTIONS] LOCAL_DEV REMOTE_DEV"
>> +   echo "Run tests on a pair of NTB endpoints."
>> +   echo
>> +   echo "If the NTB device loops back to the same host then,"
>> +   echo "just specifying the two PCI ids on the command line is"
>> +   echo "sufficient. Otherwise, if the NTB link spans two hosts"
>> +   echo "use the -r option to specify the hostname for the remote"
>> +   echo "device. SSH will then be used to test the remote side."
>> +   echo "An SSH key between the root users of the host would then"
>> +   echo "be highly recommended."
>> +   echo
>> +   echo "Options:"
>> +   echo "  -C  don't cleanup ntb modules on exit"
>> +   echo "  -d  run dma tests"
>> +   echo "  -h  show this help message"
>> +   echo "  -l  list available 

Re: [PATCH 8/8] ntb_test: Add a selftest script for the NTB subsystem

2016-06-14 Thread Jon Mason
On Fri, Jun 10, 2016 at 6:54 PM, Logan Gunthorpe  wrote:
> This script automates testing doorbells, scratchpads and memory windows
> for an NTB device. It can be run locally, with the NTB looped
> back to the same host or use SSH to remotely control the second host.
>
> In the single host case, the script just needs to be passed two
> arguments: a PCI ID for each side of the link. In the two host case
> the -r option must be used to specify the remote hostname (which must
> be SSH accessible and should probably have ssh-keys exchanged).

I appreciate the work that you are putting in here, but test shell
scripts are not accepted into the kernel source.

I think a better place for this to be shared would be on the github
account wiki, https://github.com/jonmason/ntb/wiki
In fact, I'd really like for someone to add some pages there on using
the ntb tools and testing.  If you are willing, I'd be most
appreciative.

Thanks,
Jon

>
> A sample run looks like this:
>
> $ sudo ./ntb_test.sh :03:00.1 :83:00.1 -p 29
> Starting ntb_tool tests...
> Running db tests on: :03:00.1 / :83:00.1
>   Passed
> Running db tests on: :83:00.1 / :03:00.1
>   Passed
> Running spad tests on: :03:00.1 / :83:00.1
>   Passed
> Running spad tests on: :83:00.1 / :03:00.1
>   Passed
> Running mw0 tests on: :03:00.1 / :83:00.1
>   Passed
> Running mw0 tests on: :83:00.1 / :03:00.1
>   Passed
> Running mw1 tests on: :03:00.1 / :83:00.1
>   Passed
> Running mw1 tests on: :83:00.1 / :03:00.1
>   Passed
>
> Starting ntb_pingpong tests...
> Running ping pong tests on: :03:00.1 / :83:00.1
>   Passed
>
> Starting ntb_perf tests...
> Running local perf test without DMA
>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>   Passed
> Running remote perf test without DMA
>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>   Passed
>
> Signed-off-by: Logan Gunthorpe 
> ---
>  MAINTAINERS |   1 +
>  tools/testing/selftests/ntb/ntb_test.sh | 386 
> 
>  2 files changed, 387 insertions(+)
>  create mode 100755 tools/testing/selftests/ntb/ntb_test.sh
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9c567a4..f178e7e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7846,6 +7846,7 @@ F:drivers/ntb/
>  F: drivers/net/ntb_netdev.c
>  F: include/linux/ntb.h
>  F: include/linux/ntb_transport.h
> +F: tools/testing/selftests/ntb/
>
>  NTB INTEL DRIVER
>  M: Jon Mason 
> diff --git a/tools/testing/selftests/ntb/ntb_test.sh 
> b/tools/testing/selftests/ntb/ntb_test.sh
> new file mode 100755
> index 000..e4a89e9
> --- /dev/null
> +++ b/tools/testing/selftests/ntb/ntb_test.sh
> @@ -0,0 +1,386 @@
> +#!/bin/bash
> +# Copyright (c) 2016 Microsemi. All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# Author: Logan Gunthorpe 
> +
> +REMOTE_HOST=
> +LIST_DEVS=FALSE
> +
> +DEBUGFS=${DEBUGFS-/sys/kernel/debug}
> +
> +PERF_RUN_ORDER=32
> +MAX_MW_SIZE=0
> +RUN_DMA_TESTS=
> +DONT_CLEANUP=
> +
> +function show_help()
> +{
> +   echo "Usage: $0 [OPTIONS] LOCAL_DEV REMOTE_DEV"
> +   echo "Run tests on a pair of NTB endpoints."
> +   echo
> +   echo "If the NTB device loops back to the same host then,"
> +   echo "just specifying the two PCI ids on the command line is"
> +   echo "sufficient. Otherwise, if the NTB link spans two hosts"
> +   echo "use the -r option to specify the hostname for the remote"
> +   echo "device. SSH will then be used to test the remote side."
> +   echo "An SSH key between the root users of the host would then"
> +   echo "be highly recommended."
> +   echo
> +   echo "Options:"
> +   echo "  -C  don't cleanup ntb modules on exit"
> +   echo "  -d  run dma tests"
> +   echo "  -h  show this help message"
> +   echo "  -l  list available local and remote PCI ids"
> +   echo "  -r REMOTE_HOST  specify the remote's hostname to connect"
> +echo "  to for the test (using ssh)"
> +   echo "  -p NUM  ntb_perf run order (default: $PERF_RUN_ORDER)"
> +   echo "  -w max_mw_size  maxmium memory window size"
> +   echo
> +}
> +
> +function parse_args()
> +{
> +   OPTIND=0
> +   while getopts "Cdhlr:p:w:" opt; do
> +   case 

Re: [PATCH 8/8] ntb_test: Add a selftest script for the NTB subsystem

2016-06-14 Thread Jon Mason
On Fri, Jun 10, 2016 at 6:54 PM, Logan Gunthorpe  wrote:
> This script automates testing doorbells, scratchpads and memory windows
> for an NTB device. It can be run locally, with the NTB looped
> back to the same host or use SSH to remotely control the second host.
>
> In the single host case, the script just needs to be passed two
> arguments: a PCI ID for each side of the link. In the two host case
> the -r option must be used to specify the remote hostname (which must
> be SSH accessible and should probably have ssh-keys exchanged).

I appreciate the work that you are putting in here, but test shell
scripts are not accepted into the kernel source.

I think a better place for this to be shared would be on the github
account wiki, https://github.com/jonmason/ntb/wiki
In fact, I'd really like for someone to add some pages there on using
the ntb tools and testing.  If you are willing, I'd be most
appreciative.

Thanks,
Jon

>
> A sample run looks like this:
>
> $ sudo ./ntb_test.sh :03:00.1 :83:00.1 -p 29
> Starting ntb_tool tests...
> Running db tests on: :03:00.1 / :83:00.1
>   Passed
> Running db tests on: :83:00.1 / :03:00.1
>   Passed
> Running spad tests on: :03:00.1 / :83:00.1
>   Passed
> Running spad tests on: :83:00.1 / :03:00.1
>   Passed
> Running mw0 tests on: :03:00.1 / :83:00.1
>   Passed
> Running mw0 tests on: :83:00.1 / :03:00.1
>   Passed
> Running mw1 tests on: :03:00.1 / :83:00.1
>   Passed
> Running mw1 tests on: :83:00.1 / :03:00.1
>   Passed
>
> Starting ntb_pingpong tests...
> Running ping pong tests on: :03:00.1 / :83:00.1
>   Passed
>
> Starting ntb_perf tests...
> Running local perf test without DMA
>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>   Passed
> Running remote perf test without DMA
>   0: copied 536870912 bytes in 238205 usecs, 2253 MBytes/s
>   Passed
>
> Signed-off-by: Logan Gunthorpe 
> ---
>  MAINTAINERS |   1 +
>  tools/testing/selftests/ntb/ntb_test.sh | 386 
> 
>  2 files changed, 387 insertions(+)
>  create mode 100755 tools/testing/selftests/ntb/ntb_test.sh
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9c567a4..f178e7e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7846,6 +7846,7 @@ F:drivers/ntb/
>  F: drivers/net/ntb_netdev.c
>  F: include/linux/ntb.h
>  F: include/linux/ntb_transport.h
> +F: tools/testing/selftests/ntb/
>
>  NTB INTEL DRIVER
>  M: Jon Mason 
> diff --git a/tools/testing/selftests/ntb/ntb_test.sh 
> b/tools/testing/selftests/ntb/ntb_test.sh
> new file mode 100755
> index 000..e4a89e9
> --- /dev/null
> +++ b/tools/testing/selftests/ntb/ntb_test.sh
> @@ -0,0 +1,386 @@
> +#!/bin/bash
> +# Copyright (c) 2016 Microsemi. All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# Author: Logan Gunthorpe 
> +
> +REMOTE_HOST=
> +LIST_DEVS=FALSE
> +
> +DEBUGFS=${DEBUGFS-/sys/kernel/debug}
> +
> +PERF_RUN_ORDER=32
> +MAX_MW_SIZE=0
> +RUN_DMA_TESTS=
> +DONT_CLEANUP=
> +
> +function show_help()
> +{
> +   echo "Usage: $0 [OPTIONS] LOCAL_DEV REMOTE_DEV"
> +   echo "Run tests on a pair of NTB endpoints."
> +   echo
> +   echo "If the NTB device loops back to the same host then,"
> +   echo "just specifying the two PCI ids on the command line is"
> +   echo "sufficient. Otherwise, if the NTB link spans two hosts"
> +   echo "use the -r option to specify the hostname for the remote"
> +   echo "device. SSH will then be used to test the remote side."
> +   echo "An SSH key between the root users of the host would then"
> +   echo "be highly recommended."
> +   echo
> +   echo "Options:"
> +   echo "  -C  don't cleanup ntb modules on exit"
> +   echo "  -d  run dma tests"
> +   echo "  -h  show this help message"
> +   echo "  -l  list available local and remote PCI ids"
> +   echo "  -r REMOTE_HOST  specify the remote's hostname to connect"
> +echo "  to for the test (using ssh)"
> +   echo "  -p NUM  ntb_perf run order (default: $PERF_RUN_ORDER)"
> +   echo "  -w max_mw_size  maxmium memory window size"
> +   echo
> +}
> +
> +function parse_args()
> +{
> +   OPTIND=0
> +   while getopts "Cdhlr:p:w:" opt; do
> +   case "$opt" in
> +   C)  DONT_CLEANUP=1 ;;
> +   d)