Commit Graph

11558 Commits

Author SHA1 Message Date
Maciej Szwed
fe5a044c93 thread: Add poller run times counter
This will be used by upcoming spdk_top application.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I9ffcc3f2e36b8044bbc394938fc7a1dca1dc6892

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1211
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-13 08:54:17 +00:00
Shuhei Matsumoto
7f6eeaac7d lib/ftl: Fix hung up for bdev_ftl_create with wrong block size of zone bdev
If we specify zone bdev whose block size is not 4096 for bdev_ftl_create
RPC, SPDK application will hung up because spdk_io_device_unregister()
is called for unregistered IO device. Fix this error.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2ec36dc062edb7867aab892073db3af258808114
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1194
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-03-13 08:53:58 +00:00
Shuhei Matsumoto
bf458c8941 doc/ftl: Fix broken table
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If277dfde1f23f988652d29a37e7f4727ba269ea0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1187
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-13 08:53:58 +00:00
Hailiang Wang
bb5567496f test/iscsi: add application for target fuzz testing.
Enables us to test randomized data against the iSCSI target interface.

Change-Id: I56bd5bcd936b92ba152d4d5678d7124b3165c03c
Signed-off-by: Hailiang Wang <hailiangx.e.wang@intel.com>
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/509
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-13 08:53:46 +00:00
Konrad Sztyber
211ef924e3 bdev/ocssd: track outstanding admin commands
Make sure a namespace is depopulated only once all outstanding commands
generated by the media manegement poller to that namespace are completed.
It fixes the use-after-free errors reported by asan during shutdown.

Fixes #1251

Change-Id: Iab99b594756cee2d41235c70194bcaa5f5e1fb0b
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1199
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-13 08:53:39 +00:00
Konrad Sztyber
02385a64b9 bdev/nvme: asynchronous module_finish
Now that a namespace can be depulated asynchronously now, the NVMe bdev
module should also be finalized asynchronously, after all namespaces and
controllers are deallocated.

Change-Id: Ic082fec8e31e9bd5ee1c698cd8dfca9f248776d3
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1198
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-13 08:53:39 +00:00
Konrad Sztyber
9d0f9b330d bdev/nvme: asynchronous namespace depopulation
This patch adds the ability for a namespace to be depopulated
asynchronously.  Currently both regular NVMe namespaces, as well as the
OCSSD ones are depopulated synchronously, but it'll be changed in the
upcoming patches.

The nvme_bdev_ctrlr.ref is now not only tracking the number of bdevs
created on that controller, but also the number of populated namespaces.

Change-Id: I7b112d9b0d41739f3dc7d427e9da340843128c54
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1197
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-13 08:53:39 +00:00
Jacek Kalwas
62e0342eac nvme: minor alignment in ctrlr construct for pcie and rdma
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I35db32e867f91269608c72dbb9290a7ed2e3f31d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1234
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-12 09:04:26 +00:00
Jacek Kalwas
67befd4756 nvmf: remove min number of admin queue entries from spec file
It was probably miss-interpretation of description from discovery log
page which refers to min admin max sq size.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I575bf7fd6beb904b3a38a07616b76a34f8365643
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1222
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-12 09:04:18 +00:00
Jacek Kalwas
daa8f941e4 nvme: extend ctrlr opts with admin queue size
Align rdma and tcp to respect opts. Reduce default number of entries
for admin queue so it becomes memory optimization.

Linux driver by default creates admin queue with 32 depth, there is no
good reason to enlarge that queue by default within SPDK NVMe driver.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I97ceea8f350c52313021a63190fb0980f604c48e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1110
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2020-03-12 09:04:18 +00:00
Shuhei Matsumoto
ea863bb0b3 lib/event: Count number of threads per reactor
Add thread_count to struct spdk_reactor to count number of threads
per reactor. This number will be used in the next patch to know
if all threads are idle or not for each reactor to support CPU
power saving.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4f7cc5a6b78d85e9f8d0b539c60058c13e282759
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1169
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-03-12 09:04:02 +00:00
Shuhei Matsumoto
fbb77a56c8 lib/event: Factor out the main polling loop from _spdk_reactor_run()
It was too difficult for us to add unit test for _spdk_reactor_run()
because the main polling loop in _spdk_reactor_run() was infinite
if g_reactor_state is SPDK_REACTOR_STATE_RUNNING.

Factor out the main polling loop and rusage update in _spdk_reactor_run()
into a helper function reactor_run().

This improves the code readability as well.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia26db14f44026fefd696443227c16d2be4166832
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1186
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-03-12 09:04:02 +00:00
Shuhei Matsumoto
68161ffc00 lib/event: Put period for getrusage() into struct spdk_reactor
This is a preparation to the next patch which factors out the main
polling loop of _spdk_reactor_run() into a helper function reactor_run().

One of the subsequent patches will support CPU power saving by
adding sleep into reactor_run(). We should not insert sleep between
the main polling loop and getrusage() because now is got before
entering the main polling loop.

To put getrusage() into reactor_run(), we need to maintain last_rusage
in struct spdk_reactor and maintain g_rusage_period as a global
variable. This patch does these changes.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I61bf50de6a170ac73c8fe17e85077b90171dd9c0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1185
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-03-12 09:04:02 +00:00
Wojciech Malikowski
e0294b002d test/ftl: Prevent from trying to kill same process twice
ftl fio tests should not kill spdk_tgt process on exit.

Change-Id: I541e84002202a5f01bd5a2dffe31a60e02da30e9
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1179
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-12 09:03:47 +00:00
Michal Berger
5a7649559b configure: Use uname for system name check
On FreeBSD, the value that $OSTYPE returns may differ, depending on
which user owns the shell.

To be consistent, use uname call instead as it should always return
the same value ("FreeBSD" in this case).

Change-Id: I2edd221b63ac4bff0ee722cbce6ee6e8a5823e7a
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1230
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-12 09:03:38 +00:00
Liu Xiaodong
f2bfad5908 scripts/common.sh: print error msg to stderr
Error msg in common.sh should be printed into stderr
in order to avoid improper usage.

For example:
  If env has no lspci and pciconf, then function
iter_all_pci_class_code will return the error msg back,
every word in error msg will be used by caller wrongly.

Change-Id: I6a875e49527539ba82bd331c8878e972e26cbc39
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1227
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-12 09:03:33 +00:00
Jim Harris
328a221299 dpdk: move submodule to commit 3fcb1dd
This adds recent commit:
  contigmem: cleanup properly when load fails

Fixes issue #1262.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4d873af280803c3cc6c146439a0bbc7af4c7296c

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1217
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-12 09:02:58 +00:00
Jim Harris
330ab40f7d spdk.spec: fix typo
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9751386c699eaf2310ca57441820837198206a60

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1221
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-12 09:02:50 +00:00
Jim Harris
9d21a317dd spdk.spec: remove python2 references
The spec file was originally created when SPDK Python
scripts still worked with python2.  That changed
several releases ago.  So remove python2 references
from the spec file to indicate that SPDK scripts
only work with python3.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I413c684772e6cb45dedca8977c2c784a55026a35
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1219
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-12 09:02:50 +00:00
Changpeng Liu
555e186a93 nvme/opal: using opal_start_generic_session() directly
It's more straight forward to call opal_start_generic_session() directly in
different scenarios.  It will help us to use stack variable "prev_data" to
store temporary key during the session, which is more safe.

Change-Id: I70b9190ed3606cd5e26c23319aca82d4a38596cc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1191
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:36:08 +00:00
Changpeng Liu
f55717c34e nvme/opal: remove the flush operation before each OPAL method
It's not an error to send a security receive command before each
real OPAL related commands, but we don't need to do it.

Change-Id: I7628988df6ac097264db2137440f63db9e6e3660
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1127
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:36:08 +00:00
Changpeng Liu
0cd8b2927e nvme/opal: move maximum password size definition to opal_spec.h
The macro is defined by the spec, so place this value to where
it should belong.

Change-Id: I23f91662fd4ab279aa4285212fc8cbd2ed42245b
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1126
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:36:08 +00:00
Changpeng Liu
e5bb2b6232 nvme/opal: remove unnecessary Method Status Error codes
Althrough the spec defines the Method Status Error Code, but here the return
value is just from function uses the normal errno, such as ERANGE, so just
remove them.

Change-Id: I43be95f62a4e465090462743b91246b1d63e2acd
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1125
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:36:08 +00:00
Changpeng Liu
fbfb3aca28 nvme/opal: don't use ComPacket header to check level 0 discovery response
According to the TCG Storage Core Architecture V2.0, the level 0 discovery
response should use level 0 discovery header and feature descriptors to
retrieve the response data buffer.  ComPacket header should be used in upper
layer.

Change-Id: I61e3e206801994b276608f9afbda800eccb2cffa
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1124
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:36:08 +00:00
Changpeng Liu
c61b70c3d5 nvme/opal: rename spdk_opal_init_dev() and spdk_opal_close() with construct/destruct suffix
Since the OPAL here is just for NVMe device, so we don't need to use dev_handler as common
handler, just rename it to spdk_nvme_ctrlr.  And we don't exit the initialization if
OPAL construnction had a failure.  Also move the timeout initialization to construct().

Change-Id: I11f0aea961eaa3da0c6253eb03d0227f7e7e5f11
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1101
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-03-11 11:36:08 +00:00
Changpeng Liu
01ddd1120a nvme/opal: refactor level 0 discovery data structures
No actual logic change except re-define some data structures.

Change-Id: Id0a483071591beee675cbc3ef368ac1fb723cfe0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1099
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-11 11:36:08 +00:00
Changpeng Liu
80ec5489ae opal_spec: optimize level 0 discovery data structure definition
Also uses ComPacket header to check the received data, no actual
function changes.

Change-Id: I905fc6b8bb4656d48d43ff4ff8d1f705b9b595b9
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1074
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-11 11:36:08 +00:00
Karol Latecki
996248fd86 test/iscsi_tgt: do not silently skip rbd.sh tests
Remove if/exit steps from rbd.sh and move the condition
to parent script iscsi_tgt.sh.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I86c9c659e0f8b4f544296e2ef8a861b25fd4f424
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1081
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-03-11 11:35:33 +00:00
Richael Zhuang
325010bf91 configure: check nasm only on x86
For other architectures like arm64 don't depend on nasm package
when using isa-l or crypto. Limit the check to x86.

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: I8ee1a711fc76c25a9173853dbb075dffe7df056b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1208
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-03-11 11:35:16 +00:00
Darek Stojaczyk
817e91b7ce test/lvol: use rpc daemon throughout all lvol tests
$ time ./test/lvol/lvol2.sh

Without rpc daemon (before):
real    0m52.195s
user    1m29.316s
sys     0m7.660s

With rpc daemon (now):
real    0m12.452s
user    0m13.505s
sys     0m3.798s

Note we only have about a half of lvol tests ported to bash atm,
so this time difference would only grow.

Change-Id: I28ec0b92f19e0c7fd48392a72f32535c1106b8be
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1058
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-11 11:35:03 +00:00
Darek Stojaczyk
8b98cdb64a scripts/rpc.py: add daemon mode
Add rpc_cmd() bash command that sends rpc command to an
rpc.py instance permanently running in background.
This makes sending RPC commands even 17 times faster.

We make use of bash coprocesses - a builtin bash feature
that allow starting background processes with stdin and
stdout connected to pipes. rpc.py will block trying to
read stdin, effectively being always "ready" to read
an RPC command.

The background rpc.py is started with a new --server flag
that's described as:

> Start listening on stdin, parse each line as a regular
> rpc.py execution and create a separate connection for each command.
> Each command's output ends with either **STATUS=0 if the
> command succeeded or **STATUS=1 if it failed.
> --server is meant to be used in conjunction with bash
> coproc, where stdin and stdout are named pipes and can be
> used as a faster way to send RPC commands.

As a part of this patch I'm attaching a sample test
that runs the following rpc commands first with the regular
rpc.py, then the new rpc_cmd() function.

```
time {
        bdevs=$($rpc bdev_get_bdevs)
        [ "$(jq length <<< "$bdevs")" == "0" ]

        malloc=$($rpc bdev_malloc_create 8 512)
        bdevs=$($rpc bdev_get_bdevs)
        [ "$(jq length <<< "$bdevs")" == "1" ]

        $rpc bdev_passthru_create -b "$malloc" -p Passthru0
        bdevs=$($rpc bdev_get_bdevs)
        [ "$(jq length <<< "$bdevs")" == "2" ]

        $rpc bdev_passthru_delete Passthru0
        $rpc bdev_malloc_delete $malloc
        bdevs=$($rpc bdev_get_bdevs)
        [ "$(jq length <<< "$bdevs")" == "0" ]
}
```

Regular rpc.py:
```
real    0m1.477s
user    0m1.289s
sys     0m0.139s
```

rpc_cmd():
```
real    0m0.085s
user    0m0.025s
sys     0m0.006s
```

autotest_common.sh will now spawn an rpc.py daemon if
it's not running yet, and it will offer rpc_cmd() function
to quickly send RPC commands. If the command is invalid or
SPDK returns with error, the bash function will return
a non-zero code and may trigger ERR trap just like a regular
rpc.py instance.

Pipes have major advantage over e.g. unix domain sockets - the pipes
will be automatically closed once the owner process exits.
This means we can create a named pipe in autotest_common.sh,
open it, then start rpc.py in background and never worry
about it again - it will be closed automatically once the
test exits. It doesn't even matter if the test is executed
manually in isolation, or as a part of the entire autotest.

(check_so_deps.sh needs to be modified not to wait for *all*
background processes to finish, but just the ones it started)

Change-Id: If0ded961b7fef3af3837b44532300dee8b5b4663
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/621
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-11 11:35:03 +00:00
Tomasz Zawadzki
aba9841212 ut/blob: add setup/clean for blob creation
Added new setup/cleanup functions for a suite of
unit tests that use a particular blob through out the
tests.

This simplifies the contents of particular UTs,
and brings forward focus of each UT.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib7d69b90fcbe8e6a0ba303475fcbaeb90fa110a7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/945
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
104d4c0a57 ut/blob: add blob deletion at the end of UT
Some of the unit tests were only closing a blob,
without deleting it at the end of unit tests.
This is valid behaviour, but to later simplify
the setup/cleanup - a delete blob was added.

This change was made to unit tests where,
it was not focus of particular UT.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I7e338ba6fcb63af26658e8968971a6d56f70807b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1203
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
cc991aad61 ut/blob: simplify blob closing and deletion
Operation of closing and deleting a blob is common
throughout the tests.

This patch creates helper function ut_blob_close_and_delete(),
to do exactly that with the right asserts.
Throughout the UT this function replaces all instances where
blob is closed and deleted, when it is not the subject of
particular unit test (focus is on other functionality).

It will allow to later use it in setup/cleanup functions
for UT suite - similar to bs init.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ic56594da8cd4c442b62890d62961b44771059679
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1202
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
5df4f50f76 ut/blob: simplify blob creation and opening
Operation of creating a blob (with or w/o opts),
then opening it through out the tests is quite common.

This patch creates helper function ut_blob_create_and_open(),
to do exactly that with the right asserts.
Throughout the UT this function replaces all instances where
blob is created and opened, when it is not the subject of
particular unit test (focus is on other functionality).

It will allow to later use it in setup/cleanup functions
for UT suite - similar to bs init.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia541b855d154503f824bfa3909bcfeac649c5853
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1201
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
95ebed3c9e ut/blob: always use local blobid
Always call API on blobid that was received from blob
create, instead of relying on global one.

Where necessary added declaration and assignment.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I3529b4d5e86c1301bb64268029a57873f9f600cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/944
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
114da5a203 ut/blob: always use local blob pointer
Always call API on pointer that was received from blob
open, instead of relying on global one.

Where necessary added declaration and assignment.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I15531111201d071c471f5be79ce18ff508631677
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/943
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
25a01035d2 ut/blob: put setup/clean of tests into common function
A lot of unit tests require only creation of a blobstore
then unload it at the end.
This code can be made common and invoked automatically by
CUnit with CU_add_suite_with_setup_and_teardown().
Those functions are called before and after each test in suite.

This should simplify the unit tests by removing the common
code.

Following patches will add further suites with different
setup/cleanup to reduce common code even more.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I984cde2381f4461e188e06050355024a88ebfca9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/932
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
935fbcdf5c ut/blob: do not clear g_bs in helper functions
Next patch in series adds setup/cleanup functions
that use g_bs for its operation.

Particular unit tests should not leave the g_bs
unassigned, if cleanup is supposed to unload it.
It applies to helper functions to reload/dirty_load.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6e022b6c762981c2c70ebf31f4981a17f54f3591
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1182
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
a9f76ed204 ut/blob: Do not initialize default bs opts
Some of the unit tests initalized bs opts,
event if they were left unmodified.

There is no need to perform this operation,
as spdk_bs_init() can accept NULL as bs_opts parameter
to just initialize default values.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Iacea1fa9d53796b8c359b611092cc63c6bce4094
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1181
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
606ba0c321 test/build: add test directory to scanbuild verification
scanbuild_make verifies if all files in repository were
scanned by scanbuild. 'test' directory was not part of this
check, even though it contains C files with applications
used during tests.

This change does not affect what gets, and what does not
scanned by scanbuild. Only what we verify that was.
It will help to spot any files accidentally skipped.

This patch adds 'test' directory to the check.
Along with skipping directories when not compiled with:
- Functional tests disabled - don't check 'test', but still check 'test/unit'
- Unit tests disabled - don't check 'test/unit'

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I01e16de83827022c412a57df379280bfed671797
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1212
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
79c28aa698 test/build: disable compiling unused components in tests
This patch decreases the compile time when particular test
category is not executed by tests.

Added skipping the 'examples' dir during verification
of scanbuild scanned files. Only when examples were not
compiled.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I41e7b9d18913fd02e2b6cbe44f933ab2e0371d28
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1172
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-03-11 11:34:55 +00:00
Ziye Yang
9ba4bb22fe lib/nvme_tcp: get the max_sges from the nvme ctrlr.
Add the error print if there is still remaining_size in
order to provide more meaningful debug info.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I7b15c9c9a630ea7ecb2d3191b73c9c99f7febf31
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1189
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-03-11 02:25:12 +00:00
Shuhei Matsumoto
5feebd8528 lib/thread: Assert if spdk_thread_send_msg fails in API
Add assert to prevent degradation from these improvement for
thread management.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1e32fbda3b861c9f49d023c905bdce7411cb46d3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/838
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-10 09:13:02 +00:00
Shuhei Matsumoto
49cffc1e68 rpc: Add thread_get_io_channels RPC
Add an new JSON RPC thread_get_io_channels to retrieve IO channels
of the threads. IO channel don't have its own name and so get the
name of the corresponding IO device instead.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id8fbb328ffba09e1eace35994cdbf36b24832b82
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/887
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-03-10 09:13:02 +00:00
Darek Stojaczyk
8e05b15c11 thread: remove io_channel.h public header
It's been unoficially deprecated since SPDK 18.07,
let's remove it now.

Change-Id: I2471097cac6da3dd011959b903dd270b95cd480e
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1104
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2020-03-10 09:12:53 +00:00
paul luse
4a9f28a482 test/bdevperf: prevent overlaping w/r/v operations
There was no sync between the start of a w/r/v operation at
a specific block with the previous completion.  This resulted
in data miscompares either because the initial Q depth was
sized such that a disk wrap need to occur to complete it or in
the event that an IO takes longer to complete than when bdevperf
loops back around to that offset.

Fixes #1208

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ifa55da54246735e7b603fafd34718965b0f27b94
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1180
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-03-10 09:12:46 +00:00
paul luse
d688779dc8 bdevperf: add some prints on verify error
To provide some more clues when this happens.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I098aaea906a1057e63f07c40a1ebb346a283983d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1070
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-03-10 09:12:46 +00:00
Shuhei Matsumoto
36274df5ae bdevperf: Create and terminate io_target group threads explicitly
At startup, use number of created io_target groups to detect completion
and move to the next step. By returning completion message to the
master thread, we can avoid using any atomic operation.

At shutdown, we can use spdk_for_each_channel() conveniently. Put
voluntary spdk_thread_exit() calls into the callback to
spdk_put_io_channel().

To maintain the original behavior, number of threads created is
equal to the number of cores that SPDK app uses.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I92ca4b1c1e8da0f45b47367bc2387701f4a9742f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/890
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2020-03-10 09:12:38 +00:00
Shuhei Matsumoto
e58b96f928 bdevperf: Use spdk_for_each_channel() for performance_dump()
Output performance dump per SPDK thread by using
spdk_for_each_channel(). This change is safe even when shutdown
case because spdk_for_each_channel() is serialized if it is
called on the same thread.

Keep lcore information because it is still valuable to know which
lcore each thread ran on for.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I996a4ca2c787d04672743b09a9415145cd8d0171
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/645
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-03-10 09:12:38 +00:00