Compare commits

...

716 Commits

Author SHA1 Message Date
Jacek Kalwas
96a91684d3 build: fix missing dependency for env_dpdk
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I414a7bdb63990df6ae411b8b03f055b9ffecd41f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9014
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-08-13 07:11:17 +00:00
Tomasz Zawadzki
2b616cdb36 version: 21.07.1 pre
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ic14155aade0e1b0712acb089e8460265317b3d68
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8976
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
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>
2021-07-30 10:53:52 +00:00
Tomasz Zawadzki
adeb049688 SPDK 21.07
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia8bb2dd6c6476e3bb412577e0d7eb3bd31e45f60
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8975
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-30 07:44:28 +00:00
Karol Latecki
7003e83097 scripts: remove gdb from Python requirements file
This package is no longer available in PyPI.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8956 (master)

(cherry picked from commit 84867c8eaf)
Change-Id: I3e68b03eabeb4aff14453c90846fd03452c93ae2
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8980
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-30 07:05:52 +00:00
Karol Latecki
631592f928 autobuild.sh: Update DPDK 21.05 patches
93c4adda4d did not take
DPDK 21.05 release into consideration.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8835 (master)

(cherry picked from commit 95a59652f9)
Change-Id: I9cc6a0fb7cb600d6ad08fc9eca1cbcd5e3c25d14
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8958
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-28 16:19:45 +00:00
Michal Berger
98060549d3 pkgdep/git: Patch refspdk repos
36b5a69bb0 "trace: fix the snprintf warning issue"
2ac1521581 "test/compress: fix Wstringop-overflow warnings"

These patches are needed to make sure SPDK's refs can be compiled
under GCC 11 (e.g. fedora34).

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8790 (master)

(cherry picked from commit d19ead1f76)
Change-Id: I7e3800351b02506c99ba8ac7f4d40312867e1ab9
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8948
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-28 06:57:57 +00:00
Ben Walker
26e8bc2ea1 nvmf: In zcopy, delay setting req->data until end of start operation
The data buffer isn't available at the beginning.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8932 (master)

(cherry picked from commit fb1ace6700)
Change-Id: Ieeb1a297ff52dfdc6cd999d04862a0cd96483650
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8947
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-28 06:57:57 +00:00
Ben Walker
b4fec8dc03 nvmf: Add commit parameter to zcopy end operation
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8931 (master)

(cherry picked from commit 1d6adfb09c)
Change-Id: I2803c806d623f345ce462b7fe1b7c02223008d9d
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8946
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-28 06:57:57 +00:00
Wu, Mengjin
6d687fea6d lib/nbd: hot remove will be correctly handled
BUG FIX: call nbd_bdev_hot_remove will stuck if
it is called when nbd has in-flight IOs.

nbd_bdev_hot_remove is asynchronous. It will
guarantee the stop of this nbd.

nbd hot remove test will be added later

Signed-off-by: MengjinWu <mengjin.wu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8039 (master)

(cherry picked from commit cc0d05b427)
Change-Id: I0a0dfab31fafd3d61212ade53c74ad05dbbff268
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8929
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-27 07:43:56 +00:00
Michal Berger
83b160e741 pkgdep/git: Update ice driver to the latest release 1.6.4
This is done since previous version is not compiling anymore under
latest fedora33.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8916 (master)

(cherry picked from commit ea03551716)
Change-Id: I8f65d5e47af81f01221eb8699c3323c3f8099f38
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8928
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-27 07:43:56 +00:00
paul Luse
f1fbe87ace Revert "idxd: Remove the batch_op field because it is not necessary."
This reverts commit 585e808e06.

Signed-off-by: paul Luse <paul.e.luse@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8908 (master)

(cherry picked from commit 74dd24851d)
Change-Id: I578d248d490c27a5806c5a77fb241a15ba85a530
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8927
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-27 07:43:56 +00:00
Alexey Marchuk
ec1b78dbd7 socket: Remove deprecated enable_zerocopy_send
This parameter is still part of API spdk_sock_impl_opts
structure but it is not used. Keep it to support ABI
compatibility since it is located in the middle of the
structure and removing it may break socket opts initialization
or parsing.

Change-Id: Ib641ad7d965d68bc9ebb65dba531408d88cf6fa1
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8914
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-23 10:30:25 +00:00
matthewb
5818b42fce lib/nvmf : Added support for ZCOPY
Implemented nvmf code to allow transports to use ZCOPY. Note ZCOPY
has to be enabled within the individual transport layer

Signed-off-by: matthewb <matthew.burbridge@hpe.com>
Change-Id: I273b3d4ab44d882c916ac39e821505e1f4211ded
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6817
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-23 08:34:43 +00:00
Ziye Yang
5a169179be uring: fix the assert issue.
Revise the if case to avoid the assert issue.

Change-Id: I095f3d111423e17abaa1f951fe22efb3d2e851b7
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8872
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-23 07:10:48 +00:00
Tomasz Zawadzki
250b2ba025 dpdk: update DPDK submodule with changes on spdk-21.05 branch
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I8f8861be66afbe99f9d0de440b9bb76c2176ee3f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8906
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-23 07:10:03 +00:00
Tomasz Zawadzki
29b3da96ba socket: removed deprecated zerocopy RPC options
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I748c3f008a6ba1b969acecdd593940077800091b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8900
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-23 07:10:03 +00:00
Tomasz Zawadzki
c97eb5ecd1 lib/nvmf: removed deprecated stats API
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6e89e7a6b723745517cee077facad134692044d3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8899
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-23 07:10:03 +00:00
Tomasz Zawadzki
0ac1bd07b8 rpm: remove deprecated pkg/spdk.spec
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I04972b5408abd1a8ac813e591e836e8db2876bcc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8898
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-23 07:10:03 +00:00
Tomasz Zawadzki
e0e716651e CHANGELOG: added new changes since SPDK 21.04
Added new entries missing from CHANGELOG.
Net library was removed so deprecation.md was modified.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I062149129aaf854b3038d1ab5291eb5e56ff35b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8897
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-23 07:10:03 +00:00
Tomasz Zawadzki
8595ff7bbc CHANGELOG: sort and format existing entries for 21.07
Sorted current entries and typo/formatting errors in
preparation for SPDK 21.07.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I108ef6ffb65a4f3bc713696c5f2d4ef8903d192a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8896
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-23 07:10:03 +00:00
Krzysztof Karas
821d8e26a6 spdk_top: add sorting to get_pollers_data()
Modified get_pollers_data() function to use already sorted
poller array across spdk_top.
Modified related display functions and sort_pollers() to
accomodate the change.

Deleted prepare_poller_data() and copy_pollers().

Modified show_poller() to use a single entry from pollers
array instead of all of them.

Modified refresh_pollers_tab() to handle changing
number of entries in a different manner.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I26936fbc96e7cb598a33b2fe4354b03277d88061
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8638
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-23 07:09:52 +00:00
Krzysztof Karas
c3e625ba2b spdk_top: create local poller structure to fill with RPC data
Create local structs to fill with RPC data, sort and then
copy into a global poller array inside get_pollers_data().

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I545392cbdc699e4d96f1d39611a6e694e209c25d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8234
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-23 07:09:52 +00:00
Krzysztof Karas
d55eb1af28 spdk_top: move prepare_poller_data(), copy_pollers(), sort_poller(),
get_last_run_counter() and get_last_busy_counter() upwards

Moves these functions above get_pollers_data() for use in next patch.

Moves enum sort_type to the section with struct definitions.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I795c02a660e987f5e9689dab07f14479d1026d99
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8057
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-23 07:09:52 +00:00
Krzysztof Karas
96e7dd3d65 spdk_top: refactor cores RPC functions and reduce number of cores structures
This patch aims to reduce number of core structures.

All related functions that use global core structures are reworked.
Part of code with poller and thread counter per core is moved to
data gathering function.

Additionally deletes double newline between functions.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I31034e5d889fe24b067a407ca348ba07c58ce6b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8565
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-23 07:09:52 +00:00
WindYu
49ffdc18af bdev/nvme: Add support to get the health log for NVMe device
Add a new RPC method to get the health log of a certain NVMe
device.

Below is the example:

./scripts/rpc.py bdev_nvme_get_controller_health_info -c Nvme0
{
  "model_number": "INTEL SSDPE2KX020T8",
  "serial_number": "BTLJ72430ARH2P0BGN",
  "firmware_revision": "VDV10110",
  "traddr": "0000:08:00.0",
  "temperature_celsius": 33,
  "available_spare_percentage": 99,
  "available_spare_threshold_percentage": 10,
  "percentage_used_percentage": 2,
  "data_units_read": 1013408619,
  "data_units_written": 346792685,
  "host_read_commands": 30457773264,
  "host_write_commands": 18949677715,
  "controller_busy_time": 4979,
  "power_cycles": 49,
  "power_on_hours": 31114,
  "unsafe_shutdowns": 18,
  "media_errors": 17,
  "num_err_log_entries": 19,
  "warning_temperature_time_minutes": 0,
  "critical_composite_temperature_time_minutes": 0
}

Change-Id: I53125d2ec16cb36011571473430aece99167b803
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8806
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-07-22 13:46:50 +00:00
WindYu
2d629511f5 json: add the spdk_json_write_uint128 function
Add the paired spdk_json_write_named_uint128 function

Change-Id: I222f0c5076efe150ab2861c0d915d18476815e37
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8797
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-07-22 13:46:50 +00:00
Ziye Yang
585e808e06 idxd: Remove the batch_op field because it is not necessary.
This batch_op field is not necessary because we can
use the comp_ctx->desc->opcode to judge whether it is related
a batched task or not.

Change-Id: Id329221ccf272c4c3bb8c1b5ec08433029a9a1f8
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8865
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-07-22 13:28:39 +00:00
Michal Berger
e3410dd586 test/vhost: Make sure only Mellanox NICs are used for vhost tests
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ia616fa7411496628cd79e13474b6e0b96979480a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8895
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-22 13:21:01 +00:00
Michal Berger
c9e23c2b34 Revert "test/vhost: Don't use nvmftestinit() in vhost tests"
This reverts commit 5e03beae70.

As it happens, Soft-RoCE is not capable of handling all the test cases
in the vhost suite.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Iccbbe3a7314cc68bb4feca700fa6d943c961bd2b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8894
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-22 13:21:01 +00:00
wawryk
a42ccffa0a test/nvme: Always enable performance cpu governor in NVMe performance tests
Signed-off-by: wawryk <maciejx.wawryk@intel.com>
Change-Id: I2ef9bd23b545ea51e9e3f4b2b55189a2423707d4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8547
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-21 19:45:02 +00:00
wawryk
cb19173375 scripts/nvmf: configure adq traffic classes before configuring target
Signed-off-by: wawryk <maciejx.wawryk@intel.com>
Change-Id: Ibb2c943b555ce4304ff0244af16cc93ab53482cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8837
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-21 19:44:13 +00:00
Jonathan Teh
153f03cf42 bdev/nvme: Add bdev_nvme_reset_controller rpc
Implement bdev_nvme_reset_controller rpc, which allows the NVMe
controller to be reset over RPC. Implement bdev_nvme_reset_rpc()
which starts the reset of the controller and returns the result of
the controller reset via the callback function after it completes.

Signed-off-by: Jonathan Teh <jonathan.teh@mayadata.io>
Change-Id: Id98d5e56feb315b7e44e9bb5e5f495e9b1cd1de0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8456
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-21 07:45:38 +00:00
Jonathan Teh
3c6b670df4 bdev/nvme: Switch to spdk_nvme_ctrlr_reset_async
In bdev_nvme_reset_ctrlr(), get a controller reset context and start
a poller that calls spdk_nvme_ctrlr_reset_poll_async() to perform the
controller reset asynchronously.

Signed-off-by: Jonathan Teh <jonathan.teh@mayadata.io>
Change-Id: I1e3ae42291c3b43b69c99ca56997dc1965c3ac59
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8454
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-21 07:45:38 +00:00
Jonathan Teh
ac24039da3 nvme: Add spdk_nvme_ctrlr_reset_async
Implement an async variant of spdk_nvme_ctrlr_reset(). This initial
implementation only allocates a context and returns it to the caller,
relying on the caller to poll the context to execute the existing
spdk_nvme_ctrlr_reset() implementation.

Wire up spdk_nvme_ctrlr_reset() to use this async variant to verify
that NVMe controller reset still works.

Signed-off-by: Jonathan Teh <jonathan.teh@mayadata.io>
Change-Id: I75d4b75dbf5897db452ee65286aef5a4eb839fca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8330
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-21 07:45:38 +00:00
Krzysztof Karas
a40a081d20 spdk_top: reduce number of core structures and refactor core functions
Merge core_info into rpc_core_info to increase readability.

Delete g_cores_history to reduce number of cores structures in spdk_top.

Add temporary cores structure to get_cores_data() to fill with
data from RPC call. This is to allow fields last_busy and last_idle
in g_cores_stats.cores.core_info structure to retain their values
and assign new ones with each data_thread_routine() loop.

Change core display across spdk_top accordingly (change places
where g_cores_history was used to use g_cores_stats instead)

Delete get_core_last_stats(), because it is called only in one
place and can be replaced with direct assignment of two values.

Delete last_page variable from refresh_cores_tab.
That variable was used to decide which core entries to update,
and since we collect and update data for all entries elsewhere,
this is not needed anymore.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I4a5a4c90098401876b214068725a8fce29766a12
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6449
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-21 07:27:32 +00:00
Krzysztof Karas
254496fc95 spdk_top: reduce number of thread structures and refactor related RPC functions
This patch aims to reduce memory needed to run spdk_top by removing some
of thread data structures and also to rework thread RPC functions.

Related functions that use thread structures for data gathering and
display will be modfied to accomodate new changes.

free_rpc_threads_stats() will be removed, because we now allocate
memory on stack instead of heap and manually freeing is no longer
needed.

Deleted last_page variable in refresh_threads(), because it was
not used.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I73c30637b26434dad7ea55a9866887b1988166b1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8533
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-21 07:27:32 +00:00
Krzysztof Karas
fc41cd7b99 spdk_top: fix unchanging poller state
Poller state does not change back from Busy to Idle after it
has finished its work and this patch aims to resolve that issue.

Added a field in poller history to store last busy_count of each
poller for later comparisons with current values.

Added a function to get last busy count of a poller.

Modified related display functions.

Fixes #2037

Change-Id: I214e41133eaf90b0f1d7995a53e577a7c1c5d33e
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8755
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-21 07:27:32 +00:00
Krzysztof Karas
a599e69b58 spdk_top: change return type of get_last_run_counter()
New pollers did not have a corresponding run_counter_history entry
when displaying data for the first time after they were created.
If user enabled g_interval_data and observed the creation of the poller,
application crashed due to get_last_run_counter() returning NULL pointer.

Fixes #1995

For new pollers there is no historical data and current last_run_counter,
matches the expected last_run_counter for displayed spdk_top interval.
get_last_run_counter() now returns 0 when matching run_counter_history is
missing. Avoiding dereference of a NULL pointer.

While here modified copy_pollers() to no longer get and store the last run counter
twice. When doing reset_last_counter only storing the new last run counter is needed.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I5218c9ac0f2f79da32840cf64b4083642893f5cc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8683
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-07-21 07:27:32 +00:00
Krzysztof Karas
dddd28bedc spdk_top: refactor RPC decoders for pollers and reduce poller structs number
This patch aims to reduce memory usage by deleting chain of poller structs
that depend on each other.

Reworked RPC related functions to use only one poller structure.

Reworked prepare_poller_data() and copy_pollers() to accomodate new change.

Changed display functions, which use poller data.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I0252f93e47fec6a3298f07463aebd495697274bf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8519
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-21 07:27:32 +00:00
Krzysztof Karas
775173fdd9 spdk_top: delete core_num variable
Deletes core num variable inside refresh_cores_tab,
because it is used only in one place.

Change-Id: Ie10a7b53487da507cb8d0babab6d00eb2f9412ca
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8715
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-07-21 07:27:32 +00:00
Krzysztof Karas
e230f8e9e6 spdk_top: fix sorting in threads tab
Currently spdk_top retains selected thread sorting for one application
loop only, because it is performed before all assignment operations are
done.
This is a problem when 'sort by core' is selected, because threads are
sorted before core assignment happens.
This patch aims to resolve that issue.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Ide6d025d5e4e31a8fda713703a822e976468f326
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8629
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-07-21 07:27:32 +00:00
Ben Walker
d673fcee3d test: Fix missing comma in app_ut.c
Caught by clang 12.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ibed23c3aab80508aebf06e4ba44e14e385a3256b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8854
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-07-21 07:27:04 +00:00
Michal Berger
1963d3185c pkgdep/freebsd: Use globbing to match on package names
Some packages include versioning in their name which is not very
friendly in case given package is upgraded - the name of the package
will always change in such a case. To avoid that, use globbing to
match on package names in a more robust way.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I3e23fc8a06f93471f47835e945c24c4a95f80795
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8741
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-20 08:09:36 +00:00
Krishna Kanth Reddy
4e885f5aa2 include/spdk: NVMe spec header changes for Boot Partition Read / Write support
Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: I86209e24bdfb2388dae31fb68033a6208e518a7b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8630
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-07-20 08:09:27 +00:00
wawryk
a26d602844 test/pkgdep: install ice driver as root
Signed-off-by: wawryk <maciejx.wawryk@intel.com>
Change-Id: Ib61100342a4d29b4ce737f6fe01c60d8dba18e1d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8592
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@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>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-07-20 08:09:15 +00:00
Pawel Piatek
d7aa681b6b test/nvme_perf: add main core parameter
For Test Case 2: SPDK NVMe BDEV I/O Cores Scaling
we need to specify DPDK main (primary) core.

Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: I53d706c4173e16035a3883c29547659a0c7a22fc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8553
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-20 08:09:05 +00:00
wawryk
a3d0f42889 test/vhost: Always enable performance cpu governor in Vhost performance tests
Signed-off-by: wawryk <maciejx.wawryk@intel.com>
Change-Id: Id0c1217b1c7138e7c618d816948ca34ba8a09be6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8543
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-20 08:08:05 +00:00
Michal Berger
d2b415bc86 autotest: Don't mark pmr tests as skipped
New job was added to the CI (nvme-cmb-pmr-vg-autotest) which brings
PMR|CMB functionality under qemu 6.0.0. Since these tests are now
being executed they should not be considered for skipping.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ib09336a85da2955d63e28834779042c672823cde
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8704
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-20 07:59:43 +00:00
Michal Berger
0b55bf715e test/nvme: Add basic test covering cmb_copy functionality
Change-Id: I083ce9560c37b0f0bd39c9dce3cf97e4038b5e31
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2006
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-20 07:59:43 +00:00
Michal Berger
5e03beae70 test/vhost: Don't use nvmftestinit() in vhost tests
For now this function is not working very well in case it finds E810
cards (we do have some installed across CI pool) as we don't have
proper irdma driver in place.

Instead, and since it shouldn't be relevant for vhost tests, enable
soft-RoCE devices and use them (or any other rdma-capable NIC that
ip is going to be allocated on) during the vhost migration tests.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I4e8cc7b8eea3ce91684d8a68d0a0e11b8d1e4b9b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8750
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-07-20 07:59:31 +00:00
Michal Berger
8b19bc2383 autotest: Add source and line number to PS4 prompt
Trace details are written out only when test fails, but sometimes
it's hard to determine from which script and what particular line
given command is being executed during the actual runtime of the
test. This should make it a bit easier. The log lines would look
like this:

-- common/autotest_common.sh@1217 -- # uname -s

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Iac6973f986e6c553f39e5a9c909ccabf607251f7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8756
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-20 07:59:31 +00:00
Karol Latecki
8dace9e26c scripts/nvmf_perf: reuse get_connected_nvme_list()
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I1ccc18e9a025faea87ef4328bd79be7c3574ebf6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8743
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
2021-07-20 07:59:18 +00:00
Karol Latecki
0574f36dea scripts/nvmf_perf: improve error handling
Add exceptions to results parsing and fio run functions
to better inform what's the cause of the failure.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I94e51cb8f77515f7d26a75501011d6111820ae56
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8742
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-20 07:59:18 +00:00
wawryk
2c8baa4685 scripts/nvmf: add io_uring engine option for Kernel Initiator
Enable "kernel_engine" option for Kernel Initiator
class to enable ability to use io_uring engine on
initiator side.

For NVMe-oF this has limitations as apparently it's
not possible to enable polling on the initiator side,
which in turn makes fio "hipri" option also not
possible to use.

Adding #TODO sections with notes in case this is
later fixed in Kernel NVMe driver.

Signed-off-by: wawryk <maciejx.wawryk@intel.com>
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I31da52946692015237263abc77d8425b5eae5b98
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8134
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-20 07:59:18 +00:00
Ziye Yang
03323b09a4 nvme/ctrlr: Fix the invalid access of free_io_qids array.
To fix the segment fault.

Fixes issue #1749

Reported by user: https://github.com/rdxsasha
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I130d8dba04e4a3e83c22c5967507c1297a048f0b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8813
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-20 07:59:08 +00:00
Changpeng Liu
111851efbb nvmf/vfio-user: several code cleanup
Change-Id: Iba94148599c8b82827f38a7b9badc1b13713031e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8814
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
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: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-20 07:58:55 +00:00
Changpeng Liu
64b6b8e30f nvmf/vfio-user: optimize the special AER completion
When the QP is set to INACTIVE state, we always unmap the QP's
address to NULL, we can just check the address is valid or
not before posting completion response, so there is no need
to do the special process for the aborted AERs.

Change-Id: I1dc9893e04810e9a15e1eeb4d9405b775eab38d7
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8803
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
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: Ziye Yang <ziye.yang@intel.com>
2021-07-20 07:58:55 +00:00
Changpeng Liu
cbafa31abc nvmf/vfio-user: enable/disable/shutdown controller same manner as the NVMf library
We should use the diff bits to decide the action to CC.

Change-Id: I08cf6f65711f86328825dcd9e204ed79766c59fe
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8802
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.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>
2021-07-20 07:58:55 +00:00
Changpeng Liu
7195aaa44c nvmf/vfio-user: handle Delete IO CQ command correctly
Similar with Create IO SQ command, we should also defer the completion
of Delete IO CQ command until the IO QP is disconnected finally.  However,
since the NVMf library will disconnect/free the queue pair finally, we
can't use the queue pair data structure to save the context, so define
a delete_cq context for Delete IO CQ command.

Change-Id: I005ad86c2af59540323205e9e928a2d573d5c448
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8796
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
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>
2021-07-20 07:58:55 +00:00
Changpeng Liu
0d0524b9e0 nvmf/vfio-user: handle Create IO SQ command correctly
The NVMf library doesn't process Create IO SQ command, so for
this command we will use a fabric connection command instead,
however, the fabric connect command is called asynchronously,
so we need to defer the completion for Create IO SQ command after
fabric connect command is completed.

Fix issue #2043.

Change-Id: Id8c71ca69fb750a3ffb0fb26b54fa8b6d87e8ff4
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8786
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-20 07:58:55 +00:00
Changpeng Liu
9bcafecb01 nvmf/vfio-user: set endpoint's controller pointer to NULL
We can set endpoint's controller pointer to NULL before free_ctrlr, as
controller is a session in vfio-user, while endpoint is related with
Unix Domain socket.

Change-Id: If6d26c7522804029f8c2425bc478df9e2d53d32a
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7966
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-19 13:50:55 +00:00
Changpeng Liu
684410026b nvmf/vfio-user: free controller if no connected qpair
The VM may already delete all queue pairs and just leave the
socket when killing VM, so we can check number of connected
queue pairs here, if no connected queue pairs, free the
controller immediately.

It's an optimization so that we don't need to loop all
queue pairs below.

Change-Id: Ia1be868ce2c74ce6953b1f44a81b51d605e642f0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7625
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-19 13:50:55 +00:00
wawryk
7cb301c042 scripts/nvmf: replace deprecated enable_zerocopy_send by enable_zerocopy_send_server
Signed-off-by: wawryk <maciejx.wawryk@intel.com>
Change-Id: I98ee388059e522946f4111ab4c414208c8a68daf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8798
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-19 13:50:40 +00:00
Jim Harris
0c64044400 test: add connect_stress test
This new connect_stress application connects to a
specified subsystem, creates some IO qpairs and
reads the CSTS register.  It goes through this loop
over and over again until the specified time expires.

The connect_stress.sh test script runs this application,
and then while it is running does continuous add_ns and
remove_ns RPCs.

This stresses nvmf handling of connect (admin + I/O) as
well as get_property commands.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8ab5156045cf5614f74988e38a9d37db96d7d5b9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8572
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-19 13:50:29 +00:00
Evgeniy Kochetov
2716eb02f1 rpc: Fix disable_zerocopy_send_server in sock_impl_set_options
Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com>
Change-Id: I27cfa20c59383e5689dd1795f1737b1676c1bb12
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8799
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-19 08:05:43 +00:00
Tomasz Zawadzki
8e649e83b2 lib/event: remove get/enable/disable turbo API from governor
In rte_power all that enabling/disabling turbo does is allows
for additional entry in frequency array for particular core.

Instead of exposing this API through spdk governor,
just make sure that dpdk_governor enables turbo by default.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I994b326a57c01889bccea26635753c56637259d2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8789
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-19 08:05:19 +00:00
Tomasz Zawadzki
12fcf7e1d5 lib/event: remove get/set_core_freqs API from governor
Those calls went unused, in favor or much more useful
up/down/min/max variants.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I432896196a1a6edfc6799c8658df49567f73d457
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8788
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-19 08:05:19 +00:00
Tomasz Zawadzki
7bf66ff5ac lib/event: remove fields from spdk_governor_capabilities
The spdk_governor_capabilities added lots of capabilities
which went unused, suposedly to mark which callbacks
a governor had implemented.

This made little sense, since capabilities are per core and
not implmenting this APIs made little sense.
With this patch spdk_governor_capabilities is brought in
line with rte_power_core_capabilities.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I85296fce2999cb41957162b63ee13d86a0be919f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8787
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-19 08:05:19 +00:00
Krzysztof Karas
ae74e70eff lib/event: remove _spdk_scheduler_disable()
Remove _spdk_scheduler_disable() to avoid confusion as there is
no spdk_scheduler_enable function. Since spdk_scheduler_disable
sets scheduler period to 0, use spdk_scheduler_period_set(0) instead.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I4f1390a635f80e8b92775aa4be2e37f5b95467f8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7448
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-19 08:05:19 +00:00
Tomasz Zawadzki
fba4a97dec lib/event: refactor managing core_info thread allocation
The size of the core_info->threads will always be equal
to reactor thread_count, there is no need to count it
separately.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Icfa84606bd29d7766738eb2053362a20d78c23af
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8733
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-19 08:05:19 +00:00
Tomasz Zawadzki
cf155f23b0 lib/event: refactor _reactors_scheduler_update_core_mode()
Replaced multiple functions calls to _reactors_scheduler_update_core_mode(),
with a for loop.

Since changing reactor to interrupt mode is rare operation, most of the
time we ended up with unnecessarily long callstack.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1c7858653be9e2256943c1da5a27001be41682b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8714
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-07-19 08:05:19 +00:00
Tomasz Zawadzki
cff96883fc lib/event: remove is_scheduling flag from reactor
There is only one g_scheduling_reactor (main core), the is_scheduling
flag for it is used to block starting new gather_metrics before
previous one is finished.

Meanwhile is_scheduling flag on other reactors was used to block
destroying lw_threads while scheduling happens. It was only needed
because scheduler interacted with the same lw_thread pointers as
each reactor. Previous patch removed this dependency, instead
spdk_thread ids is used. If an spdk_thread is destroyed,
while scheduling _threads_reschedule_thread() handles it.

It is no longer required to block destruction of lw_threads
based on this flag.

Instead of using the main core reactor flag, a g_scheduling_in_progress
is introduced.

Removed _spdk_get_scheduling_reactor() and instead shared the value
of g_scheduling_in_progress between reactor.c and app.c.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ica57326a552477add522174cc3e96b3bab918350
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8732
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-19 08:05:19 +00:00
Tomasz Zawadzki
b74b6133fa lib/event: remove scheduler dependency on lw_thread
Removing dependency on schedulers to directly modify
lw_thread field structures will help making schedulers
truly plugable.

Instead of using lw_thread, new structure is created
that holds copy of stats and refer to the thread by
spdk_thread id.

As an added benefit of not changing lw_thread directly,
we won't run into issue of balancing function changing it
while other reactor removes and frees it.

In the future an API will be added for scheduler to call
in order to move the thread directly. Rather than for
event framework to rely on modified core_info/thread_info
structure.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I8f85bb8dc080fd13b78b07ee9ef8e8be7051659b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8411
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-19 08:05:19 +00:00
Tomasz Zawadzki
012b233426 ut/reactor: implement stub for _spdk_get_app_thread()
Functions that set reactor interrupt mode were not tested
since _spdk_get_app_thread() always returned NULL and
implementation did not verify the RC.

This patch will return a thread from scheduling reactor
as the app thread. Which is not exact, but otherwise
a new app thread would have to be added to each UT.

spdk_reactor_set_interrupt_mode() requires the completion to
be executed on app_thread. Added the poll of that thread
to make sure it gets drained.

Since now the UT actually executes the code path,
additional 4 events will be processed.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I0793e6dcc41c447dc11ed8ab28eb9041c5d82628
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8409
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-07-19 08:05:19 +00:00
Tomasz Zawadzki
a3aa222a39 ut/reactor: consolidate polling for all events
Scheduler and governor tests polled events till completion,
but depended on exact number of events and repeated those
calls multiple times.

This patch adds _run_events_till_completion() which will
run all events scheduled, until there are no more to process.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Iab3af2e031510b095ddfcc93d2320bbdc7d84aeb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8408
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-19 08:05:19 +00:00
Michal Berger
e52df268d3 test/scheduler: Check if load on all working CPUs is under 80%
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I89e31aceb7037c55801f4b7cbd4126bce38ae174
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7566
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-07-19 08:05:19 +00:00
Michal Berger
d841e24b21 test/scheduler: Add tests covering new load balancing functionality
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia7b075711192189918d9fb1b186b907814a12430
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7450
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-07-19 08:05:19 +00:00
Tomasz Zawadzki
d47b0d2d7d test/scheduler: remove unnecessary assignments of thread names
The "threadX_name" variables are not used anywhere except
creating the thread. Instead use the names directly.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6bdb2eb1d1e96fe888a4d5d9765fc0b0dfa74272
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8794
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-07-19 08:05:19 +00:00
Tomasz Zawadzki
66a5b406cb scheduler_dynamic: lower the idle thread limit
Limit of 50% to mark thread as active or idle
didn't allow for multiple active threads to be placed
on single core.

Lowering the limit to 20% will allow that and force
more threads to be actively balanced.

Removing the limit was considered, but that would
cause too much thread moves when a thread with load
in single digits increased briefly. Either
due to actually doing any operation or placement
of other threads on the same core.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I5f8c9ff15461feb71a2d82853cfe048e412ba921
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8289
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-07-19 08:05:19 +00:00
Tomasz Zawadzki
68063cd8b6 lib/blob: force md update during decouple parent
Fixes #1933

When decoupling parent the updated parent_id was
not persisted to the blob if it was a snapshot.
Due to having md_ro set to true, blob_set_xattr()
failed.

Later on the incorrect parent_id could cause troubles
like in the github issue, when deleting that snapshot.

This patch adds return code check for blob_set_xattr
and forces md_ro to false during blob md sync.

Since some of code paths are shared between decouple,
inflate and clone operations, the final callback for them
is doing revert of the original md_ro.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If017455f72e4d809fe533d9f986e5ae6bb8e2035
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8420
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-16 23:25:45 +00:00
Michal Berger
7478e053e1 test/scheduler: Don't use extra time while waiting for idle cpus
It's not needed anymore since we pick up now last idle sample in
comparision to remaining states given cpu spent time in. This way
we get the faster view if in given moment cpu is busy or not.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I3677c03ee3c2e42662df35dd0a6e7b5b6b1f98ed
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7565
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-07-16 07:14:47 +00:00
Michal Berger
330e9f779c test/scheduler: Commonize collect_cpu_idle()
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I72da312e0d7fe71ae40b582501b52be615de4b63
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7564
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-16 07:14:47 +00:00
Michal Berger
0ea8956025 test/scheduler: Add function for calculating cpu load
This is done in order to detect cpu times in a more deterministic
fashion.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I005d6fececdc15500bcf637e96f2fbecbd4273f1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7563
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-16 07:14:47 +00:00
Liu Xiaodong
413808e155 app/trace: assert history ptr
This is just assert to assure the Klocwork
static analizer that ptr is not NULL.

Change-Id: I458af194991fb1874fb7d32db55513a1f66408c0
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8745
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-16 07:13:44 +00:00
Wu, Mengjin
e5c3791c4e lib/nbd: Process NBD_CMD_DISC according to the NBD protocol
After this patch, nbd will no longer receive any requests if
NBD_CMD_DISC is received. But it will handle the  requests
already received.

Previously we called spdk_bdev_abort() for NBD_CMD_DISC and
it will reply to the rest requests in the channel of this bdev.

But there should be no reply to NBD_CMD_DISC. Hence we silently
discards requests after NBD_CMD_DISC.

Signed-off-by: MengjinWu <mengjin.wu@intel.com>
Change-Id: I551dea1887cb2d108ed5e0d621309f62cfaabbb9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8038
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
2021-07-16 07:13:19 +00:00
Mao Jiang
0d1c7bf852 test/nvmf/tcp: cases for qpair memory resource initialization
Change-Id: I255a045e1684d5f36028ec53de63c68505af894f
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8751
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-07-16 07:13:02 +00:00
Changpeng Liu
d8843dccc5 nvmf/reservation: register new registrant when IEKEY is enabled
The specification says:
"A host may replace its reservation key without regard to its registration
status or current reservation key value by setting the Ignore Existing Key
(IEKEY) bit to '1' in the Reservation Register command."

So for this case we treat it as a new registrant, also add UT to cover
the added cases.

Change-Id: I5990f15da36706063a35565d110ed4c6eb30a3f3
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8024
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-16 07:12:48 +00:00
Changpeng Liu
814cd25882 nvmf: optimize log level for unsupported feature IDs and invalid property offset
Since we are using NVMf fabric library to emulate a PCIe based SSD via
vfio-user target, so there maybe some commands that are related with
PCIe SSD only, such as set/get features with interrupt coalescing
and Interrupt Mask Set/Interrupt Mask Clear registers.  Even the
NVMf library doesn't support that, it is not a fatal error to Host
NVMe driver, so here we use the info log instead of error log for
this case so that to avoid noise logs.

Fix #2036.

Change-Id: I8283bcde5779080835d6ab827dbd852b3816176f
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8766
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-16 07:12:10 +00:00
Changpeng Liu
3eed8456d9 nvmf: support get_features with Interrupt Coalescing and Interrupt Vector Configuration
The NVMf library will not implement interrupt coalescing and ignore them, but we can
report this via get_features.

Some OS may check the result from get_features so that it will not send set_features
for interrupt coalescing.

Change-Id: I7466bcbc0ea5b3b067751cdf1979b2e0681c0043
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8765
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-16 07:12:10 +00:00
Jiewei Ke
df559ab6e0 thread: speed up io_channel lookup by using rbtree
Use the macros for red black tree provided by Free BSD to speed up
io_channel lookup.

Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Change-Id: Icfd87a8a2f60c082a17b8c501a03faba83edb762
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7895
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
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: GangCao <gang.cao@intel.com>
2021-07-16 07:11:53 +00:00
Jiewei Ke
e45450d28f thread: spdk_get_io_channel() use i->dev as the search key
In current implementation, io_channel list will be accessed by
spdk_for_each_channel() and spdk_get_io_channel(). We will try to
accelerate spdk_get_io_channel() in the following change "thread: speed
up io_channel lookup by using rbtree" by changing io_channel from list
into RB tree.

To make it cleaner, we prefer to use ch->dev as the key for the
io_channel RB tree instead of ch->dev->io_device. This patch makes
spdk_for_each_channel() use the i->dev to find the expected io_channel.
And the io_device in structure spdk_io_channel_iter is not needed in
spdk_for_each_channel_continue() but we keep it for the compatibility of
spdk_io_channel_iter_get_io_device().

After this patch, spdk_for_each_channel() has to access both io_device
list and io_channel list, and spdk_for_each_channel_continue() still has
to access only io_channel list.

Both io_device list and io_channel list will become RB tree. Hence
performance degradation will be negligible. spdk_for_each_channel() is
not so performance critical than spdk_get_io_channel().

Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Change-Id: Idd486b0aa1b63b57ede90527dcd1631cbb008a1a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8749
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
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>
2021-07-16 07:11:53 +00:00
Jiewei Ke
281a7c2a15 test/unit/lib/nvmf: register target io device for test_spdk_nvmf_ns_event
In test_spdk_nvmf_ns_event, when doing ns resize it will call
spdk_for_each_channel() to pause the subsystem. But it doesn't call
spdk_io_device_register() in advance. This is wrong and may run into
assertion with the coming change since the io_device is not found.

Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Change-Id: I077b41f812266248c39fdbdb8cdff352d3b4cb74
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8767
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>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-16 07:11:53 +00:00
Jiewei Ke
49c6afbf12 thread: speed up io_device lookup by using rbtree
Use the macros for red black tree provided by Free BSD to speed up
io_device lookup.

This change was reverted once but is re-submitted because the critical
issue was fixed by the preceding patches.

In addition to the fix, add unit tests to verify the fix explicitly.

Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I97ed77f6e5ceacdf2593c9751b55a7d0b92c0b35
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8525
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
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>
2021-07-16 07:11:53 +00:00
Pawel Piatek
93c4adda4d autobuild: Update patches for mainline DPDK
Patch f95e331be3a1f856b816948990dd2afc67ea4020 is no longer needed,
since it was solved at upstream level.

Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: Icf064b121351566988c26390f45286e7a456ca39
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8698
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-16 00:33:37 +00:00
paul luse
f95bd3b6c7 lib/idxd: change how we complete batch desc
Previously we used a counter of our own to make sure all batch
elements plus the batch itself were done before we freed the batch.
This was due to some observations early on that the batch desc
could complete before the individual elements and a lack of clarity
as to whether this was due to the simulator or the fact that
we poll on completions and could therefore "see" completions in
a different order at that time (we were using bit arrays to poll).

Now we use an ordered (in time) list to poll locations so if we
instead put the elements on the list first and then the batch desc
itself we are assured to always "see" them in order provided the
underlying device meets spec which there's no reason to assume it
does not.

This simplifies things a bit at the same time and still assures
that we call list calbacks in order and then the batch callback
without "special" handling.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I4d9e3997786f2116ce6515682b8117799c645f51
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8397
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-15 21:04:08 +00:00
paul Luse
91cab3414c lib/idxd: remove casts that are no longer needed
Left over from when the field was a void *

Signed-off-by: paul Luse <paul.e.luse@intel.com>
Change-Id: If9dfe2878f6afd6137d6d8efec90e310baf417f1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8280
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-07-15 21:04:08 +00:00
paul luse
a738acd505 examples/accel_perf: use local task element for CRC destination
For all CRC related functions.  Does not need to be DMA'able memory
as DSA returns the CRC to it's completion record and the lib
copies it to this address.  Done for consistency as this element
was added as part of adding the copy+CRC API.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Iefedcbc0a1c4e211eeb8aaf5c52f2881e9173bad
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8230
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-07-15 21:04:08 +00:00
paul luse
96d4c7a36d lib/accel: have accel and idxd engine use task->crc_dst
For clarity, this element was added when crc+copy API was
added so might as well have all the CRC related functions use
it instead of `dst` to avoid confusion.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ic43adbd0df51c1a349847701ef318f452306d0b3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8229
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-07-15 21:04:08 +00:00
paul luse
2f3f5ec556 lib/accel: name crc function param for consistency
We've always used `dst` as the destination for CRC result, with
the recent addition of a copy_CRC API `dst` was needed for the
copy destination and `crc_dst` was used for the CRC.  This
patch just makes all the CRC functions use `crc_dst` to avoid
confusion.  The accel_task struct also has a `crc_dst1 field,
that will be used consistently in the next patch.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ia84c4a9e7940c6ebd31410c12272bd22b0c6dd29
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8228
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
2021-07-15 21:04:08 +00:00
paul luse
221eb3f4dd examples/accel_perf: add support for copy_crc commands
For COPY+CRC operations, we allocate a destination buffer for each
task that's big enough to hold the copied input data for all stages
of the chain. For example, if the operation is 4 stages of 4K input
buffers, the destination will be 16K in size.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Id32a98c1dbada2881a8423c050e892d5c37bf6cc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8204
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-15 21:04:08 +00:00
paul luse
71f0600c5b lib/accel: add support for crc32 with copy using source IOVs
Support in accel_perf is coming up in a later patch.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I63a1d3b9b1a3254fdca78e27c473b9b3468c93c8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8202
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-15 21:04:08 +00:00
paul luse
b4f302e525 lib/idxd: rotate portal offset with each submission
Allows for better performance by not hitting the same portal
address with every submission.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I1ec8eae6f3acec9e98161029cd5406ec08603aa6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8190
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>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-15 21:04:08 +00:00
Shuhei Matsumoto
320ab72fb5 util: Add macro SPDK_SIZEOF_MEMBER to get size of a member of a struct
We find a few files to get the size of a member of a struct. How to
do it is a little complex. So add a macro to do it will be helpful
to read the current code and develop new features.

lib/dif had used member_size() internally but Linux use sizeof_member()
as the macro. Besides, SPDK have used upper case letters for similar
macros, SPDK_CONTAINEROF() and SPDK_COUNTOF(). Hence spdk_member_size()
may be good but propose SPDK_SIZEOF_MEMBER() as the macro.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2179c845a3b75fb71aa039075cc4dfd30617b898
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8738
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-07-15 07:16:22 +00:00
GangCao
e8cd34ae9f App: update the usage function for the core list usage
In this case, user could specify the core number like:

-m [0,1,10] besides the core mask like -m 0xF

Change-Id: I48621c5a84e5436deae07101591d0ef85b1e129e
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8746
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-15 07:16:16 +00:00
MengjinWu
da2fd6651a lib/nbd: fix conflict between nbd start and stop
Now nbd stop will not be processed if this nbd is not fully started.
However, it will remember the stop command and do it asychronously
until nbd is fully started.

Signed-off-by: MengjinWu <mengjin.wu@intel.com>
Change-Id: Iea5ba143332c7d3fd85f816726788f05e7ae3c8d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8037
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-07-14 10:02:35 +00:00
Konrad Sztyber
970e2e2e18 nvme: free completed aers on shutdown
If there are completed asynchronous events that have not been notified
to the user, free them during controller shutdown to avoid memory leaks.
It can happen if an event completes before user has a chance to execute
`spdk_nvme_ctrlr_process_admin_completions()`.

Fixes #2032.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ie608bf9100342f8dfd709e070326f67335d27fed
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8740
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-14 09:44:43 +00:00
Shuhei Matsumoto
d2d1899b90 bdev/nvme: Create nvme_bdev_channel for nvme_bdev
Create a single nvme_bdev_channel for each nvme_bdev and each SPDK
thread. nvme_bdev_channel has a pair of nvme_ns and nvme_ctrlr_channel.

The pair of nvme_ns and nvme_ctrlr_channel will be aggregated by
nvme_ns_channel in the following patches.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I095a2d6afa4ea23a87e4452b2f9d4c7e0087abe0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6605
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-07-14 09:15:59 +00:00
Shuhei Matsumoto
f6b19841da example/nvme_identify: Fix the bug that assumed ANA descriptor is 8-bytes aligned
This is the same fix as done for lib/nvme.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9ca5e1ea9dbdba45b51b311e9a36f278b1b62770
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8437
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-14 09:15:59 +00:00
Shuhei Matsumoto
e0715c2a6b nvme: Add a new option disable_read_ana_log_page to struct spdk_nvme_ctrlr_opts
NVMe bdev module manages ANA log page itself now. So NVMe driver
should disable managing ANA log page.

Add a new option disable_read_ana_log_page to struct spdk_nvme_ctrlr_opts.
Then NVMe bdev module enables it when calling spdk_nvme_connect_async().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id5249efe90a4d50763c3a7eaa1eb9572f60fbc8c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8313
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-14 09:15:59 +00:00
Shuhei Matsumoto
a066f0c3fb nvme: Fix the bug that assumed ANA group descriptor is 8-bytes aligned
This fix is as same as for NVMe bdev module.

If a ANA log page has two or more ANA group descriptors, the second
or later of ANA group descriptors will not be 8-bytes aligned.
Then runtime error would occur as follows:

runtime error: member access within misaligned address 0x612000000074
for type 'const struct spdk_nvme_ana_group_descriptor', which requires
8 byte alignment

nvmf_get_ana_log_page() in lib/nvmf/ctrlr.c creates a ANA log page
data and processes 8 bytes alignment correctly because we got the
same runtime error before. However, lib/nvme had been missed at that
time.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Idaa610544dc5cb659c387fcd38a2b4b97cbd06e5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8398
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-07-14 09:15:59 +00:00
Shuhei Matsumoto
793119f08c nvme: Initialize ns->ana_state when constructing ns before checking if ANA is supported
The next patch will add an new controller option, disable_read_ana_log_page.
Initializing ns->ana_state to optimized before reading ANA log page
will simplify the next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I34e56a2b454e4c02e1899f972e0ad675f2ebe2a2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8312
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-14 09:15:59 +00:00
Shuhei Matsumoto
072f2d0011 bdev/nvme: Update ANA log page it self when ANA change event is notified
When ANA change event is notified, increment reference count, read
ANA log page, and parse it to update ANA states of namespaces.

Then remove the spdk_nvme_ns_get_ana_state() call and its stub in
unit tests.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I254ae6cb993694bf0d7f4fa4b1039b5f9243b5cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8335
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-14 09:15:59 +00:00
Shuhei Matsumoto
7ec6d1d559 bdev/nvme: Read ANA log page itself when nvme_ctrlr is created
If ctrlr supports ANA log page, nvme_ctrlr allocates a buffer for ANA
log page and read ANA log page itself, and then each nvme_ns sets its
ANA state by parsing ANA log page.

Most code was brought from NVMe driver because NVMe driver already
supports ANA log page management. However it had a bug that assumed
each descriptor is 8-bytes aligned. Fix the bug together in this
patch. Besides, the implementation in NVMe driver was synchronous.
NVMe bdev module reads ANA log page asynchronously instead.

The next patch will support ANA log page update by AER handler.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib8eab887633b043b394a45702037859414b8e0a0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8318
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-14 09:15:59 +00:00
Matt Dumm
fa44df3627 test/nvme: A simple test confirming we can change nvme timeout settings via rpc
Signed-off-by: Matt Dumm <matt.dumm@hpe.com>
Change-Id: I1ceb90864eaef9ae131fe7ed13f3ed20384af1b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8352
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-14 09:15:20 +00:00
Matt Dumm
67fbfdd8af nvme: rpc interface updates to manage 'timeout_admin_us' value
Signed-off-by: Matt Dumm <matt.dumm@hpe.com>
Change-Id: Ib97371924e56275ba9b845725d1d42682fd0f94a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8163
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-14 09:15:20 +00:00
Matt Dumm
5288c4df83 nvme: separate admin timeout vs. io timeout
Signed-off-by: Matt Dumm <matt.dumm@hpe.com>
Change-Id: Ia1f105fdf154aae034ccfca2f0dc3b4c43c9fc84
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8072
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-07-14 09:15:20 +00:00
Karol Latecki
a6e45885a0 doc: add entry for 21.04 NVMe Bdev performance report
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I54093bef0fc34947dce161bacee7a75721ff937f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8712
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-14 09:12:15 +00:00
Ziye Yang
e5d5b3ebef idxd/rpc: Revise the rpc function to use kernel or user driver
This patch is used to add the support for users to configure
use kernel or userspace idxd library.

Change-Id: Ie159b897bc9595894ad8f333168efaea6c2a3d78
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7332
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 17:22:30 +00:00
Ziye Yang
2ed914f8ea idxd: Add the kernel idxd support
This patch is used to add the kernel idxd support.

Without this patch, we can use userspace idxd driver
under accel_engine library (module/accel/idxd/accel_engine).
With this patch, we can also kernel idxd driver under the
accel_engine library.

Our approach is implementing a wrapper library to use IDXD
device by leveraging the kernel DSA driver in SPDK idxd library
(lib/idxd).

Then users can leverage the RPC later to configure how to
use the DSA device by user space driver or kernel driver.

In this patch, our approach is to use the idxd-config library
to export the WQs (Working Queues) exported by the kernel.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I3a25a4fe0327bd626bf6883dfbe54437d3209e51
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7331
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-07-13 17:22:30 +00:00
Changpeng Liu
870a606960 nvme: map PRP and SGL lists RO
There is no need to map the PRP/SGL list RW since this memory is never written
to. In fact, SeaBIOS might submit a request where the PRP list resides on
read-only memory, so attempting to map it RW can break things.

Change-Id: I7e4e90b1fa7e33e81b8d5cd8dcb9568c038938ec
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7288
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>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-13 16:53:42 +00:00
Changpeng Liu
1b28efb510 UT/nvmf/vfio-user: restore nvme_cmd_map UT in nvmf/vfio-user
Change-Id: Ibce4d8921e2d33c8120ee3de8e7654f6676fe2fc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8575
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-13 16:53:42 +00:00
Changpeng Liu
695425c776 nvme: move spdk_nvme_map_cmd to nvmf/vfio-user
Nvmf/vfio-user uses this API to map NVMe command sent from
VM from Guest Physical Address to Host Virtual Address, so
now we moved this API from the nvme library to nvmf/vfio-user
as an internal API.

UT code will be added back in coming patch.

Change-Id: I54817fc9811ccd9ddd97b3aa6762a2fce4bbdda6
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8574
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-13 16:53:42 +00:00
Ziye Yang
467f16bf7d uring: Use low level list ops to improve the performance when reorder the list.
This patch is used to improve the performance when
we need to reorder the list.

PS: Bring the similar operations from posix implementation.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I7031b35ddb597730ee160690e8ab9caf9b2b64b7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8675
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 09:08:15 +00:00
GangCao
bd4aec1cd5 nvmf: add an assert for the obtained sgroup
Change-Id: Ie00137083143722e9df50fa5a8e4d37000dfe29c
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8739
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-13 09:07:39 +00:00
Maciej Szwed
599303624e nvme: Fix remove event processing bug
This patch fixes bug introduced by this patch:
59237d22b8

lib/nvme/nvme_pcie.c:
ctrlr->remove_cb(ctrlr->cb_ctx, ctrlr) (line 147) -> ctrlr->remove_cb(cb_ctx, ctrlr) (line 123)

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I84c56aa7480fd597287f4935a583983eb96bc422
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8705
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 09:07:23 +00:00
Ziye Yang
13eb8f2fb3 idxd: Replace the read_8 function pointer with another one
Just remove this function pointer and add a new one,i.e.,
dump_sw_error.

Because this function pointer is only used to
read a sw err info. We can hide it in the detailed
idxd implemenation.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I42fe2220dae85df307b5af64e37acfd7f748915b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8707
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
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: Changpeng Liu <changpeng.liu@intel.com>
2021-07-13 09:06:15 +00:00
ChengqiangMeng
2f5abdb7fd unittest/nvmf: test for nvmf_rdma_update_ibv_state
test nvmf_rdma_update_ibv_state of nvmf/rdma.c

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: Ia9c172f799577eddd7a5949ee3d51d1a682d76f8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8724
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: <dongx.yi@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-07-13 09:01:14 +00:00
Pawel Piatek
2f0fdf0e48 scripts/nvmf_perf: support for arguments
Support for command line arguments.
This commit will add following ones:
* Configuration file
* Results directory
* CSV results filename
* Usage

Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: I7166c792661b2fc7ed3b5547f2c3b8faad4e86b8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8594
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-13 09:00:24 +00:00
Pawel Piatek
99465fbd3a scripts/nvmf_perf: remove unused variables
Fix some of pylint W0612 and W0613 findings.

Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: I34e72bf1e07787689025756c6ddf429711cd250b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8593
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-07-13 09:00:24 +00:00
Michal Berger
ca0339d8e5 nvme_cuse: Return ENOTTY in case unsupported ioctl is sent to a device
Latest nvme-cli (>= 1.13) fails to issue commands towards SPDK's cuse
ctrl device, e.g.:

$ nvme get-feature /dev/spdk/nvme0 -f 1 -s 1 -l 100
nvme_cuse.c: 654:cuse_ctrlr_ioctl: *ERROR*: Unsupported IOCTL 0x4E40.
get-namespace-id: Invalid argument

The reason is because nvme-cli now also sends NVME_IOCTL_ID to the
target device to determine if it's indeed a controller or a ns. In
case kernel returns ENOTTY then nvme-cli considers the device to be
a controller. Since cuse_ctrlr_ioctl() returns EINVAL in such a case
the nvme-cli fails.

To avoid this simply replace EINVAL with ENOTTY for the ioctls that
may be not supported by ctrl or ns device.

nvme-cli commit in question:
fa2b91da74

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I29003864bc2a5c1a8906d6d01beba3d6f4e31b0e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8531
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-13 09:00:05 +00:00
Michal Berger
aa303d87aa pkgdep/git: Disable array-bounds error while building qemu
gcc 11 started to complain about this condition. Ignore it.

Spotted under fedora34.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I472e5e88a30feaacc7ea96d5787544f49eaceb16
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8530
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-13 09:00:05 +00:00
Ziye Yang
9a0bd78b43 interrupt_tgt: Fix the interrupt mode usage issue.
When the application is not set with the interrupt mode,
we should fail the rpc.

Fixes issue #2023

Change-Id: I4157f220948b7c96f474682c41ac9d78977b1c40
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8676
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
2021-07-13 08:59:41 +00:00
Krishna Kanth Reddy
78ecd30d8e Fix Rocksdb db_bench build's Linker issue.
Linker throws undefined references to spdk_app_start, spdk_app_stop,
spdk_app_start_shutdown, spdk_app_fini, spdk_event_allocate,
spdk_app_opts_init and spdk_event_call.

Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: I05da1b9d94ac40127b4f0e80d8a8e406f279d3bb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8677
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-07-13 08:59:24 +00:00
Nick Connolly
e7da88dd66 app/trace: Use PRIu64 for portability
POSIX defines PRId64/PRIu64/PRIx64 for printing 64-bit values in a
portable way. Replace a reference to %lu to remove the assumption
about the size of a long.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I5696bcdb3add3d8b9d5ea91d9bc50b1dad1fbc95
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8685
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:59:08 +00:00
yidong0635
673afb3074 identify: Fix truncation warning of GCC11.
Fixes issue: #2031.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I67055ad5a42f16f3f927b15cfa8fd4ead2ca8813
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8697
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-13 08:59:00 +00:00
Krishna Kanth Reddy
3a2aa71ee2 ARM64: Cross-Compilation Support
Undefined references to the ncurses library APIs
_nc_panelhook_sp, getmouse, ungetmouse, copywin etc. while
cross-compiling with aarch64-none-linux-gnu/10.2.1 compiler.

Hence putting the libraries in the right link order.

Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: If019744cf6b7bf79c072de57232bcf412d919a2b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8701
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:58:42 +00:00
wanghailiangx
7b9bd8ac2f rpc: update a method create_pmem_pool
The RPC method create_pmem_pool has been changed to bdev_pmem_create_pool.

Change-Id: I8ad1fb98d8e03240a4d982e04e9270cf90e198fc
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8708
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-07-13 08:58:21 +00:00
Ben Walker
e1d06d9954 net: Remove library
Now that we've deprecated the RPCs for a release, we can remove the whole
library.

Change-Id: I0f1a357fcfb3404efac39aa021928841c2f22ff1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4305
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-13 08:57:58 +00:00
Shuhei Matsumoto
1be049b7d4 bdev/nvme: Move up definition of struct nvme_async_probe_ctx in a file
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iac315c3484c23b7e8b9a812d728a15bf1c82dbb7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8591
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
07c2b34ab6 bdev/nvme: Register completion function as a generic callback for reset
bdev_nvme_reset() will be used by JSON RPC and we will have to call
the callback to JSON RPC at bdev_nvme_reset_complete(). To do it
easily, register the current completion function for nvme_bdev_io
in bdev_nvme_reset_complete() into nvme_ctrlr as a generic callback.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie59551dc343215a95bfa5b22f234fc153c9db1b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8589
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
f1c141fcc8 bdev/nvme: Get ctrlr via io_channel_iter_get_io_device() at reset process
nvme_ctrlr will be registered as io_device even when multipath is
supported. Hence while spdk_for_each_channel() is executed in reset
processing, we can get nvme_ctrlr both spdk_io_channel_iter_get_ctx()
and spdk_io_channel_iter_get_io_device(). This duplication is not
necessary. Use spdk_io_channel_iter_get_io_device() and pass NULL
to the context parameter of spdk_for_each_channel() for clarification.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifdbd0af4274081c4be7ab0735eb8bf9ae10e3493
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8588
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
3a243b7f38 bdev/nvme: Inline bdev_nvme_reset_io_complete() into bdev_nvme_reset_complete()
The current nvme_ctrlr will be registered as io_device even when
multipath is supported. Then we do not have to differentiate completion
processing between reset from bdev_io and internal reset. Hence
inline bdev_nvme_reset_io_complete() into bdev_nvme_reset_complete().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ife2c4c93d423da3953174ac860485a6e095a28bd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8587
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
c213f1b452 bdev/nvme: Revert reset_io to bring nvme_bdev_io as context
When we support multipath, reset_io will hold the controller currently
being reset to reset all underlying controllers sequentially.

bdev_nvme_submit_request() basically passes nvme_bdev_io to each I/O
type, and we have a convenient helper function bdev_nvme_io_complete()
which has nvme_bdev_io as a parametetr.

So revert the previous change to bring nvme_bdev_io as context
for reset processing.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I19697e8252505bab519a42889d1a88d967932f22
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8586
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
07df4b0141 bdev/nvme: Rename bdev_nvme_reset() by bdev_nvme_reset_io()
Reset requests from the upper layer will reset the underlying
ctrlrs of a bdev ctrlr but internal reset requests will reset only
the specified ctrlr.

To clarify such difference, rename bdev_nvme_reset() by
bdev_nvme_reset_io() and remove the underscore prefix from
_bdev_nvme_reset() and related functions.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9a2d124f6e2039bfecfdd6599827354d6c373f2e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8492
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
82739d12e5 ut/bdev_nvme: Factor out allocating bdev_io into a helper function
This will reduce the size of the following patches and improve the
readability.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2ff5a10622141466d6a0352b2a6387b1412cfbf8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8641
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
39fdbc95f2 ut/bdev_nvme: Use bdev_nvme_submit_request() for test_pending_reset() case
Create an nvme_bdev by adding namespace to an attached controller,
and use bdev_nvme_submit_request() in the test case test_pending_reset().

This will reduce the size of the following patches and will increase
the test coverage.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifb05952a53949e12562e9be3f6526b0f8ad57696
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8640
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
03332379f0 bdev/nvme: Hold mutex while traversing global ctrlr list
nvme_bdev_first_ctrlr() and nvme_bdev_next_ctrlr() were not possible
to hold mutex correctly, and nvme_ctrlr_get() and nvme_ctrlr_get_by_name()
had not held mutex.

nvme_bdev_first_ctrlr() and nvme_bdev_next_ctrlr() were replaced by
nvme_ctrlr_for_each() in the last patch.

In this patch, add mutex to three helper functions, nvme_ctrlr_get(),
nvme_ctrlr_get_by_name(), and nvme_ctrlr_for_each().

Add mutex to nvme_ctrlr_create() but it will be removed in the
following patches because nvme_ctrlr will be added to not global
ctrlr list but ctrlr list per nvme_bdev_ctrlr.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ife27066d2dcac82db0616b0afeaf68e5705d7da1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8722
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
ca4dfff9e1 bdev/nvme: Replace nvme_bdev_first/next_ctrlr() by nvme_ctrlr_for_each()
Replace two helper functions, nvme_bdev_first_ctrlr() and
nvme_bdev_next_ctrlr() by an new helper function nvme_ctrlr_for_each().

This will make us easier to guard data structure correctly in the
following patches.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibd81286e454fd6127fd150a7d48d8381bd1b89d3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8721
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
4af68eade6 bdev/nvme: Rename nvme_bdev_poll_group by nvme_poll_group
This object aggregates multiple I/O qpairs for their completion
operations and may be a higher layer object. However, the
aggregation is only to poll completions efficiently. Hence if we
follow the new naming rule, nvme_poll_group is better than
nvme_ctrlr_poll_group and nvme_bdev_poll_group, and rename
nvme_bdev_poll_group by nvme_poll_group.

Besides, many functions in NVMe bdev module have a naming rule,
  bdev_nvme + verb + objective
Follow this rule for a few functions related with nvme_poll_group.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5e5cb6001d4a862c2121b7265cbbffe0c2109785
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8720
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
a3dcdc051f bdev/nvme: Rename nvme_bdev_ctrlr by nvme_ctrlr
This object is per I/O path and will be aggregated by an new upper
layer object.

Hence rename nvme_bdev_ctrlr by nvme_ctrlr. Then the following patches
will add nvme_bdev_ctrlr as a different upper layer object.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ieed634447785cc98140b3d49c52a2c753988ece7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8381
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
9e65d3bb35 bdev/nvme: Rename nvme_bdev_ctrlr_trid by nvme_ctrlr_trid
This object is used for failover and per I/O path. A controller may
have multiple of this object. A controller is per path and may be
aggregated by an new object. Hence this object is a lower layer
object.

Based on the new naming rule, rename nvme_bdev_ctrlr_trid by
nvme_ctrlr_trid.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0d5e5812560a6947a0c25af05dea168e8745130e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8380
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
c4626aa486 bdev/nvme: Rename nvme_bdev_ns by nvme_ns
This object will be aggregated by the upper layer object nvme_bdev.
Hence based on the new naming rule, rename nvme_bdev_ns by nvme_ns.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I96a70213b29fb53437acd080a0787ec9f5a6759a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8379
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
c710c9acbe bdev/nvme: Rename nvme_io_path by nvme_ctrlr_channel
We will name the lower level objects starting with nvme_* and the
upper level objects starting with nvme_bdev_*.

This object is a channel per ctrlr and another new channel will be
added on top of this object.

Rename nvme_io_path by nvme_ctrlr_channel based on the new naming rule.

nvme_io_path will be used for a new object which is used to find an
optimal I/O path and to reset multiple ctrlrs sequentially when
multipath is supported.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1d4fa6d4625de3413d629a1ff412e00de12dfaf4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8378
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Shuhei Matsumoto
efbd101b8b nvme: Rename cmic.multi_host by cmic.multi_ctrlr of spdk_nvme_ctrlr_data
Bit 1 in the CMIC of the Identify Controller Data Structure specifies
if the NVM subsystem may have multiple controllers or not.

However, multi_host indicated a particular use case such that the NVM
subsystem is used by multiple hosts.

multi_ctrlr will be more appropriate.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0246096a5cc44721aeff3ff6f96473a2abe11964
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8719
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-07-13 08:57:33 +00:00
Tomasz Zawadzki
798ad0fb16 test/scheduler: reorder checks in interrupt test for debugging
Related to #1950
In the issue, CPU idle time measured from /proc/stats make it
seem like no reactor goes idle.

If true, then it would help for debugging to check stats from reactors.
Their busy/idle time and number of threads on them.

This patch reorders the checks in interrupt test,
to first show reactor stats, then confirm with idle time from
/proc/stats.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia1770833828ef688110473e45ed5998d213059f3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8223
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
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: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-12 21:58:56 +00:00
Tomasz Zawadzki
57a2f03eb6 lib/app: only print cpumask for thread within app core mask
For cases where cpumask for a thread was not set,
all bits were turned on for whole length of cpuset structure.

This resulted in JSON RPC reponses with way too long cpumask
for what is useful.

Now the response is limited to the applications core mask,
as that makes sense so long as number of cores cannot change.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib5cf271d3b219ba679f1abe498516796693a87dd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8288
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-07-12 21:58:56 +00:00
Tomasz Zawadzki
fe2f80961c scheduler_dynamic: start core selection from first core
The round-robin logic is no longer necessary to spread
the threads around the cores. Starting from core other
than first is even counter-productive to bunching up
threads.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I5fcee2bacc2d0b4af26336caf381ed954814d731
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8085
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-12 21:58:56 +00:00
Tomasz Zawadzki
a5999f637a scheduler_dynamic: prioritize lowest lcore id for active threads
Before this patch _find_optimal_core() returned
1) any core that could fit the thread
2) if current core was over the limit, the least busy core
3) current core if no better candidate was found

Combined with _get_next_target_core() round-robining
the first core to consider, resulted in threads being
unnecessarily spread over the cores.

This patch only places threads on lower lcore id,
or when current core is over limit then any core that can fit it.

Next patch will remove round-robin logic to always start with
lowest lcore id.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I54e373d3ca02a5633607d22978305baa1142f8bd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8112
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-07-12 21:58:56 +00:00
Tomasz Zawadzki
d2ed0f45e7 scheduler_dynamic: scale up core load when moving thread
Before this patch the idle time of a core was increased
by the amount of busy time of thread that was moved out.
No assumption was made as to how the remaining threads,
would behave during next scheduling period.

This approach is fine, as over multiple scheduling periods
we'd arrive at a point where threads could do no more work
or all cores would be busy.

Yet this requires multiple scheduling periods to sort out
the threads.
Later in the series core_load will be used to determine,
when to start moving threads out of the core. So changing
this assumption will allow for faster responses to thread load,
at cost of sometimes spreading threads too much briefly.

With this patch, we are assuming that threads remaining
on the core will do proportionally the same amount of work
during next scheduling period.

See an example illustrating the change:

Before moving Thread1
Thread1	Busy 80		Idle 20		Load 80%
Thread2	Busy 60		Idle 40		Load 60%
Core	Busy 140	Idle 60		Load 70%

After moving Thread1 out (original code)
Core	Busy 140-80=60	Idle 60+80=140	Load 30%

After moving Thread1 out (this patch)
Core	Busy 140-80=60	Idle 60-20=40	Load 60%

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1f347983449b2fde476dab360c4df689965ca3ea
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8279
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-07-12 21:58:56 +00:00
Maciej Szwed
97c5373fc7 test/scheduler: make activity of a thread % of time period
So far the test application was mostly used for cases with
single active thread on a core.
Setting activity as percentage of all poller operations worked
fine for those cases.

This patch changes the thread activity to mean percentage of
a set time period.
Which equals to the maximum load a thread will see when being
alone on the core.

Right now g_core_time_period is set to 100ms, and is the
maximum execution time for all threads on a core when
thread activity is set to 100%.
g_timeslice is set to 100us and is the execution time of
single thread poll.

Consider following scenario:

Before the patch
Thread1	Activity 70%	Busy 70		Idle 30	Load 70%
Thread2	Activity 60%	Busy 60		Idle 40	Load 60%
Core			Busy 130	Idle 70	Load 65%

After the patch
Thread1	Activity 70%	Busy 100	Idle 0	Load 100%
Thread2	Activity 60%	Busy 100	Idle 0	Load 100%
Core			Busy 200	Idle 0	Load 100%

Additionally increased period of sleeping from 1us to 100us,
to offset the time needed for additional operations
during thread poll.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I027432db1bea570dd58829eeccf7dd8bb06bf249
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7474
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-12 21:58:56 +00:00
Tomasz Zawadzki
11c9b3960b scheduler_dynamic: move thread to least busy core
In cases when all cores are already doing too much work
to fit a thread, active threads should still be balanced
over all cores.

When current core is overloaded, place the thread
on another that is less busy.

The core limit is set to 95% to catch only ones that are
fully busy.
Decreasing that value would make spreading out the threads
move aggressive.

Changed thread load in one of the unit tests to reflect the
95% limit.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I3b3bc5f7fbd22725441fa811d61446950000cc46
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8113
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-12 21:58:56 +00:00
Shuhei Matsumoto
cf8405fc24 bdev: Hold mutex while removing name from name tree
We had not held mutex while removing bdev name or alias from bdev
name tree for most cases. Fix these in this patch.

spdk_bdev_unregister() already holds g_bdev_mgr.mutex when removing
name, and so we do not need to change it.

spdk_bdev_close() had not held g_bdev_mgr.mutex. What we want to lock
is only when removing name from name tree, that is, calling
bdev_name_del() in bdev_unregister_unsafe(). However, we need to
keep hierarchical lock ordering. Hence get and free g_bdev_mgr.mutex
outside of bdev->internal.mutex.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4e2c8604e27c8603725efa9bc0bee2013eccb2ac
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8527
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
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>
2021-07-12 15:30:39 +00:00
Shuhei Matsumoto
d06f1c498f bdev: Hold mutex when adding bdev name to global bdev name tree
We had not held mutex when adding bdev name to global bdev name tree
in bdev_name_add(). Fix these in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I33813638f11da85263ec0c8849e566d247a45d43
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8524
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-12 15:30:39 +00:00
Shuhei Matsumoto
20ba4a0dbe bdev: bdev_name_add() checks if the name exists in the global name tree
If the specified name already exists in the global bdev name tree,
RB_INSERT() returns a pointer to it. Hence we do not have to call
bdev_get_by_name() when using bdev_name_add().

Hence update bdev_name_add() to return -EEXIST if RB_INSERT() returns
a non-NULL pointer, and then remove the bdev_get_by_name() calls.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2d4554ef7e5286270417def64b638b803eecfca2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8573
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-12 15:30:39 +00:00
Ziye Yang
36b5a69bb0 trace: fix the snprintf warning issue.
The complier complains:

/usr/include/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’
output between 4 and 19 bytes into a destination of size 7
71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,

So we change the array size from 7 to 20, so it is enough to put 19 bytes
in.

Fixes #issue 2014

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I97dfbf9707d0e275382324fa7352b7a212b2aeb5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8694
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-12 14:06:43 +00:00
Michal Berger
6317642ce6 rpmbuild: Handle bare --with-dpdk argument
This is done in order to detect if user wants to build spdk RPMs
against DPDK RPMs that might have been installed on the system.

This boils down to the following:

 - if --with-dpdk, with no argument, is detected don't build
   separate RPM holding DPDK libs since user in this case is
   most likely interested only in packaging the SPDK so it
   can coexist with separate DPDK packaging workflow
 - define install and build requirements for the SPDK RPMs
   to depend on dpdk-devel RPM

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I4dd587009da282a114524c74d833fd35ebc5b985
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8349
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-12 14:05:20 +00:00
Michal Berger
68b6d0ef54 test/openstack: Enable securitygroup driver in neutron
This seems to be needed for devstack pieced together out of the
current master branch (wallaby seems to work fine as is).

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I5abf22a606c84c120e42819a5450ba82d1bc52b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8490
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-09 19:19:48 +00:00
Michal Berger
8770e80bda scripts/rpc_http_proxy: Print to stdout POSTed json rpc calls and responses
It's useful to determine what's being sent out to the server. This
may be relevant for e.g. openstack tests where currently it's hard
to see what tempest|cinder is actually doing, SPDK-wise, during the
tests.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ie32781621317dd65e3f6fbcfd5110e7dac337f04
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8489
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-09 19:19:48 +00:00
Ziye Yang
cd1261ae00 trace: fix compiler complain on two variables
In the nightly test, the compiler complains:

trace.c: In function ‘_spdk_trace_record’:
00:07:12.523  trace.c:144:53: error: ‘argval’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
00:07:12.523       memcpy(&buffer->data[offset], (uint8_t *)argval + argoff,
00:07:12.523                                                       ^
00:07:12.523  trace.c:145:36: error: ‘arglen’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
00:07:12.523              spdk_min(curlen, arglen - argoff));

And this patch is provided to fix such issue.

Fixes #issue 2034

Change-Id: I4c78d63bdc6a7d166990ae1d18a6abf183efdee1
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8709
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Chengqiang Meng <chengqiangx.meng@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-09 19:19:24 +00:00
Konrad Sztyber
4ee3f1bccf usdt: don't emit probes in unit tests
There is no point in producing USDT probes in unit tests and it breaks
the build on some systems:

ctrlr_discovery_ut.o(.note.stapsdt+0x14): error: relocation refers to local symbol "" [102], which is defined in a discarded section
ctrlr_discovery_ut.o(.note.stapsdt+0x90): error: relocation refers to local symbol "" [108], which is defined in a discarded section
ctrlr_discovery_ut.o(.note.stapsdt+0xf8): error: relocation refers to local symbol "" [110], which is defined in a discarded section
ctrlr_discovery_ut.o(.note.stapsdt+0x15c): error: relocation refers to local symbol "" [112], which is defined in a discarded section

Fixes issue #2027.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ic6dad60df1f7dccb7f99777ebc4435c618cb505a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8699
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-09 07:02:28 +00:00
Jacek Kalwas
03ac99d13f nvmf: set NGUID for given namespace based on bdev UUID
If NGUID is not specified with nvmf_subsystem_add_ns json-rpc request
then it is possible to expose the same NGUID as bdev nvme module
attached.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Ie0ed7189e55a5abd6bc0904fc356d26f62b50549
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8628
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-09 07:02:11 +00:00
Jacek Kalwas
1f433c4c32 bdev/nvme: prefer NGUID over UUID if supported
NVMe specification defines namespace identification descriptors i.e.
EUI64, NGUID, UUID.

BDEV abstracts NVMe specific details that is why only UUID is exposed,
however if NGUID is supported it is prefered to identify namespace
with NGUID over UUID.

If NGUID is not supported by NVMe Controller then fallback to UUID.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: If51889a3664c0daa7cbe983048231793e3c502e0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8627
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-09 07:02:11 +00:00
Jacek Kalwas
a410fb4438 nvme: introduce function to get nguid
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Ida07eca2e3cbc390d8ee481f63b20f5715a53631
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8626
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
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>
2021-07-09 07:02:11 +00:00
Konrad Sztyber
b8b1f19222 lib/trace: reduce trace entry size to 32B
Now that multiple trace entries can be chained together to form a larger
argument buffer, we can reduce the size of a single entry back to 32
bytes, while still allowing the user to pass multiple parameters.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ic92a1413498df28a8561a13c0f06d895d0af2cc6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8407
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-07 09:43:37 +00:00
Konrad Sztyber
2731216dca app/trace: print arguments from chained entries
The trace app has been extended to parse chained entries when printing
arguments that exceed the size of a single trace entry.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ib9705fd08da998bea39f14eaa83305a8e9d0d5a8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8406
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-07-07 09:43:37 +00:00
Konrad Sztyber
6cc3169677 lib/trace: chain entries to extend their buffer size
This patch adds the ability to chain multiple trace entries together to
extend the size of the argument buffer.  This means that a tracepoint is
no longer limited to the size of a single entry, so it can have any
number of arguments, and their size is also not constrained to a single
entry.

Some limitations are still there: a tracepoint can have up to 5
arguments and strings are limited to 255 bytes.  These constraints stem
from the definitions of tracepoint structures, which could be easily
modified to extend the limits if needed.

To record a tracepoint requiring larger buffer, aside from reserving
`spdk_trace_entry` structure, a series of `spdk_trace_entry_buffer`
structures are allocated too.  Each of them acts as a buffer for the
arguments.  To allow trace tools to treat the buffer structures
similarly to regular entries, they also have the `tpoint_id` and `tsc`
fields.  The id is always assigned to `SPDK_TRACE_MAX_TPOINT_ID` to make
sure that a buffer is never mistaken for an entry, while the value of
`tsc` is always shared with the initial entry.  This also provides a way
for the trace tools to verify if an entry is part of a chained buffer.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I51ceea6b6e57df95d4b8bd797f04edbc4936c180
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8405
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-07 09:43:37 +00:00
Konrad Sztyber
0cf270910a lib/trace: add argument variable in _spdk_trace_record
It makes the code more readable.  Additionally, to avoid partial updates
to an entry, the check for the number of arguments was moved before it's
filled in.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I9ba01b1bcdc29267571badaebd4a9b34ffd7f728
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8404
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-07-07 09:43:37 +00:00
Konrad Sztyber
c681d76fb4 lib/trace: extract getting next entry to a helper function
It allows us to get rid of the `next_circual_entry` variable and will
make it easier to retrieve multiple trace entries, which will be needed
in subsequent patches.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I4666c9da518c2ac0b376e10aa73d1c58cff91f13
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8403
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
2021-07-07 09:43:37 +00:00
Konrad Sztyber
597688b2b1 scripts/trace: use ijson to parse the traces
Since the trace files can get very large (several GBs), parsing them
using python's json module might require an unfeasible amount of memory,
as it needs to load the whole file first.  The ijson [1] library
provides interfaces for parsing files iteratively, only loading a small
portion of a file at a time.

It requires the input JSON to have the tsc_rate and the definitions of
the tracepoints listed before the tracepoint entries.  It's not a big
deal, as this is the way `spdk_trace` generates it, but it's worth
noting, as passing that file through something like `jq -S` might make
it unreadable to the trace script.

[1] https://pypi.org/project/ijson

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I03c0c3fb47091da615a3978b8d63edf4d876b811
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8275
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
2021-07-07 09:43:37 +00:00
Konrad Sztyber
e61fbe91e7 scripts/trace: qpair annotations
This patch adds support for annotating qpairs.  The raw pointer values
are replaced with a list of various properties of a qpair collected by
the bpftrace script.

A line like this:

`0 2856282624.000 RDMA_REQ_NEW id: r3256 qpair: 0x26ba550`

becomes (the line was only broken here):

`0 2856282502.669 RDMA_REQ_NEW id: r3256 qpair(ptr=0x26ba550, thread=2, qid=0, \
subnqn=nqn.2016-06.io.spdk:cnode1, \
hostnqn=nqn.2014-08.org.nvmexpress:uuid:729783b4ab38485d8d767b7741108a8)`

To annotate a trace, one first needs to enable and record the DTrace
probes:

```
$ scripts/bpf/trace.py --record `pidof spdk_tgt` > bpftraces
^C
```

Of course, the probe events are only recorded when the script is
executing, so in order to generate the annotations properly, it must be
started before the annotated objects are created.  For instance, for
NVMeoF, it needs to be running before a connection is made.

After the BPF probes are recored, the traces can be annotated:

```
$ build/bin/spdk_trace -p `pidof spdk_tgt` -s spdk_tgt -j | \
	scripts/bpf/trace.py -b bpftraces
```

For now, the script only annotates traces from the rdma module, as it's
the only one with tracpoints recording qpair pointers now, but it could
be extended to support more tracepoints.

Similarly, more objects could be annotated in the future by extending
the `SPDKObject` class and defining additional DTrace probe points.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I2225f4b1ab266b41af561b5e7d942411cd0c13c1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8107
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>
2021-07-07 09:43:37 +00:00
Konrad Sztyber
01ae68f71d scripts/trace: parse and generate usdt bpftrace scripts
This patch introduces definitions responsible for generating bpftrace
scripts and parsing its output.  That output will be used in subsequent
patches to provide annotations for SPDK traces.

The script has a hardcoded set of probe points that are used to generate
the bpftrace script.  They're also checked against the probes present in
code to sanitize them and make sure that they're in sync.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I1b8c95e1a035bd7affed2c44b056828a5da94abd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8106
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>
2021-07-07 09:43:37 +00:00
Jim Harris
109af0bcb3 bdev/nvme: don't check spdk_nvme_ctrlr_free_io_qpair return
spdk_nvme_ctrlr_free_io_qpair now always returns 0, so
update the code to account for that.

Fixes issue #2012.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I61c78459472573adbfeb28052ae3379d7880567c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8660
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-07 07:27:40 +00:00
Jim Harris
4246e79c04 nvme: change nvme_transport_ctrlr_delete_io_qpair to void
Returning an error from this function is not useful - there
is nothing the caller can do with that information. So
change the return value to void.  Also add ERRLOG and assert
if a transport actually returns a non-zero status, to
force the transport implementer (which must be an out-of-tree
transport) to make changes as necessary.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I402afec045265db178af821d25b99a6dbe066eab
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8659
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-07 07:27:40 +00:00
Jim Harris
c081a84cd2 nvme: always return success from delete_io_qpair
It is not uncommon for delete_io_qpair to fail, for
example when a controller is hot removed.  So even
if SQ or CQ deletion fails, continue with freeing
resources and report success back up the stack.
There is really nothing the application can do to
account for this failing anyways.

Upcoming patches will add additional checks to
ensure failing delete_io_qpair status never gets
propagated to the caller.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iac007c1eba30f7a8c4936b3ffb6c837f28ee12ae
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8658
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-07 07:27:40 +00:00
Konrad Sztyber
2ac1521581 test/compress: fix Wstringop-overflow warnings
Fixed warnings produced by gcc-11:

compress_ut.c: In function ‘test_compress_operation’:
compress_ut.c:726:9: warning: ‘_get_mbuf_array’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
  726 |         _get_mbuf_array(exp_src_mbuf, &g_expected_src_mbufs[0], SPDK_COUNTOF(exp_src_mbuf), false);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compress_ut.c:726:9: note: referencing argument 1 of type ‘struct rte_mbuf **’
compress_ut.c:430:1: note: in a call to function ‘_get_mbuf_array’
  430 | _get_mbuf_array(struct rte_mbuf *mbuf_array[UT_MBUFS_PER_OP_BOUND_TEST],
      | ^~~~~~~~~~~~~~~

Fixes issue #2013.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I04d0182169e61e87401f93f56993168d7aa42e43
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8692
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>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-07 07:27:01 +00:00
Shuhei Matsumoto
ce60606dbc iscsi: Fix data digest degradation by restoring the original code
Due to the recent changes for non block size multiples write I/O,
the data digest feature was degraded. If Linux iSCSI host enables
data digest and tries to detect LU from SPDK iSCSI target, data
mismatch error is detected and the connection is disconnected
unexpectedly.

The cause was that pdu->data_valid_bytes was not set for non-write
response PDUs which have a data segment.

iscsi_pdu_calc_data_digest() has been used only for non-write response
PDUs. Hence we did not need to change iscsi_pdu_calc_data_digest().

Restore the original implementation of iscsi_pdu_calc_data_digest().

Additionally, to avoid future degradation, rename the related
functions to iscsi_pdu_calc_partial_data_digest() and
iscsi_pdu_calc_partial_data_digest_done(), and add comments for
clarification.

This fix was verified by the reporter.

Fixes #2029.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6babcd1b56e79d3fa3cd26b2dfaad87a52788e63
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8635
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-07 07:26:23 +00:00
Michal Berger
c6db5f41e5 autotest: Don't run spdk_dd tests under crypto job
Currently, crypto job also executes tests from the SPDK_TEST_BLOCKDEV
suite, including spdk_dd tests. The dd tests under a bare-metal system
can take up to 4 minutes alone and that brings the crypto job to the
very edge of timing out.

Since these tests are extensively covered under separate vg jobs we
won't lose any coverage by excluding them from crypto's - the basic
set of SPDK_TEST_BLOCKDEV tests would still remain as part of this
job.

Fixes: #2017

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I877e63de1e43aeb06c134fdacd6f5efbbe2a6317
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8545
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
2021-07-07 07:26:13 +00:00
Vasuki Manikarnike
a82e8478ea lib/nvme: Do not retry aborts if ctrlr is failed.
Fixes #2022

If queued aborts are present when trying to fail a ctrlr
using spdk_nvme_ctrlr_fail(), then the abort command completion
will attempt to retry one of the queued aborts.
This eventually leads to a segfault that can be avoided by not
retrying any queued aborts.

Change-Id: I897dcb8809e16af8bdd39d4381ab531e1cc29822
Signed-off-by: Vasuki Manikarnike <vasuki.manikarnike@hpe.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8585
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-06 19:44:59 +00:00
Changpeng Liu
e6464f32fa nvmf: abort AERs when doing controller reset and shutdown
The vfio-user target emulated NVMe device is treated as
PCIe NVMe SSD in the Guest VM, so when doing controller
reset or shutdown, we should abort the AERs which in the
NVMf library.

Users may switch kernel NVMe driver to SPDK NVMe driver
in the VM, without this fix, we will got "AERL exceeded"
response very frequently, because the AERs submitted by
previous driver will never be aborted in runtime.

Change-Id: I0222ed509629ccb0e98217414dd9043857105686
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8558
Community-CI: Mellanox Build Bot
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>
2021-07-06 19:36:04 +00:00
Changpeng Liu
4fa3d99131 nvmf: don't start the association timer poller for vfio-user
When users remove kernel NVMe driver in the VM, after 120 seconds,
SPDK NVMf target will disconnect ADMIN queue pair due to association
timer timeout, and for vfio-user transport, the ADMIN queue pair
connection is associated with the socket connection, so when probing
the NVMe controller again, because there is no active ADMIN connection
for fabric register R/W commands, it will cause segment fault.

Here we set the association timeout value to 0 for vfio-user transport,
so that the ADMIN connection will not be disconnected when shutdown the
controller, the ADMIN queue pair will be disconnected when the socket
connection breaks.

Change-Id: I3613169229bae384405889653e50f581d30d7c07
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8557
Community-CI: Mellanox Build Bot
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>
2021-07-06 19:36:04 +00:00
Changpeng Liu
d5102d37b3 nvmf/vfio-user: process NVMe response cdw0 correctly
The NVMf library will set cdw0 based on specific command,
so we use it directly in vfio-user, otherwise, some NVMe
commands such as AER can't work.

Fix issue #2016.

Change-Id: Ie1a80a92c0856b61822ee51ce5d8faaaf1d463de
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8556
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-07-06 19:36:04 +00:00
Changpeng Liu
e34ad3e2c5 nvmf/vfio-user: add two debug logs
Also fix one incorrect print log.

Change-Id: I3254baf4bbff4acfc0ef43f628d025931e8589ea
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8555
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: John Levon <levon@movementarian.org>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-07-06 19:36:04 +00:00
Changpeng Liu
2ccb76c30a nvmf/vfio-user: remove unnecessary macros
These macros are only valid for Fabric transports.

Change-Id: Ia456eebdcdab28e81226c1b3a7211fcb41b5e481
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8554
Community-CI: Mellanox Build Bot
Reviewed-by: John Levon <levon@movementarian.org>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-06 19:36:04 +00:00
Changpeng Liu
c138dfd3c0 nvmf/vfio-user: don't allocate internal data buffers for vfio-user target
Change-Id: I75f1f1a493a480aadbc233b4583616886559565c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8474
Community-CI: Mellanox Build Bot
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: <dongx.yi@intel.com>
Reviewed-by: John Levon <levon@movementarian.org>
2021-07-06 19:36:04 +00:00
Shuhei Matsumoto
563f69ebe8 bdev: spdk_bdev_get_by_name() hold mutex itself while traversing bdev name tree
spdk_bdev_register() and spdk_bdev_add_alias() had not held mutex when
adding bdev name or alias to global bdev name tree. This bug caused unexpected
error when traversing global bdev name tree.

The next patch will fix the bug. This patch is a preparation for the fix.

spdk_bdev_get_by_name() had not held mutex while traversing bdev
name tree. The major callers to spdk_bdev_get_by_name() had held mutex
when calling it. However, this was not clear.

Factor out the internal of spdk_bdev_get_by_name() into a helper
function bdev_get_by_name() and then change spdk_bdev_get_by_name()
to lock and unlock when calling bdev_get_by_name().

Then replace spdk_bdev_get_by_name() call in spdk_bdev_alias_add() and
bdev_register() by bdev_get_by_name() call.

spdk_bdev_get_by_name() call in spdk_bdev_examine() is not changed.
This is called only from JSON RPC and not related with the bug. So
we want to fix only unlocked access to global bdev name tree.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I25f07694e569eec10dba6c3c8543f6ce77412fe8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8523
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@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>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-07-05 14:46:30 +00:00
Shuhei Matsumoto
680388d45d bdev: Move spdk_bdev_get_by_name() up in a file
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia081edc6d04f2293296d61ec2f229f9823149bbf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8522
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@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>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-07-05 14:46:30 +00:00
Jim Harris
ac3a42b15c nvmf: retry connect commands internally when subsys not ready
It is better to not fail connect commands when a subsystem
is not ready.  The host will not be expecting that and will
typically treat it as a catastrophic failure (i.e. it won't
retry the connect).

So instead when this situation occurs, start a poller for
the connect request.  We will continue to retry processing
it until the subsystem is ready to handle it.

Fixes issue #1985.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id8835df8f0edf1e889fdd7e754e261c2a880cbb6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8571
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-05 14:45:34 +00:00
Jim Harris
65ef1f32a6 nvmf: check for null admin_qpair when updating subsystem pg
It is possible for a controller to get added to the
subsystem before its admin_qpair has been assigned.
We need to account for that when traversing the subsystem's
ctrlr list when determining ns and ana_changes that need
to be reported for the ctrlr.

Found while doing stress testing with connects and
subsystem ns add/remove.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie54dc6ac202faeaeace054e6599f2dea2f30211e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8570
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-05 14:45:34 +00:00
Jim Harris
e8e2b469ec nvme: use spdk_strerror to report CQ transport errors
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I910c5a63e1f35fa76dfb7c296361fb1af7209e6b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8569
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-05 14:45:34 +00:00
Alexey Marchuk
01bbf5d183 perf: Correct usage
Some parameters were accidentally added under
`#ifndef DEBUG`

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Idd2fd67cf7b3bcc298a290bc45b9572dcf4c0076
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8466
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-07-05 14:45:11 +00:00
Alexey Marchuk
885331fe16 perf: Ignore trtypes that were not requested by user
If perf is connecting to a subsystem with listeners
of different transport types (e.g. TCP and RDMA) and
the user request a specific trtype via CLI (e.g. TCP),
discovery process will call probe_cb for every transport
type. As result, probe_cb in perf will return `true`
and undesired controllers will be created and used in
IO path.

This patch adds a check for trtype and trstring to ignore
controllers that are not of a requested type.

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Id87afd03c7b38edfbbfecb5ad2239fe3e9ac9f83
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8465
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-07-05 14:45:11 +00:00
Alexey Marchuk
05c7a2cc0f nvme/fabrics: Fix trid trstring populate
After correct trstring initialization, it is
overwritten with trstring value of the current
probe ctx. That leads to a problem when initiator
connects to a sbusystem with listeners of different
transport types (e.g. TCP and RDMA). If probe_ctx has
TCP type, than discovery probe initialized probe trid
with trtype=RDMA and trstring=TCP. As results, SPDK
creates TCP controller with trtype=RDMA and we hit
assert in nvme_tcp_qpair function.

Change-Id: I9355450c40c58fa55b016220703f6f7ae36b2571
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8464
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-07-05 14:45:11 +00:00
John Levon
2c34af8bff nvmf: fix nvmf_tgt_accept() return code
Pollers are supposed to return SPDK_POLLER_{BUSY,IDLE}.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I92bd184aaba9e3efb730b68a6024ebc9757ffd8b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8559
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-05 14:37:07 +00:00
wanghailiangx
585543acd8 example/blob: fix a historical notes hello_blob.conf
Now, only hello_blob.json in examples/blob/hello_world.

Change-Id: Ib2606935b2466197d958fe6ced0db201c8c3e53a
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8590
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Chengqiang Meng <chengqiangx.meng@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-05 14:36:53 +00:00
Mao Jiang
741c7985fb test/nvmf/subsystem: cases for subsystem ctrlr adding and removing
Change-Id: I831192e7938a21e2a959af6b5b6d3a41fc31e26f
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8513
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-05 14:36:45 +00:00
wawryk
2e6fb86176 test/pkgdep: update nvme-cli version
Signed-off-by: wawryk <maciejx.wawryk@intel.com>
Change-Id: I0d099427ac9bddf9981ccf22363e177d58a29bd8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8518
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-07-05 14:36:34 +00:00
wawryk
8439c53b94 scripts/vagrant: add fedora34
also remove out of support fedora31

Signed-off-by: wawryk <maciejx.wawryk@intel.com>
Change-Id: I2ec224a3fb3849eb62ba46a01aa74c62926174f8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8461
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-07-05 14:36:34 +00:00
Weifeng Su
d651f8a238 nvme/nvme_cuse: Fix race condition in cuse session
If we continuous setup and teardown cuse session, It will teardown
uninitialized cuse session and cause segment fault, New function
cuse_session_create will do the session create operation and under
g_cuse_mtx to avoid this issue.

Signed-off-by: Weifeng Su <suweifeng1@huawei.com>
Change-Id: I2b32e81c0990ede00eea6d4ed3a7e44d534d4df3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8231
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-05 14:36:24 +00:00
Darek Stojaczyk
9d17c1d0fc autotest: don't drop system cache
Without hugepage allocation at runtime this is
no longer required. Additionally CI VMs now
have a lifespan of just 1 test run, so there's
no need to clear the cache anymore.

Saves us a few seconds on every run.

Change-Id: I12cb4095c37bd5d22d3b3fcbce4b5072118d3000
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2375
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: <tomasz.rochumski@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-05 14:36:08 +00:00
Richael Zhuang
97f8a3b964 test/scheduler: check the idle thread on the main core
check if the thread is moved to the main core after it becomes idle.

Change-Id: I3ee38ee16d755cc9dea5fa10d9f8ba42507408ff
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7853
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-07-05 14:35:58 +00:00
Michal Berger
642b89f496 check_format: Fix git-grep pattern
Use extended regexp to resolve any potential ambiguity with matching
on '('. This should fix the following failure as seen on the CI:

fatal: command line, '^SPDK_RPC_REGISTER\(': Unmatched ( or \(

Also, since errexit doesn't see failures inside the process
substitution make sure we return from the function with a proper $rc
in case git fails early on.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ia03095e9cc8cf11602dafb5bef28265abb485704
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8577
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-05 14:35:50 +00:00
Ziye Yang
05dc895bea sock/posix: Fix the coredump when removing the sock from socks_has_data list
When entering the if case to order the list, there is bug should be
fixed. The original code does not address this.

The way this happens is when there is a connection left in the socks_with_data list
between polls and there are enough new events detected that it would exceed the
maximal number of events. A connection is left on this list between polls if it isn't
fully drained via reads by the upper layer on each poll loop.

Currently, the maximal socket event num is 32. Then we did not hit this issue
in our normal test cases. But when you use NVMe-oF tcp target to test which is
described in #2105, there are more than 32 active sockets, and it exceeeds
the maximal num of events of polling (32), so we will trigger this issue.

Fixes issue #2015

Change-Id: I9384476fdba8826f5fe55a5d2594e3f4ed3832ba
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8541
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-07-01 19:37:38 +00:00
Ziye Yang
358b84b40f accel_perf: Fix the complier complaining.
Faced the following warnings during the compilation:

accel_perf.c:222:17: warning: ‘argval’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  222 |   g_crc32c_seed = argval;

And this patch can be used to fix this issue.

Change-Id: I84ee542d629ff5d9e6a2873c0035bea81b376150
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8538
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Chengqiang Meng <chengqiangx.meng@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: wanghailiang <hailiangx.e.wang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-07-01 15:34:18 +00:00
Mao Jiang
8c3854fdc0 test/nvme_rdma: cases for qpair submitting request
Change-Id: I16e250091bc43aca7cf25c828971d8d71978750e
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8445
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-06-30 22:56:39 +00:00
Richael Zhuang
c737130356 spdk_top: fix lcore id display error in CORES tab
when running spdk_tgt -m 0x33,
the core id showed from refresh_cores_tab() is:
core
0
0
4
5
The correct should be:
0
1
4
5
This patch aims to fix this display error.

Change-Id: I2ac49d73de6dcf5bf10891b2299565c19cfaa686
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7856
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-06-30 22:56:31 +00:00
Shuhei Matsumoto
00833e651c example/nvme_identify: Use spdk_nvme_detach_async()
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie026026fd64d36974e4a877aa9755bafdbe4fb29
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8473
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-30 22:54:19 +00:00
Shuhei Matsumoto
2184410027 test/env_dpdk_post_init: Use spdk_nvme_detach_async()
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7d78cc1a5ab1d696abcba9cd83aeac913ea101de
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8472
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>
2021-06-30 22:54:19 +00:00
Shuhei Matsumoto
9a99ff90f9 example/nvme_hotplug: Use spdk_nvme_detach_async()
We can add one or more ctrlrs to the existing detach context even
after polling started as long as spdk_nvme_detach_poll_async()
returns -EBUSY.

By relying on this update, add a global variable g_detach_ctx and
use it to aggregate multiple detachments.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I28dcfa41daf1fe2bbe76fac80e1bc2abc24751f7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8471
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-30 22:54:19 +00:00
Shuhei Matsumoto
3959e397d4 nvme: Add new detach to a detach context while it is being polled
This update will allow us to use spdk_nvme_detach_async() and
spdk_nvme_detach_poll_async() easier to aggregate multiple detachments.

Previously, we could do:
    spdk_nvme_detach_async()
    spdk_nvme_detach_async()
    spdk_nvme_detach_async()
and then started doing spdk_nvme_detach_poll_async().

Hence aggregating multiple detachments is already supported.

After this patch, the following sequence is possible:
    spdk_nvme_detach_async() = 0
    spdk_nvme_detach_async() = 0
    spdk_nvme_detach_async() = 0
    spdk_nvme_detach_poll_async() = -EAGAIN
    spdk_nvme_detach_async() = 0
    spdk_nvme_detach_async() = 0
    spdk_nvme_detach_poll_async() = -EAGAIN
    spdk_nvme_detach_poll_async() = -EAGAIN
    spdk_nvme_detach_poll_async() = -EAGAIN
    spdk_nvme_detach_poll_async() = 0

The actual changes is to remove the variable polling_started from
struct spdk_nvme_detach_ctx because it is not necessary anymore.

Clarify this change via updating the header file and CHANGELOG.
Verify this change by unit test.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iebdf6c27c5304a2097b7084c315ccc99634ffa1e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8468
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-30 22:54:19 +00:00
Shuhei Matsumoto
4fe4040a14 nvme: Add spdk_nvme_detach_poll() to simplify a common use case
Add a new function spdk_nvme_detach_poll() to simplify a common
use case to continue polling until all detachments complete.
Then use the function for the common use case throughout.

Besides, usage by simple_copy application was not correct, and
fix it in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic14711cd8478bf221c0fe375301e77b395b37f26
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8509
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-30 22:54:19 +00:00
Shuhei Matsumoto
5d617b4855 ut/nvme: Add test case for spdk_nvme_detach_async()
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iaeb7435b7efc126b95be1d7088a5d8b67dceec5d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8467
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-30 22:54:19 +00:00
John Levon
56e327e795 vfio-user: fix nvmf_vfio_user_poll_group_add() comment
The function comment was referring to a non-existent caller; instead, expand
with a little more detail on the path taken for new QPs.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I42478194f3cfc18a6ff6c434964630ac42866f1d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8534
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>
2021-06-30 22:53:38 +00:00
Krzysztof Karas
be1ff6def5 docs: update spdk_top page to contain help window info
Updates docs for spdk_top to refrect changes made to the bottom menu
and adds a section to explain help window.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Iad3cf97ce0e06d9154b3b93e73c4c626f89a763e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6989
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-06-30 22:43:24 +00:00
Krzysztof Karas
aa64b29723 spdk_top: reduce bottom menu entries
Help window has proper explanations for each key used in spdk_top,
thus number of bottom menu entries can be reduced.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Id8356cbf25a63931e2499fee245547a5dec3b7a0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6145
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-30 22:43:24 +00:00
Krzysztof Karas
9d54193c70 spdk_top: add help pop-up window
Adds help pop-up window with descriptions for each menu entry.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Ic622d30e24ba0b071254577c31829be235cdb0fc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6142
Community-CI: Mellanox Build Bot
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: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-06-30 22:43:24 +00:00
Michal Berger
dd2b935dc4 check_format: Fixes for shellcheck's SC2268 directive
SC2268: Avoid x-prefix in comparisons as it no longer serves a purpose

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ica5ddfa8c39f34741c7344906abe802ff7451b1f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8505
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: <tomasz.rochumski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-30 22:43:05 +00:00
Michal Berger
742f04b3f7 check_format: Fixes for shellcheck's SC2251 directive
SC2251: This ! is not on a condition and skips errexit.
        Use && exit 1 instead, or make sure $? is checked.

This is critical since our test suites heavily depend on errexit
to catch all abnormal conditions. Replace ! foo ... with a call to
NOT() wherever possible. For the test/ocf pieces, use [[ ]] instead
to define the condition for the existance of the ocf bdev.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ied3f99b9f1dc0594e4aef64fc21e51498f19ac23
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8504
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-30 22:43:05 +00:00
Michal Berger
9d48662103 check_format: Ignore shellcheck's SC2128 and SC2178 directives
These are currently prone to false-positives especially in terms of
scoping. Consider the following:

foo() {
	local bar=(42)
	echo "${bar[*]}"
}

bar=43
foo
echo "$bar"

Some versions of shellcheck, including the latest, 0.7.2, complain
about $bar being reused as a plain string here. This is incorrect
since foo() holds its own copy of bar[@] hence the assignment which
takes place outside of it doesn't affect its content.

SC2178 can be mitigated be reversing the order of declaration:

bar=43
foo() { ... }
...

but the SC2128 still remains.

Currently, in our code majority of these warnings are coming from
false-positives due to initial source'ing which most of our test
scripts do (e.g. they fetch a function where local bar=() is used
and in the test itself $bar happens to be assigned a plain string.
This is still valid code).

To mitigate, disable these directives untill shellcheck is capable
of properly interpreting scoping when checking them.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ifbde973eae6e261d79e1c340eb28644bce5f4e45
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8503
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: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-30 22:43:05 +00:00
Michal Berger
63fd943282 check_format: Fixes for shellcheck's SC2269 directive
SC2269: This variable is assigned to itself, so the assignment does
        nothing.

Since the --id check doesn't change the value of $id, remove it
completely. This simplifies the process_shm() so the --id type is
considered to a be default and $id changed only in case --pid was
explicitly requested.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: If8a4a43c6822fa1b32217a0b783cb96d0fee2644
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8502
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-30 22:43:05 +00:00
Michal Berger
8c176db2ca check_format: Fixes for shellcheck's SC2030 directive
SC2030: Modification of var is local (to subshell caused by pipeline)

This directive is raised since the for loop (or rather its contents)
is piped through to another process. In this context it's not harmful
since we are interested only in sending the stdout but since we operate
on variables that happen to be local to the process that handles the
loop shellcheck sees that as a potential issue. To make it happy
remove the pipe and sort pci addresses prior running the loop.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I835c5ac1da9012129c5d01d62880307f70caab1b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8501
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-30 22:43:05 +00:00
Michal Berger
36f5f0df17 check_format: Fixes for shellcheck's SC2155 directive
This is a first commit in the series addressing potential Bash issues
as discovered by the latest shellcheck release (0.7.2, shipped with
the very latest fedora33 and fedora34). The goal is to either fix,
locally or globally disable given directive(s).

SC2155: Declare and assign separately to avoid masking return values

Simplify the setting of the variable pointing at the root of the repo.
Also, keep it consistent with the rest of the scripts and declare it as
$rootdir.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I63e0b1a85ce16f7983e9ba6dd985046e8a39a650
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8500
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-30 22:43:05 +00:00
Jim Harris
79b6771f61 scripts: add escape in check_json_rpc string
On my system, the git grep for ^SPDK_RPC_REGISTER(
fails because the ( is unmatched.  It seems we should
escape it, although clearly our CI systems don't seem
to require it.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8393
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-30 19:23:50 +00:00
Jim Harris
10c7d133be nvmf: print debug response value after prop size check
When the property is 8 bytes but the host only requested
4, we need to mask and only return the bytes requested
by the host.  Wait to do the DEBUGLOG until after
that has happened.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8f476a47e9fd07bf652fd64f3b1c17d650374167
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8506
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-06-30 19:23:40 +00:00
Michal Berger
7232c450f9 configure: Build against installed DPDK instance
Interpret bare --with-dpdk opt as user's request to find installed
(provided by the distro) DPDK's libs|include files and use them during
the build.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I9da99671b95af0121194b3a6d53636b0ded71f1b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8348
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: <tomasz.rochumski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-06-29 18:17:43 +00:00
Michal Berger
52652c30cb rpmbuild: Fix Requires section
This particular section must be defined in one place hence the
%{requirements_list} cannot be passed down later on. This requires
reordering of the .spec a bit. Most notably, all global macros are
now defined at the very beginning so then Requires section can be
build properly.

Also, use %() to expand the macro which holds the requirements as
bare "Requires: %{foo}" is not valid.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I69430f73d10204325fc825ecc392506f261ebaf1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8347
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-29 18:17:43 +00:00
Karol Latecki
f5cb018a92 doc: add report link to 21.04 TCP report
Change-Id: I1cca29b0165b4ade6750c3655090e40bb84a5da7
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8469
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-29 18:17:10 +00:00
Changpeng Liu
15beaa20bf nvme: print NVMe command and response when enable nvme log flag
Fix issue #2010.

Change-Id: I9ffc77ddfececce1e6bdac49939d616d9e7bb3c0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8493
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-29 15:13:24 +00:00
paul luse
bb8102b1ff module/idxd: add lock around idxd device selection
Without it multiple threads can race and end up sharing a device
when the intention is sharing only after full round robin.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I29b854ff837d56078bc033802d3df244728a29aa
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8187
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-29 00:46:25 +00:00
paul luse
3bbfbb5b0f lib/idxd: update some func params for consistency
Was using "dst" in some cases and "crc_dst" in others for crc32c
related calls.  Update them to always use crc_dst

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Icf200f1734c64c29881f23b02b8d12bad81b3ca0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8186
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-06-29 00:46:25 +00:00
paul luse
10808e45d4 idxd: refactor flow control for idxd engine
Recent work identified race conditions having to do with the
dynamic flow control mechanism for the idxd engine. In order
to both address the issue and simplify the code a new scheme
is now in place.  Essentially every DSA device will be allowed
to accomodate 8 channels and each channel will get a fixed 1/8
the number of work queue entries regardless of how many
channels there are.  Assignment of channels to devices is round
robin and if/when no more channels can be accommodated the get
channel request will fail.

The performance tests also revealed another issue that was
masked before, it's a one-line so is in this patch for convenience.
In the idxd poller we limit the number of completions allowed
during one run to avoid the poller thread from starving other
threads since as operations complete on this thread they are
immediately replaced up to the limit for the channel.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I913e809a934b562feb495815a9b9c605d622285c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8171
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>
2021-06-29 00:46:25 +00:00
Michal Berger
570c8bb483 autotest: Purge tmp test dirs during the final cleanup
Fixes #2006

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I3dbc0cb1177f3611b6d5684ddac7d26c64cc0479
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8476
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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-06-28 16:54:55 +00:00
Mao Jiang
242a99babf test/nvme_pcie: cases for pmr configuration
Change-Id: I456e5c0472b1978be0f67a87d6a58816d769589e
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8232
Community-CI: Mellanox Build Bot
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>
2021-06-28 16:30:50 +00:00
Zhiqiang Liu
e4746ad40f idxd: fix memleak problem in spdk_idxd_configure_chan()
In spdk_idxd_configure_chan(), if memory allocation fails in
TAILQ_FOREACH() {} code range, we will goto err_user_comp and
err_user_desc tag, in which we donot free chan->completions
and confused batch->user_completions with chan->completions.
Memleak problem and double free problem may occurs.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: I0e588a35184d97cab0ea6b6c013ca8b3342f940a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8432
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
2021-06-28 16:30:06 +00:00
Shuhei Matsumoto
3aeeb4b68f test/nvmf_multipath: Retry checking if ANA state is changed with timeout
The latest Linux NVMe host (e.g. Linux kernel 5.12) have improved
the quality of multipath but still has an issue such that ANA state
is observed to be invalid even after connection is successfully
created.

By code inspection and system test, initializing ANA state may be
delayed even after connection is successfully created.

We can insert a short sleep but it will be better to retry checking
with timeout. The created function check_ana_state() is applied to
the remaining cases.

This fixes the part of the issue #1819.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifc4eaef7c702d961caeee5bcdc9e6eab4704fc5d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8475
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-28 16:25:24 +00:00
Shuhei Matsumoto
b503ef4fa0 nvmf: Fix heap-use-after-free when poll_group_remove() is called after ctrlr is freed
When a qpair is destroyed and the qpair is the last,
_nvmf_ctrlr_free_from_qpair() (in lib/nvmf/nvmf.c) sends two messages,
one is for _nvmf_ctrlr_destruct() and another is for
_nvmf_transport_qpair_fini().

We do not know which of two completes earlier.

_nvmf_ctrlr_destruct() frees the qpair->ctrlr in the end.
On the other hand, _nvmf_ctrlr_free_from_qpair() calls
spdk_nvmf_poll_group_remove() in the end, and spdk_nvmf_poll_group_remove()
accesses the qpair->ctrlr to free queued requests to the qpair.

Before one recent change, spdk_nvmf_poll_group_remove() had been called
before _nvmf_ctrlr_free_from_qpair() was called.

Hence extrace the operation to free queued requests from
spdk_nvmf_poll_group_remove() and inline it into _nvmf_qpair_destroy().

Fixes one showstopper error to investigate the issue reported in #1819.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I29c43ff7b289fc77a5de9c33e0266301c412e208
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8438
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
2021-06-28 16:25:24 +00:00
Jim Harris
e1bf63afc9 accel_perf: add -a option for allocate depth
For benchmarking purposes, we may want to use a
relatively low queue depth but spread the operations
across a wider range of memory.  A new -a option is
added where the user can specify an "allocate depth"
to do exactly that.  In this case, more tasks (and
their associated buffers) can be allocated than we
have actual queue depth.  Then when we pick a new
task for the next operation, it will use a different
memory range and avoid always using the same buffers
over and over again.

If not specified, we just allocate the same number
of tasks as the queue depth, which is the current
behavior.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I78042d905fd49d130c4a318e2c19eb11b84ff726
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8451
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-28 16:18:54 +00:00
Jim Harris
c82d5789e6 accel_perf: check that numeric arguments are non-negative
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie512181e7e0537e8319abe0a5b53492c959964d2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8491
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-06-28 16:18:54 +00:00
Jim Harris
451462f692 accel_perf: cycle tasks through task_pool
When a task completes, always put it back in the task
pool (using TAILQ_INSERT_TAIL) and then use _get_task
to get a task for the next submission.  Currently this
will just allocate the task that was just put into
the TAILQ.  But an upcoming patch will allocate
more tasks than we have queue depth, and this patch
will ensure all of those tasks get used evenly.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia6247a76ba60337fe6da3189e6c305f4dfb0a041
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8450
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-06-28 16:18:54 +00:00
Jim Harris
4cd7ca9bc0 accel_perf: assign task->worker when building tasks_pool
Previously we would only assign the worker in _get_task().
But future patches will use _get_task() for each I/O,
not just during startup.

Also increment the current_queue_depth during startup
only, rather than every time _get_task() is called.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2713591d36b8353eaab8119ee230261f40857019
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8449
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: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-06-28 16:18:54 +00:00
Tomasz Zawadzki
127fc0d0c3 scheduler_dynamic: consider any core for the thread
Previously core load was only considered for main lcore.
Other cores were used based on cpumask only.

Once an active thread was placed on core it remained there
until idle. If _get_next_target_core() looped around,
the core might receive another active thread.

This patch makes the core load matter for placement of any thread.
As of this patch if no core can fit a thread it will remain there.
Later in the series least busy core will be used to balance
threads when every core is already busy.

Modified the functional test that depended on always selecting
consecutive core, even if 'current' one fit the bill.
Later in the series the round robin logic for core selection
is removed all together.

Fixed typo in test while here.

Note: _can_core_fit_thread() intentionally does not check
core->interrupt_mode and uses tsc. That flag is only updated
at the end of balancing right now. Meanwhile tsc is updated
one first thread moved to the core, so it is no longer
considered in interrupt mode.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I95f58c94e3f5ae8a468723d1dd6e53b0e417dcc3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8069
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-28 16:18:19 +00:00
Tomasz Zawadzki
2d79bf58fb scheduler_dynamic: balance idle threads in separate pass
Idle threads are always moved to main core, there are no
other considations. Doing it as separate first pass,
allows to have the core stats be up to date for second
pass for active threads.

Core load stats will be used later in the series to determine
optimal target core for an active thread.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6a9bc11b86e954e461f7badebf3a6e4d1718f63c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8067
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-28 16:18:19 +00:00
Tomasz Zawadzki
e209981dd1 scheduler_dynamic: add _foreach_thread iterator
This will be needed when doing multiple passes over
all threads. See next patch.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I4e9c749d69314fc268cbcb9334862392100b651e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8066
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-28 16:18:19 +00:00
Tomasz Zawadzki
60b655aa91 scheduler_dynamic: simplify thread balancing logic
When picking a path to go down with a thread,
conditions unnecessarily piled up.

Instead do it either of two ways:
- move idle threads to main core
- find best core for active threads and move them there

There is no need to worry about cpumask of the thread,
since _find_optimal_core() will always return a core
within the cpumask.

If the found core is the same one as the current,
_move_thread() won't perform any action.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I0f4782766c15c86b5db0c970cfc9547058845b2a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8065
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>
2021-06-28 16:18:19 +00:00
Maciej Szwed
76b7210226 scheduler_dynamic: refactor out searching for target core
Refactors logic for finding the optimal core for a thread
to single function.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ifc2b09acb6f698640ce9602fec4f567eb32b79fa
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6732
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-28 16:18:19 +00:00
Tomasz Zawadzki
537b01bf17 ut/event: fix cpumask resetting for scheduler tests
Intention was for the threads to contain a single
core in the cpu mask.
This patch fixes it.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I8276cc906be53a7f8195d61c63bfa54bd2647b75
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8068
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-28 16:18:19 +00:00
Maciej Szwed
62491a6716 scheduler_dynamic: refactor out moving thread between cores
Refactor all thread moves and core stats updates to single function.

At this time in series only tsc of main core was modified and
only idle tsc of main core was used. Main core would be either
the destination core or the source core. In both cases, the idle
time for main core had to be updated.

This patch generalizes this logic to always move the execution
time from source core to destination core.
As a byproduct cores besides main core have the stats updated,
which will be useful later in the series. Once core load will
be the deciding factor for choosing a core.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I57564e8b2632f919869d74e8f10b01fb3dda3be9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6658
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: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
2021-06-28 16:18:19 +00:00
Konrad Sztyber
b0d3f29a33 scripts/trace: added script to annotate traces
This script will use the output generated by the spdk_trace app (JSON) and
replace some of the raw pointers with the information gathered through
the DTrace probes.

For now, this only prints out the traces without doing any annotations,
so the output should be nearly identical to what's printed by
spdk_trace.  The annotations will be added in subsequent patches.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I406e8d4fde9cb88b31c38aa96f11b88e607e9436
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8105
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-06-28 16:17:35 +00:00
Konrad Sztyber
9953139612 app/trace: added an option to print traces as JSON
Added an option, `-j`, which will cause the spdk_trace to print traces
in JSON format.  The JSON output's structure is similar to the binary
SPDK trace format, i.e. tracepoint definitions are printed at the
beginning, followed by trace entries.  This allows us to reduce the size
of the output a bit, as we don't need to print all tracepoint properties
for each entry.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I22fd4bee72c0d214a3444ce62d0651fabd489f5a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8104
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-28 16:17:35 +00:00
Konrad Sztyber
63f14f9313 app/trace: remove the -q (quiet) option
The application doesn't do anything useful when started with this
option, so there's no point in keeping it.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I2fca31fc7ccca11fc44a7f9a7a7b83d7634048d7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8103
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-28 16:17:35 +00:00
Konrad Sztyber
fb67f90b31 app/trace: move stats update out of print_event
It'll make it a bit easier to support printing traces in different
formats.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I33d454868fe7975ce81046823e3a3b9b6f587b0f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8102
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-28 16:17:35 +00:00
Konrad Sztyber
a4044e77d6 usdt: pass ticks as the first probe argument
This will allow to match and compare the DTrace probes with SPDK traces
as they'll be using the same source for the timestamps.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I686c3351428c75f9b618a1a909836504fccad828
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8101
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-06-28 16:17:35 +00:00
Konrad Sztyber
c556b6b892 lib/trace: don't pass zero as a non-argument
Now that the trace library can handle multiple arguments, there's no
point in passing 0 for tracepoints that don't have any arguments.  This
patch removes all such instances.  It allows us to to verify that
`spdk_trace_record()` was issued with the exact number of arguments as
specified in the definition of the tracepoint.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Idbdb6f5111bd6175e145a12c1f0c095b62d744a9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8125
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-28 16:17:35 +00:00
Konrad Sztyber
c514ba5053 lib/bdev: replace spdk_trace_record_tsc() with spdk_trace_record()
Replaced calls to `spdk_trace_record_tsc(spdk_get_ticks(), ...)` with
`spdk_trace_record(...)`, which does the same thing but is more consise.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ib96e0bc0225490dadf857e1ddd2a3ecbf71e98c8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8444
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-28 16:17:35 +00:00
Konrad Sztyber
7ca411339c app/trace: print tpoint arguments at the end of a line
Now that each tracepoint can have more than one argument, we cannot pad
the missing ones, as it would take too much space.  Therefore, we put
them at the end of a line and simply skip the missing ones.

Additionally, since empty arguments are no longer padded, this patch
stops recording arguments with names consisting of an empty string
(containing just '\0').

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I5199a3219a31d6afd3178324a4f48563b84e6149
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7958
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-28 16:17:35 +00:00
Konrad Sztyber
3e158bd5c9 lib/trace: record string arguments as (const char *)
Now that `spdk_trace_record` receives variadic arguments, we no longer
have to pass strings as uint64_t, but can pass them directly as
pointers.  That also means that the recorded strings can be longer than
8B (up to 40B).

This patch changes the blobfs code to pass the filenames as strings and
gets rid of the code that converted them to uint64_t.

Additionally, the maximum length of string arguments printed by
`app/trace/trace` has been extended to 16 and they're also padded to 16
characters, to better align with other argument types.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ibe94452bf1b27eba2b15ca8608d0c3b55c2db360
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7957
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-28 16:17:35 +00:00
Konrad Sztyber
f301d156f1 lib/trace: variable number of tracepoint arguments
This patch allows tracepoint to record a variable number of arugments.
An additional function has been added,
`spdk_trace_register_description_ext()`, which allows the user to
register definitions for tracepoints specifying all the arugments that
they accept.  Users can also call `spdk_trace_register_description()` to
register tpoints with a single argument (or none).

Currently, all of the tracepoint arguments need to be passed as
uint64_t.

The trace record functions use variable arguments and rely on tracepoint
description to know the order and the format of the arguments passed.
That means that the user needs to take care that they're always in sync.

Moreover, this patch extends the tracepoint entry size from 32B to 64B,
meaning that there are 40B that can be utilized for passing arguments,
which in turn means that there can be up to 5 arguments per tracepoint.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I9993eabb2663078052439320e6d2f6ae607a47ff
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7956
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>
Community-CI: Mellanox Build Bot
2021-06-28 16:17:35 +00:00
Jim Harris
1be9c295b8 build: clarify Makefile for check_so_deps failures
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If6b9ee44568370667d5d597098b43aa892862232
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8499
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-25 16:45:17 +00:00
Jiewei Ke
5fc0475c14 thread: Make the definition of struct spdk_io_channel private
Move the definition of structure spdk_io_channel into
lib/thread/thread_internal.h, so we don't have to update SO_VER for
other libraries in future when we need to change the internal details on
the structure.

Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Change-Id: I3d2ca7a8737972e0b33ce92e464da42c48f89dec
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8189
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-25 05:01:45 +00:00
John Levon
2509e1248c vfio-user: correct logging levels
If we're not a DEBUG build, vfu_setup_log() was effectively forcing a
libvfio-user logging level of LOG_ERR. Instead, let the log handler decide what
to report, so we can respect the SPDK levels.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: Ib3ad62589f495a377885f7deabaf02b428e83d30
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8452
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-24 22:19:00 +00:00
Michal Berger
227428c3a4 autotest: Don't override default amount of hugepages on Linux to 8GB
This is relevant mostly for the VMs. Allocating that much memory puts
a lot of pressure on remaining pieces of the system as currently we
allocate total of 12GB memory per VM instance in the CI pool. Default of
4GB hp should be enough to cover majority of the tests hence if there's
any suite that requires more memory, setup.sh should be called there
directly with an optimal value.

This is done to make sure we can accomodate proper resources in the CI
by knowing what are the actual requirements rather than just blindly
allocating "as much as possible".

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ie958c518c7ed702b068c7fc9042183fdf41aa816
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8436
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-24 17:33:10 +00:00
yidong0635
928db41626 rpc: Fix raid strip size method not consistent.
Fix json config file using strip_size error, and
The strip_size parameter was changed to strip_size_kb  in `bdev_raid_create`
     rpc function in order to make it more meaningful to users.

Unify the coding style in rpc help file.
      using --strip-size-kb --raid-level ... instead of --strip-size_kb.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I341af1034c7ea6716ff839bb524ee733c9e0cd34
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8401
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-24 17:30:19 +00:00
Jim Harris
164bfddf24 nvmf: don't set aerl=0 for non-discovery controllers
Commit b7cc4dd added support multiple AERs, but didn't
remove the code that hardcodes aerl=0 for non-discovery
controllers.  So even though the target now supports
multiple AERs, we never indicate that for non-discovery
controllers.

The spec also recommends that implementations support
a minimum of 4 AERs - so the current behavior is not
recommended.

It seems that at least on Windows (when testing with
vfio-user transport) we see the limit get exceeded
which results in ERRLOGs.  Let's keep the ERRLOG there
for now, assuming that once we report we support 4
AERs that Windows won't try to send more than that.

Fixes issue #2000.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I6a07a6f37aaa6e531ae2cf1e1c46da036b00785b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8488
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-24 07:21:34 +00:00
Jim Harris
6aa6bfdda3 nvmf: use DEBUGLOG for unsupported features and log pages
We cannot control what the host may send to the target.
For example, we have empirical evidence that Windows
will send vendor-specific IDs for features and log pages
(when testing with the vfio-user target transport).

So let's change the ERRLOGs in these cases to DEBUGLOGs.

Fixes issues #2004, #2007, #2008.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8d5b92fc5e33d698af246f2f1c34f7cf51e6488a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8487
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-24 07:21:34 +00:00
Krzysztof Karas
bd4363d3e0 spdk_top: rename free_resources to free_poller_history
Rename this function to better expalin what it does.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I7ab84a7cfbe488df8c1681d943f8af74458f5b32
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7389
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-23 19:52:27 +00:00
Krzysztof Karas
b096b67010 spdk_top: make sure data from RPC is consistent
This patch changes how cores, threads and pollers data structures
are connected to each other. This is to ensure consistency and
avoid writes/reads from null pointers when application state
has been altered (e.g. by rescheduling thread to another core).
Fixes #1921.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: If517a7db41c512b27f86598a047df8ed27d3a274
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7769
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-23 19:52:27 +00:00
Krzysztof Karas
a9a2c09579 spdk_top: change type of core_num in rpc_thread_info
Change type of core_num to be int instead of uin32_t
to allow assignment of -1 value for the "hanging" threads
that are not assigned to any core.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I708f9547ee4fa2cf49f6c38750e12380d76b1160
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8154
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-23 19:52:27 +00:00
Liu Xiaodong
3a2a1d80e0 test: fix nbd test typo and add check
Change-Id: I5120baff8d2de3ef639d7b3c66d51002838c3f3c
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8439
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-23 18:07:46 +00:00
Tomasz Zawadzki
bbf52bd340 doc/rpms: add reference to rpms doc page
The RPM page was not referenced anywhere,
only accesible via list of files or direct link.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I3a72add1cc2530a73f383ca0c144a551d94083e8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8015
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-06-22 23:47:52 +00:00
Changpeng Liu
9901ca18a2 libvfio-user: update submodule
1. Update with latest vfio-user specification changes.
2. The new libvfio-user will not expose dma_sg_t data structure
any more, SPDK should use pointer and allocate memory for it.

Change-Id: I619b0c0828cbe3b050c628bff4c4ce7ee840510f
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8377
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Community-CI: Mellanox Build Bot
2021-06-22 23:42:02 +00:00
Changpeng Liu
c5432752b7 nvmf/vfio-user: eliminate insert_queue function
When creating queue pairs, the original code uses a stack
queue variable and copy it to queue pair in insert_queue
function, the coming changes in libvfio-user doesn't expose
dma_sg_t data structure any more, we need to change it to
a pointer and allocate memory for it, so here we eliminate
insert_queue function as a preparation.

Change-Id: Iee94029d24bc8882ec169665e229e6cbc11564c0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8376
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-06-22 23:42:02 +00:00
Karol Latecki
b3bd02552c doc: add link to SPDK NVMe-oF RDMA 21.04 report
Change-Id: Ie19ce8913d745116af596b5b7d3680e26f382125
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8276
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: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-22 00:11:38 +00:00
Zhiqiang Liu
583689215f uring: set fd to -1 after close(fd) in uring_sock_create()
In uring_sock_create(), we loops through all the addresses available.
If something is wrong, we should close(fd) and set fd to -1, and
try the next address. Only, when one fd satisfies all conditions,
we will break the loop with the useful fd.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: I22eada5437776fe90a6b57ab42cbad6dc4b0585c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8311
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-06-22 00:11:32 +00:00
Jiewei Ke
7ba4ea0773 bdev: use thread api to access spdk_io_channel's thread
Thread is private data of spdk_io_channel, bdev should use
spdk_io_channel_get_thread() to access it. This prepares for the upcoming
change to make the definition of struct spdk_io_channel private.

Change-Id: I643c8d677e22f6d8dde2faf91bb2711d3f5d81b8
Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8426
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
2021-06-22 00:08:48 +00:00
Krzysztof Karas
9d4fbc135d dpdk: update submodule to DPDK 21.05
Updates DPDK submodule to the 21.05 version.
Changes CHANGELOG to reflect this change.

Fixes #1998

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I9e65c680b9c0a6be23df22902ac1de938be60656
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8399
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-18 07:06:00 +00:00
Ben Walker
34392f231d nvmf/rdma: Add a warning about data corruption with MSDBD and
in-capsule data over 4KiB when using the Linux initiator.

This is fixed in the latest kernel. See

https://lists.infradead.org/pipermail/linux-nvme/2021-May/025641.html

Fixes #1823

Change-Id: Ie383ea774ee31ef8fe255119095b21603483c33f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8424
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-18 07:05:48 +00:00
Shuhei Matsumoto
e6a9c4042d bdev/nvme: Rename nvme_bdev_ctrlr_destruct() by nvme_bdev_ctrlr_release()
The reference count of nvme_bdev_ctrlr will be used to update ANA log
page safely, and nvme_bdev_ctrlr_destruct() can be used to decrement
reference count after completing ANA log page update.

However, nvme_bdev_ctrlr_destruct() is not a good name for this case.
Furthermore, nvme_bdev_ctrlr_destruct() does not set the destruct flag
to true, and the next patch will need nvme_bdev_ctrlr_acquire().

Hence rename nvme_bdev_ctrlr_destruct() by nvme_bdev_ctrlr_release().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I285b7ab0963d0f4ea4a7a9fd29bd026d37ba8460
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8334
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-17 09:21:27 +00:00
Shuhei Matsumoto
0f4cebebbf bdev/nvme: Factor out registering nvme_bdev_ctrlr and populating ns into a helper function
Factor out registering nvme_bdev_ctrlr as io_device and populating
namespaces after creating nvme_bdev_ctrlr into a helper function.

We extract spdk_io_device_register() from nvme_bdev_ctrlr_create()
because free(NULL) is correct but spdk_io_device_unregister(NULL) is
not allowed, and hence it is very simple if we call spdk_io_device_register()
only after nvme_bdev_ctrlr is successfully created.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia4d85ccf96f3ef62e51db9d08ec606d4100c7ebd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8317
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-17 09:21:27 +00:00
Shuhei Matsumoto
fcad162082 bdev/nvme: Simplify error paths of nvme_bdev_ctrlr_create()
Reorder a few operations and increment nvme_bdev_ctrlr->num_ns
after allocating nvme_bdev_ctrlr->namespaces[i] successfully.

Then unify the goto label for error cases to err and the err label
simply calls nvme_bdev_ctrlr_delete().

There is one noticeable change in this patch. Previously the
controller had not been detached when creating nvme_bdev_ctrlr failed.
However, after this patch, the controller will be detached when creating
nvme_bdev_ctrlr failed. This will be reasonable change.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifd8c4649036f1c5e5cd688f89727b2bd2e982735
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8316
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-17 09:21:27 +00:00
Shuhei Matsumoto
9ffa69dc75 bdev/nvme: Inline _nvme_bdev_ctrlr_create() into nvme_bdev_ctrlr_create()
Inline _nvme_bdev_ctrlr_create() into nvme_bdev_ctrlr_create().

This simplifies the nesting structure.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I903a9cee670dc0bf32d272e8c1d18c98a51ade8a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8315
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-17 09:21:27 +00:00
Shuhei Matsumoto
7ea4a778a3 bdev/nvme: Consolidate populate_namespace_cb() calls for error cases into connect_attach_cb()
Consolidate populate_namespaces_cb() calls for error cases into
connect_attach_cb().  Then remove ctx parameter from
bdev_nvme_add_secondary_trid() because it is not necessary now.

The next patch will inline _nvme_bdev_ctrlr_create() into
nvme_bdev_ctrlr_create().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia94f456df160c1cc874acac4c70aad27102cb0b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8314
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-17 09:21:27 +00:00
Karol Latecki
d8e185348f doc: add link to SPDK Vhost 21.04 performance report
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I96de738eb414233a7423d96e723e6623d5365693
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8277
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-17 09:21:15 +00:00
Zhiqiang Liu
b4226d6f99 posix: set fd to -1 after close(fd) in posix_sock_create()
In posix_sock_create(), we loops through all the addresses available.
If something is wrong, we should close(fd) and set fd to -1, and
try the next address. Only, when one fd satisfies all conditions,
we will break the loop with the useful fd.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: Icbfc10246c92b95cacd6eb058e6e46cf8924fc4c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8310
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-17 09:18:08 +00:00
Zhiqiang Liu
aafc440e9c blobstore:fix memleak problem in blob_load_cpl()
In blob_load_cpl(), spdk_realloc() is called to realloc
memory of ctx->pages. If spdk_realloc() return NULL,
the ctx->pages is set to NULL without being freed,
and then a memleak problem occurs.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: Idf21b690e89beab0245ba57a5de66a4f506d54fb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8308
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-17 09:02:37 +00:00
Jim Harris
59c8bb527b nvme: do not try to resubmit requests on error
If the transport returns error when polling for
completions, it gets to a uint32_t and we end up
trying to resubmit all of the requests that are
currently queued.  But that's not correct - if
the transport returns an error we shouldn't be
trying to resubmit requests at all.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8395
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-17 09:02:14 +00:00
Jim Harris
7d5ba10581 test: add bdev_wait_for_examine in waitforbdev
This helps ensure that not only is the bdev available,
but that it has been fully examined by any upper
layer bdev modules before returning from this
waitforbdev function.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8394
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-17 09:02:14 +00:00
Jiewei Ke
adc2942ada nvmf: nvmf_ctrlr_get_log_page use iovs to store the log page
nvmf_ctrlr_get_log_page used req->data to store the log page result.
While the req->data only contains the first iov, if req->iovcnt is
larger than 1, the req->data may not hold the complete log page; and
even worse, the log page result may be written to invalid address and
cause memory corruption.

Change-Id: Ie6415a6bd2327419fe4b32f21ac814fd827c9e95
Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7970
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-17 09:02:02 +00:00
John Levon
342001e1ea env/dpdk: support additional core mask options
Currently, the SPDK "core_mask" environment option only supports setting either
"-l" or "-c". Allow applications to specify more complicated options by sniffing
for a leading "-", and passing that string through unchanged. This allows, for
example, --lcores to be used as described here:

https://doc.dpdk.org/guides/linux_gsg/linux_eal_parameters.html

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I38cc54bfcd356f3176cde7848e592525f9231e3d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7933
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-17 09:01:32 +00:00
Mao Jiang
f0f57a3fe1 test/nvmf/rdma: cases for rdma freeing request data
Change-Id: I3f95438482eb3b373592d2777cfdf28de34d6a30
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8375
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-06-17 09:00:45 +00:00
Changpeng Liu
ef7738b352 bdev/nvme: enable write zeroes split support in bdev layer
Change-Id: I4d54ac4b6aeaf1f1103c3ccb955da87334ce59f2
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7876
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-17 09:00:05 +00:00
Changpeng Liu
e7fbdf15fd bdev: add write zeroes split support
The common bdev layer will split large WRITE ZEROES ranges into
multiple children requests based on the backend device's setting,
it will try to split up to 8 children requests at a time to avoid
flood requests.

Also add UT to cover different cases.

Change-Id: Id9505fbe1c297412ef97b1f73587b22bc43f770e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7875
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-17 09:00:05 +00:00
Changpeng Liu
734de26066 bdev: use the same macro for both unmap and write zeroes
Change-Id: Id76d65dd84ac6377ca14b1671142c856c7d83b7e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7874
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-17 09:00:05 +00:00
Changpeng Liu
b71a8624cf bdev: add maximum write zeroes setting
Then we can enable the split for write zeroes request
in bdev layer.

Change-Id: I1341512994b061728cf8c94c0e4e7f86dbc53ce3
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7873
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-06-17 09:00:05 +00:00
Shuhei Matsumoto
074f503d27 scsi: Delete mutex from spdk_scsi_globals
This mutex is not used anywhere. After removing mutex from struct
spdk_scsi_globals, struct spdk_scsi_globals is empty. Hence then
remove struct spdk_scsi_globals. We can create struct spdk_scsi_globals
again if it becomes necessary.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I749ae43f7735a7c9383d090eae2093bb52607f17
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8192
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-06-17 08:59:18 +00:00
Shuhei Matsumoto
11d76e8c81 iscsi: Set resource pool size to the predetermined values to run with little memory
Add three parameters, pdu_pool_size, immediate_data_pool_size, and
data_out_pool_size to the RPC iscsi_set_options to run iSCSI target
with little memory.

For some use cases, we want to keep the max number of connections,
but simultaneously we want to reduce the pool size and let I/Os wait
until resource is provided.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I74dc785310b1d985f3e338c1e13fba3a3840d113
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8191
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-17 08:59:18 +00:00
Monica Kenguva
db8b121db0 test/pcie_common: changed the sequence of queued requests for CQ and SQ
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: If8937c01ca1d2ddfefa3c7472883a88879279165
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8284
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-16 17:59:41 +00:00
Zhiqiang Liu
8d7e75be24 nvmf: fix fd leakage problem in nvmf_vfio_user_listen()
In nvmf_vfio_user_listen(), fd should be closed before
set it to endpoint->fd, otherwise, the fd leakage probem
occurs.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: I3fabc65d2764926e5873475962e4362e46eb37e4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8309
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: sunshihao <sunshihao@huawei.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-16 09:01:00 +00:00
Zhiqiang Liu
14ad24c7b8 idxd: fix one memleak problem in spdk_idxd_get_channel()
In spdk_idxd_get_channel(), if chan->batch_base is allocated
faild, we should free chan before returning NULL.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: Ia652c334aead592429c1171da73d67160879686d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8301
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-16 09:00:48 +00:00
Zhiqiang Liu
3630473789 ioat: fix potential double free problem in ioat_channel_start()
In ioat_channel_start(), if spdk_vtophys(ioat->comp_update) returns
SPDK_VTOPHYS_ERROR, spdk_free is called to free ioat->comp_update,
and ioat->comp_update is not set to NULL. However, the caller
ioat_attach() will also call ioat_channel_destruct() to free
ioat->comp_update, then double-free problem occurs.

Here, we will not free ioat->comp_update in ioat_channel_start(),
ioat_channel_destruct() will do that.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: I3be19a3feec5c2188051ee67820bfd1e61de9b48
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8300
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-16 09:00:37 +00:00
Nick Connolly
f973413886 lib/nvmf: Use %z for portability
POSIX defines %z for printing size_t values in a portable way.
Replace a reference to %ld to remove the assumption about
the type of size_t.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I2186aa5e7072f565ea75de935e22c2c23acf1a1a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8341
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-16 09:00:25 +00:00
Nick Connolly
27f2d113c1 ut/bdev.c: Use PRIu64 for portability
POSIX defines PRId64/PRIu64/PRIx64 for printing 64-bit values in a
portable way. Replace a reference to %lu to remove the assumption
about the size of a long.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Id5690eb2ad501eaacb4b266981b4dba128a7b174
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8340
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-16 09:00:09 +00:00
Zhiqiang Liu
c269de97eb blobstore: fix potential memleak problem in blob_serialize_add_page()
In blob_serialize_add_page(), *pages is set to spdk_realloc(*pages).
If spdk_realloc() returns NULL, the *pages pointer will be
overridden, whose memory will leak.

Here, we introduce a new var (tmp_pages) for checking the return
value of spdk_realloc(*pages).

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: Ib2ead3f3b5d5e44688d1f0568816f483aa9e101f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8307
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-16 08:54:20 +00:00
Zhiqiang Liu
c9d8421590 spdk_top:check return value of strdup in store_last_run_counter()
In store_last_run_counter(), history->poller_name is set to
strdup(), which may return NULL. We should deal with it.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: Ice5f27c4a7d2f9abd528b97a48ff5f92b48c8d7c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8306
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-16 08:54:20 +00:00
Zhiqiang Liu
2ef4855e83 blobfs: check return value of strdup in spdk_fs_create_file_async()
In spdk_fs_create_file_async(), file->name is set to strdup(name).
We should check whether file->name is equal to NULL.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: I2219cc353eb4711290aee2599505f57af9088bb2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8302
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-16 08:53:36 +00:00
Zhiqiang Liu
d491e7ea33 blobfs: check return value of strdup in blobfs_fuse_start()
In blobfs_fuse_start(), bfuse->bdev_name and bfuse->mountpoint
are allocated by calling strdup(), which may return NULL.
Here, we will go to err if strdup() returns NULL.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: I0599254b3436a310ddd26732312281f07a4972ec
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8303
Community-CI: Mellanox Build Bot
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: Changpeng Liu <changpeng.liu@intel.com>
2021-06-16 08:53:21 +00:00
Jim Harris
d5af6a0417 iscsi: track whether io_device needs to be unregistered
If iscsi initialization fails (due to a memory allocation
failure for example), we may not even get to the point
where the g_iscsi global is registered as an io_device.
So then when we tear down the iscsi library using
spdk_iscsi_fini(), we need to make sure we don't
try to unregister g_iscsi if it wasn't registered.

For now, just use the g_init_thread global to make this
determination - it's set just after we register the
io_device.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8351
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-16 08:53:14 +00:00
Ziye Yang
b4af31de92 nvmf/tcp: fix the unexpected pointer access from mgmt_pdu
Because we use spdk_dma_malloc, then it does not init
the the contents in the memory.

Fixes #1996

Change-Id: Ieef411f6ae5114de9f732df6096e0bb123efb7e0
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8374
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-16 08:53:03 +00:00
Zhiqiang Liu
242eb6b4c2 nvmf:check return value of strdup in spdk_nvmf_subsystem_add_ns_ext()
In spdk_nvmf_subsystem_add_ns_ext(), ns->ptpl_file is set to strdup(),
which may return NULL. We should deal with it.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: If95102fe9d6d789b8ba9e846c4d7f4e22e48a93c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8305
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-15 23:39:17 +00:00
Zhiqiang Liu
e01a3f1c05 nvmf: check return value of strdup in spdk_nvmf_subsystem_disconnect_host()
In spdk_nvmf_subsystem_disconnect_host(), we should check
whether strdup() return NULL.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: I29cb6b2499ecd2a2367001c0d21ac95da4e10e20
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8304
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-15 23:39:17 +00:00
Ziye Yang
1e660daa8d accel_engine: fix the vector crc32c computing for hw path.
We face the checksum error when using idxd hardware in vector mode because
we put fields of internal function in wrong union.
When use vector crc32c operation, seed and chained functions and cb's will
be used in the same time, so we should not put them in the same union.

With this patch, we can fix the crc32c computing while using
the vector mode with iov_count > 1.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I7097b47294ffd5dcac7d7a83d583321a73dc50d2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8213
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-15 13:55:08 +00:00
MengjinWu
e54df32e6b lib/nbd: refine nbd stop process
nbd will be closed in nbd poller function asychronously.
Unify the stop process of HARDDISC and SOFTDISC in same place.
Prepare for following patch.

Signed-off-by: MengjinWu <mengjin.wu@intel.com>
Change-Id: Ida33ff6d081e68290cfa393c0c47fe7af545958b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8036
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-06-15 08:49:10 +00:00
Ziye Yang
9ab0ffcce2 nvme_tcp: Add data pdu crc32c offloading in receving side by Accel framework.
For receving the pdu, we add the crc32c offloading by Accel framework.
Because the size of to caculate the header digest size is too small, so
we do not offload the header digest.

Change-Id: If2c827a3a4e9d19f0b6d5aa8d89b0823925bd860
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7734
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-06-15 08:34:58 +00:00
Niklas Cassel
3edf255572 bdev/fio_plugin: spdk_fio_get_zoned_model() is too permissive
The .get_zoned_model() callback is supposed to reject unsupported
file types. Right now, we do not reject unsupported file types.

For our specific ioengine, this isn't strictly needed, since our
ioengine unconditionally sets f->filetype to FIO_TYPE_BLOCK, and if
it fails to find a SPDK bdev that matches the --filename, it will
return an error that it couldn't find the bdev matching filename.

However, all .get_zoned_model() callbacks in the fio in-tree ioengines
have a check that a given file has a file type that is supported by
the ioengine itself. This is needed since they do not set f->filetype
themselves, but instead let fio generic code initialize f->filetype.

Since we reuse --filename to mean something in the SPDK namespace, we
are force to initialize filetype manually. So that is the only reason
why we know that the file type will be FIO_TYPE_BLOCK. Anyway, let's
try to keep our code as similar to the in-tree ioengines as possible.

The SPDK nvme ioengine already has this check, so adding it in the
SPDK bdev ioengine makes our ioengines more consistent as well.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ib5e19c738dea0f8d41641b63d0fabe055a930827
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8329
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-15 08:34:36 +00:00
Niklas Cassel
1a7a599ba0 bdev/fio_plugin: initialize filetype to FIO_TYPE_BLOCK
fio will do certain actions depending on the backing file
type of the target that it runs against.
(E.g. if the zbd code in fio detects that the backing file
is FIO_TYPE_FILE, it will emulate zones inside the regular
file.)

Both SPDK ioengines reuse the filename option to not point
to an actual path exposed by the OS, but to instead point to
a device in the SPDK namespace.

Because of this, the file type detection in fio will fail,
and will always initialize filetype to FIO_TYPE_FILE.
Therefore, the SPDK ioengines will need to initialize
f->filetype themselves.

The SPDK nvme ioengine already initializes f->filetype to
FIO_TYPE_BLOCK unconditionally. Do the same in the SPDK
bdev ioengine.
(Just like in the SPDK nvme ioengine, we also need to call
fio_file_set_size_known(), so that fio generic code does
not try to initialize f->real_file_size.)

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I37df185524ed262cb875105f989685b740b430a3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8328
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-15 08:34:36 +00:00
Niklas Cassel
5172337d95 nvme/fio_plugin: spdk_fio_get_zoned_model() is too permissive
The .get_zoned_model() callback is supposed to reject unsupported
file types. Right now, we only reject FIO_TYPE_PIPE.

However, in attach_cb() our ioengine unconditionally initializes
f->filetype to FIO_TYPE_BLOCK. This means that the only file type
that our ioengine supports is FIO_TYPE_BLOCK.

Therefore, fix spdk_get_zoned_model() to reject everything that
we do not support.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I115bb8ff9c8ea9f647baebc0196900681a36c410
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8327
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-15 08:34:36 +00:00
Niklas Cassel
bd53d09c31 nvme/fio_plugin: remove ZBD_IGNORE usage
The define ZBD_IGNORE has been removed from upstream fio.

fio will now return an error if --zonemode=zbd is used with a
--filename that points to something that is unsupported by either
the zbd code in fio or by the ioengine itself.

ioengines are now supposed to return -EINVAL for unsupported files
(instead of returning 0 with ZBD_IGNORE for unsupported files).

This change does not need any special ifdef FIO_IOOPS_VERSION check.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I7bec0b1f5dc8f166ebf683f6f3937b2ef295a21e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8326
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
2021-06-15 08:34:36 +00:00
Jim Harris
c4fafdb215 env: only pass failing address to spdk_pci_error_handler
siginfo_t is a GNU extension.  SPDK (and DPDK) have
direct dependencies on GNU extensions, but it's a bit
nicer if external modules don't also need to define
_GNU_SOURCE.  Currently siginfo_t parameter in the
spdk_pci_error_handler is the only thing that violates
this.

Note that DPDK also supports registering sigbus handlers,
but they take the failing address as a parameter instead
of the full siginfo_t structure.  Let's adopt the same
for SPDK.

While here, remove an extra semicolon that was just after
the virtio sigbus handler function signature that was
updated in this patch.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I07faf11a3ac3589c637cb2196581c102286b1e68
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8333
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-15 08:34:28 +00:00
Jim Harris
f29acca244 util: use __typeof__ instead of typeof
'typeof' is a GNU extension - let's use __typeof__
instead which is ISO C compliant.

Allows building SPDK header files with -std=c11 as
long as _GNU_SOURCE is also defined.

Next patch will enable omitting _GNU_SOURCE as well.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ibd6c984627b553d6f87f302800abc52157fe9b1e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8332
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-15 08:34:28 +00:00
Jim Harris
74c88aa62b CHANGELOG: fix typo in nvme section
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iab746ba777b04152ffb92fea2a2bb923a0a0bf20
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8299
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-14 08:45:45 +00:00
Richael Zhuang
a272380e2c spdk_top: fix mismatch when displaying core info
The lcore id, idle time, busy time, thread count and poller count
mismatch in refresh_cores_tab() and show_core(). The index of
g_cores_history[] should be lcore id.

Change-Id: I0e95a49b2660f64c3601d5e520c6daab3aa9925b
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7855
Community-CI: Mellanox Build Bot
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: Krzysztof Karas <krzysztof.karas@intel.com>
2021-06-14 08:45:25 +00:00
Tomasz Zawadzki
286a43f512 scheduler_dynamic: move busy_threads_present
At this time only main lcore frequency is changed,
depending on its load either up or down.
Exception is when at least a single busy thread is present
on non-g_main_lcore. Then the main lcore frequency is set
to the maximum possible.

This patch moves when that is determined, from 'moving'
logic to one that sets reactors to interrupt mode.
If at least one thread is present on non-g_main_lcore,
it has to be busy. Otherwise it would be placed on main lcore.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I2900598afe53fb609e1f06a60d5245f74511e1c3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8050
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-14 08:44:39 +00:00
Tomasz Zawadzki
5e4fbe7364 lib/event: remove pending_threads_count from core_info
This field was only used to keep track of number of threads
that will be present on a core after scheduler moves.

It was used only internally within scheduler_dynamic.
Event framework has no need to keep such field in core_info.

Instead added field in cores_stats internal to scheduler_dynamic.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I3ce74d4a25eac81e58da8705a1c4553730fc1e57
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8049
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-14 08:44:39 +00:00
Maciej Szwed
4324834113 scheduler_dynamic: add core_stats
Added core_stats structure that will hold stats modified
during balancing.

Further patches will modify the values in this structure,
to for example judge how much execution time a core
has left.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib8e611e36642c4543b5cb43bc2695c613d38f0fc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6657
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-14 08:44:39 +00:00
Tomasz Zawadzki
abbfa1a5d1 lib/event: calculate reactor tsc from last scheduling period
This patch expands spdk_scheduler_core_info with two new
fields that will contain core stats only from last scheduling
period.

This will make sure that schedulers do not have to keep track
and calculate this value on their own.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I3aa7dfa6a60c1d14d95a0e684e84c2e83f0a4496
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8048
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-14 08:44:39 +00:00
Tomasz Zawadzki
da11c9d2a2 lib/event: fix refreshing tsc_last when returning to poll mode
(a5ad0f80) lib/event: update reactor tsc_last going poll mode
Patch above updated the tsc_last at the very end of changing
interrupt mode of the reactor.
The flow for turning from interrupt mode to poll mode is
first to send an event to the target lcore, then to iterate
over all reactors updating notify_cpuset on each.

Previous patch updated the tsc_last after notify_cpuset was
updated, meanwhile the threads could already been put on it.

This patch moves it immidietly to the point of changing
the in_interrupt state.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6aea252016f4706369b8b597b765593bc6edca3b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8111
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-14 08:44:39 +00:00
Tomasz Zawadzki
e837ba3bde lib/event: rename core_busy/idle_tsc to total_busy/idle_tsc
Renamed core_busy_tsc and core_idle_tsc to better
describe that they contain particular core stats for
its whole lifetime.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6f16b2b0a162aad8fbaf18f549fc50a2372b920b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8047
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-14 08:44:39 +00:00
Tomasz Zawadzki
902c9e4de7 lib/event: remove new_lcore from lw_thread
There is no need to keep new_lcore field.

lcore value is enough to determine the target core.
Meanwhile _threads_reschedule() can see if the target
core matches the one from core_info.

Removed _spdk_lw_thread_set_core() since it did not
serve much purpose.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I82c7cfebf1107b4a55b2af9b891052084a788907
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8046
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-14 08:44:39 +00:00
Tomasz Zawadzki
18667806ca lib/event: update lw_thread->lcore after thread move
lw_thread->lcore was set during gather_metrics,
rather than just after the thread reschedule.
This patch just moves it to the right place.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I0477830902f68102e4e4f0ffc9359bd004a8ad42
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7961
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-14 08:44:39 +00:00
Tomasz Zawadzki
d9f5da13e4 lib/event: change last_stats to only describe last scheduling period
So far the schedulers had to calculate the diff of
current_stats - last_stats on their own to get tsc
from last scheduling period.

Renamed the current_stats to total_stats, but kept the meaning
as stats describing tsc for lifetime of a thread.

Instead change the meaning of the last_stats to describe
the tsc of only last scheduling period and change its name
to current_stats.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1a165ff7c1afe659b432c3127a351a96878d1f3d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7843
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-14 08:44:39 +00:00
Ziye Yang
2cd948c4a6 sock/posix: fix the socket pipe_has_data or socket_has_data.
After reading the code in detail, I think that we should
not set pipe_has_data= true and socket_has_data at the same time.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I8f9f96b16f4f0e0c585877a0dd687a240252a7cf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8283
Community-CI: Mellanox Build Bot
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>
2021-06-14 08:44:28 +00:00
Michal Berger
1347830beb scripts/vagrant: Allow to mix CMB and PMR setup
As of latest qemu (>= 6.0.0) these can now be used together as
different BARs are used to accommodate for both.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Icf32f491fd33ef733f0d946f9b5caaeb87137d28
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8217
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>
2021-06-14 08:43:01 +00:00
Michal Berger
a5c3f72a89 scripts/vagrant: Initialize pmr_cmdline as an empty string
Having pmr_cmdline set to nil was for some reason breaking cmb setup
as weirdly enough pmr_cmdline was ending up being set to "true".
Avoid this by having pmr_cmdline set to some value, empty string in
this case.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ib41da699dcc2f213f0b18d21be3fd32f398bae41
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8216
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>
2021-06-14 08:43:01 +00:00
Michal Berger
22d7d62efb pkgdep/git: Update repo, branch of the vfio-user qemu fork
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Icd30d917f47f3585325ed689a5513b26f7d63d3b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8222
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-14 08:42:37 +00:00
Michal Berger
6b6c9db642 pkgdep/git: Make qemu's BRANCH vars global
This would make easier for the 3rd party tooling to adjust env for
the install_* routines.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ib5ea447bc67080f106cc43e005143bd52e91c768
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8122
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-14 08:42:37 +00:00
Jim Harris
815ce363a9 nvme: default use_cmb_sqs to false
Using the CMB for SQs is not a standard use case.
Performance can vary widely when using CMB for SQs
and is typically not the configuration used for
benchmarking.

So let's change the default value here to 'false',
users can still opt-in by setting this option to
true in the spdk_nvme_ctrlr_opts structure prior
to attach.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iab746ba777b04152ffb92fea2a2bb923a0a0bf21
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8227
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-11 22:12:08 +00:00
Krzysztof Karas
a01ad578a8 spdk_top: refactor data gathering to work per object type
Refactor data gathering functions to work per object type
and use more descriptive names.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Ie49f58b12e705615e9b92141e83306da102511c2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7388
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-11 09:40:46 +00:00
Krzysztof Karas
6726f45969 spdk_top: delete free_data() function
Delete free_data() function, because it is called only once
and contains only three lines of code. This is to make
spdk_top code cleaner.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I78e0edd941e8fb81ac58ea13bdc91148db0a2417
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7972
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-11 09:40:46 +00:00
Krzysztof Karas
3154d4c9b1 spdk_top: change initial refresh rate
This patch increases initial refresh rate for data gathering.
Initial refresh rate value was originally set to 1 microsecond,
which was too little for some values in tabs to refresh.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Ideeab28d3c2bbdd1133fa8706c8f2182948d7d5c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6445
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
2021-06-11 09:40:46 +00:00
Krzysztof Karas
0f5cd128ec spdk_top: fix threads_count assignment
threads_count inside show_core() function takes its value
from first core instead of the one selected by the user and
breaks core pop-up window.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I11710eaf061e7ead0fec46a0f9c47dd84d8d0209
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7588
Community-CI: Mellanox Build Bot
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: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-11 09:40:46 +00:00
Krzysztof Karas
d7d4a712cf spdk_top: change threads array inside refresh_threads_tab()
Changes number of allocated elements to RPC_MAX_THREADS in *thread_info[]
array inside refresh_threads_tab() to match other refresh functions.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: If62faed463f42f232693f5bdaea70a5bb248891f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7993
Community-CI: Mellanox Build Bot
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>
2021-06-11 09:40:46 +00:00
Krzysztof Karas
e9af400888 spdk_top: change where g_last_pollers_count is set
The goal of this patch is to set g_last_pollers_count
earlier than it was originally done to allocate less
memory for pollers array in refresh_pollers_tab(),
which is done in the next patch.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Id403af9b1c510abd7b6a1ac1742076590b1b37d7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7992
Community-CI: Mellanox Build Bot
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>
2021-06-11 09:40:46 +00:00
Krzysztof Karas
fbcfcb9807 spdk_top: separate data gathering logic from data display
Separates data gathering logic in tabs. Data is now being collected
on a separate thread.
Modified wait_init() and show_stats() to allow for thread creation
when starting spdk_top and thread join when closing.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I54a58522f31f938e2d1275c3a6f60fe8c17b0031
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6368
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: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-11 09:40:46 +00:00
Krzysztof Karas
57837813e3 spdk_top: fix threads assignment to cores in THREADS tab
FIxes incorrect cores showing for each thread in THREADS tab.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I661eac0cd70cf6ecf308dafaa940fcae8fd513f9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8153
Community-CI: Mellanox Build Bot
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>
2021-06-11 09:40:46 +00:00
Jim Harris
130c94c489 nvme: add quirks for new RedHat QEMU NVMe dev/vendor ID
QEMU 6.0 by default uses a RedHat dev/vendor ID rather
than the Intel one that has always been used to date.
We need the NVME_QUIRK_MAXIMUM_PCI_ACCESS_WIDTH quirk
so that we do not use wide instructions to copy SQEs
to a virtualized CMB, since QEMU does not support
that.

The NVME_INTEL_QUIRK_NO_LOG_PAGES quirk is only needed
for devices with SPDK_PCI_VID_INTEL, so we do not need
to carry this one over to the new REDHAT entry.

Fixes issue #1986.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3d339b3525e7c6ceb792eb9d143e7a922c19344d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8226
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-11 07:22:10 +00:00
Swapnil Ingle
2dd2d19768 bdev/nvme: Set bdev phys_blocklen
Set nvme bdev physical block size based value of NPWG and NAWUPF namespace
field.
The logic to set bdev phys_blocklen is based on how Linux nvme block driver
sets it. If the underlying nvme namespace supports NPWG/NAWUPF then bdev
phys_blocklen is set to min(npwg, nawupf)

Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Change-Id: I6d254a9e730dccc230b9db4d1217bf7ab2f39b6c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8224
Community-CI: Mellanox Build Bot
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: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-11 07:21:17 +00:00
Changpeng Liu
a119799b26 test/nvme/aer: remove duplicated changed NS list log
The NVMe driver layer will clear this log, so we don't
need to send another one in the aer callback.

Here we change the logic to compare with previous NS
state, if the NS state is same it will fail the test.

Change-Id: I6d80cb6a5f6d5eab92b8ccac601a23c19cea4003
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8175
Community-CI: Mellanox Build Bot
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-06-11 07:18:06 +00:00
Konrad Sztyber
441431d228 lib/trace: don't format arg's name while registering a tpoint
The arguments of a tracepoint are formatted when they're printed now, so
there's no need to append ":" or pad it with spaces.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I74f5568f1982dacc079e3b80bd19a9cd740b48ce
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7955
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-10 10:58:05 +00:00
Konrad Sztyber
462eb754a2 lib/thread: trace (get|put) IO channel calls
The traces record calls to spdk_(get|put)_io_channel() and saves the
reference count of the IO channel and its context.  The context, instead
of an IO channel pointer, was selected because the same pointer is often
used in other traces (e.g. nvmf's poll group), so it makes it possible
to match these traces together.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I15fe982a89685d8f6e23d406d6d48f5c2d9d604b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7232
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-10 10:58:05 +00:00
Konrad Sztyber
db35950a13 mk/unit: link with trace library
Linking each unit test with spdk_trace allows for getting rid of lots of
stub definitions for the trace functions.  The behavior stays the same,
as the trace calls result in no-op anyway because none of the unit test
apps enable tracing.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I904dac92205aadd644100af2c38989bb7979e47c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7231
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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>
2021-06-10 10:58:05 +00:00
Konrad Sztyber
62aa8bd8d2 nvmf/rdma: trace qpairs instead of rdma_cm_id
Both values should provide similar information, while the qpair can also
be matched to the traces from lib/nvmf allowing the user to track the
qpairs across these modules.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Iba9abdd3f41b93100c0403b1c90fc4549d39189e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7159
Community-CI: Mellanox Build Bot
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>
2021-06-10 10:58:05 +00:00
Konrad Sztyber
a266b6e4be nvmf: add traces around poll group lifecycle
The traces are tracking the lifecycle of a poll group: creating it,
adding and disconnecting qpairs, and finally destroying the group.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I075b7f24d14b8fbb42bb18ddd70a668a8bace118
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7158
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-10 10:58:05 +00:00
paul luse
db71eb6a4b lib/accel: add suport for batching copy + CRC32C command
Future patches will add vectored versions and accel_perf support.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I9cea07283bba871c6d026f8c61c2c9552eaaa23d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8147
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>
Community-CI: Mellanox Build Bot
2021-06-09 07:26:00 +00:00
paul luse
cfd37e28f1 lib/idxd: add support for batching copy + crc32c
Upcoming patches will add accel_fw support for batching this cmd
and then vectored versions later along with accel_perf to exercise
them.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I59f577f4365fbf063d7419cc6052e10c998b58bc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8143
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-09 07:26:00 +00:00
paul luse
a6c5480f1d lib/idxd: fix batch submission of crc32c
Was using reserved field. Similar fix to what was done earlier
for direct submission of crc32c operation.

fixes #1972

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ie9867e72f60c7f38aa1af0273a036f34580ed4c6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8145
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-06-09 07:26:00 +00:00
paul luse
fa99984283 lib/idxd: refactor batch prep command function
To match regular sumission prep function and allow caller to
modify both descriptor and completion structures.  Also allows
for more accurate error reporting.  Needed for upcoming patch to
fix batch CRC submissions.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I4b7b5b24e2f54149b513d4b23ba32f3802aff3e5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8144
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-09 07:26:00 +00:00
paul luse
f6ad617077 module/idxd: add support for copy + crc to idxd engine module
Upcoming patches will add support for accel_perf tool.  Also
following will come vectored support and batch versions.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I43bd11b8efe40e6df0e2c8bd2995b9a9341f6457
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8142
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-09 07:26:00 +00:00
paul luse
be8f5a3963 lib/accel: Add suport for copy + CRC32C to accel framework
Upcoming patches will add support for the idxd engine and
the accel_perf tool.  Also following will come vectored support and
batch versions.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I7223517a844525ad52ed49d65627b04c3cd9fe7c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8141
Community-CI: Mellanox Build Bot
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>
2021-06-09 07:26:00 +00:00
paul luse
1076008e63 lib/idxd: add support for new opcode to low level library (copy + CRC)
Upcoming patches will add support to the accel fw, the idxd engine and
the accel_perf tool.  Also following will come vectored support and
batch versions.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ie0fbd4b8da9f727426000898c0b511587adac65b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8139
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-09 07:26:00 +00:00
MengjinWu
ab5cc9dd6e lib/nbd: refine _nbd_fini process
_nbd_fini will make all NBDs into closing state.
remove _nbd_async, beasue it will call asynchronous error.

Signed-off-by: MengjinWu <mengjin.wu@intel.com>
Change-Id: Ifb873b7f079b735983bdf20c2df652be0a21919f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8035
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-09 07:25:44 +00:00
MengjinWu
628c230de4 lib/nbd: check if nbd is registered when start
Signed-off-by: MengjinWu <mengjin.wu@intel.com>
Change-Id: Ie6918e442724020e2be8f98cab971e1126ebb20a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8033
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Community-CI: Mellanox Build Bot
2021-06-09 07:25:44 +00:00
Changpeng Liu
67cf3e1c0a test/vfio-user: use variables to make each line more shorter
Also rename `muser` to `vfio-user` finally.

Change-Id: Iaf76a4bfc8f7a35621fcb60fd78cd145ea219269
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8167
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-09 07:21:31 +00:00
Changpeng Liu
5c680e29ea nvme/vfio-user: use the common request submission function
Change-Id: Ic2f6dedd0734373d23e80f7875640fb17db7b321
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8032
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-09 07:21:31 +00:00
Changpeng Liu
d4844d5b4e nvme/pcie: use nvme_pcie_vtophys in the submit request function
And for some internal functions we need to pass controller
parameter so that we can do vtophys based on transport type.

Change-Id: I3ca4fa162ec9305f62b295ba21f7474c21edfe52
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8031
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-09 07:21:31 +00:00
ChengqiangMeng
621d9d3f63 unittest/nvme_tcp: increase code coverage for nvme_tcp.c
some functions code comprehensive coverage.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: Iec707b2706cc873311eb2701f4f8c936de6e6b5a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8166
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-09 07:21:05 +00:00
Jim Harris
6564bd94ba nvme: fix DEFAULT_IO_QUEUE_SIZE_FOR_QUIRK handling
We need to wait to process this quirk until after we
have a valid CAP register value.  Before this fix,
controllers with this quirk would get their io_queue_size
always capped at 2 (min io queue size) because CAP hadn't
actually been read yet.

Fixes: f5ba8a5e (nvme: add NVME_CTRLR_STATE_READ_CAP)

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8211
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-06-09 07:07:50 +00:00
Changpeng Liu
5e4fe0adc8 nvme: inline nvme_pcie_vtophys
The inline function can also be used in the coming submit request
function.

Change-Id: If4a5511001e6586dbce0978298beddc537f54d8b
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8173
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-06-08 08:28:44 +00:00
Changpeng Liu
b69827a394 nvme/pcie: move nvme_pcie_qpair_submit_request() to pcie common layer
The PCIE and VFIOUSER both can use this function, the only difference
is VFIOUSER should use IOVA=VA to do the vtophys translation, so
here we will move the function to the common PCIe layer as the first
step.

Change-Id: I699edb67a00a2fa534072fc02ac2dd4a27aba8f4
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8030
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@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>
2021-06-08 08:28:44 +00:00
Shuhei Matsumoto
0e3d4ada7b CHANGELOG: Red-black tree was added by using FreeBSD under the same BSD license
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7bb15bae30dcea4c3e241506ae40d878f3479a6b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8071
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-08 08:28:26 +00:00
tyler_sun
4f4f505c77 nvme: get changed ns log once AER notice of ns changed received.
Each time the following file
"/sys/kernel/config/nvmet/subsystems/nqn_name/namespaces/ns_id/enable"
on the target side was changed, the SPDK initiator should receive an
async event (type: SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE, info:
SPDK_NVME_ASYNC_EVENT_NS_ATTR_CHANGED).
But actually not.
Since for SPDK, when target sent the non-first event, the condition
"nvmet_aen_bit_disabled(ctrl, NVME_AEN_BIT_NS_ATTR)" that prevents
target from sending event was matched.
This commit fix this issue by issuing a get_log_page cmd for each async
event received, just as the kernel initiator does.

Fixes #1825.

Signed-off-by: tyler.sun <tyler.sun@dell.com>
Change-Id: I2973470a81893456ca12e86ac390ea1de0eed62c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7107
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-06-08 08:28:06 +00:00
Yuri
d63fbc8a8e nvmf: allow poll groups to run on a subset of cores
In order to avoid latency imbalances, the user can specify a cpu mask
on which the poll groups should run. This code update added data structures
to control set of CPU cores.

Change-Id: Iaf69d75da2fc6fed350d97d11027ce09e9432210
Signed-off-by: Yuri <yuriy.kirichok@hpe.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5610
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-08 08:27:37 +00:00
Jim Harris
e0c9c640c6 doc: add a page for USDT
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I5aa5ec3c3fc695a2555a34ac4e119e256da464a5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7195
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-06-08 08:27:15 +00:00
Jim Harris
3a0f624499 nvmf: add USDT probes for subsystem state changes
Also add scripts/bpf/nvmf.bt to enable and log these
probes.

This patch also adds a script that can generate
a bpftrace script snippet with string maps for
needed enumerations (currently nvmf_tgt_state and
spdk_nvmf_subsystem_state).  This allows us to
dynamically generate this from the source code, and
can be extended for other enums we may want to
add in the future.

Thanks to Michal Berger for converting my original
gen_enums.py script into gen_enums.sh!

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Iff34a6218aef40055ac14932eea5fc00e1c8bcf5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7194
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-06-08 08:27:15 +00:00
Mao Jiang
109106d888 test/nvme_ctrlr: cases for setting supported log pages
Change-Id: Id92a2de7899696abd428fe5e7ac56abc683117cb
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8155
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-08 08:26:46 +00:00
Mao Jiang
e8c8d4ebc7 test/pcie_common: cases for connecting qpair
Change-Id: If03ff8d382c663d1f1e291a2e9c84e7c0b1cd7a9
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7994
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-06-08 08:26:37 +00:00
GangCao
9cedc7202c Util: check the error case of NULL pointer
Change-Id: I0be36b584c99de822920b935c34708576617ffc3
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8176
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-08 08:26:12 +00:00
Nick Connolly
5a21edf4e3 scripts: add autotest support for Windows
Source Windows specific definitions from common.sh. These adjust
uname to report the operating system as WSL, Msys or Cygwin and the
kernel name as Windows.  They also define kill() to invoke the SIGTERM
handler before causing a hard stop with TerminateProcess.

Adjust the ordering of the 'source' commands in autotest_common.sh so
that the config definitions are available when common.sh is loaded.
Define MAKE, MAKEFLAGS and HUGEMEM for Windows.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I130b892ee55c925a0b033bda271a29133993afb7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7101
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-08 08:19:32 +00:00
Michal Berger
93e6e40442 rpmbuild: Allow to define custom builddir
Alternative for the default of $HOME/rpmbuild.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Id1feb7207926b518deb87045fc17bb3d1d4c374e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8159
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>
2021-06-08 08:18:36 +00:00
Michal Berger
ab7bd10ad9 test/common: Remove BASH_XTRACEFD echo
This was added only for testing purposes. Right now it just
unnecessarily makes the build logs bigger and spams the stdout.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Id8ff3e1dfde955dc118e0a202897d6c6634c3995
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8194
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-08 07:13:17 +00:00
Jim Harris
3a7a66e505 nvme: add wmb before writing shadow register
Fixes issue #1828.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I02ba897b6c10f4ec870f46825f09e00f0c7c0235
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7905
Community-CI: Mellanox Build Bot
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>
2021-06-07 23:34:30 +00:00
Jim Harris
c754043946 Revert "thread: speed up io_device lookup by using rbtree"
This reverts commit 2246a93718.

We are seeing a lot of failure on io_device lookup in the test
pool.  These only showed up after this patch was merged and sees
the most likely culprit.  Reverting this patch for now while we
continue debug.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2ab098319dfae3a5356eb4fe0dbf9f4af2d2eea5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8199
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-07 16:17:33 +00:00
Michal Berger
9d8e1ec03c test/common: Reset IFS within print_backtrace()
In case IFS was modified in the environment where print_backtrace()
was called, it could impact the cmd substitution used for seq'ing
the main FUNCNAME loop. Example:

========== Backtrace start: ==========

/home/vagrant/spdk_repo/spdk/test/common/autotest_common.sh: line 980: 1
2
3
4: syntax error in expression (error token is "2
3
4")

Avoid that by resetting the IFS to its default value, but also,
replace said $() with arithmetic evaluation to avoid it altogether.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I4ab098319dfae3a5356eb4fe0dbf9f4af2d2eea6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8013
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-06-07 07:26:27 +00:00
Mao Jiang
8742570d72 test/nvme_tcp: cases for handling pdu payload
Change-Id: I1bba56ec5f3061362deac1470cb7b53461f7006e
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8092
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-07 07:25:01 +00:00
Mao Jiang
e9d964bd3c test/nvme_opal: build nvme_opal unittest file
Change-Id: I74bd112800f0d8369bc4d4b7a02080fe3e6cbd1c
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6695
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
2021-06-07 07:24:47 +00:00
Karol Latecki
6d93f9ef67 test/common: update vfio-user capable Qemu branch
This should be vfio-user-master now. vfio-user-v0.6
branch is obsolete.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: Iaa0b429c4de13c59e1f58fe59149367f941d42f2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8062
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-07 07:24:32 +00:00
Mao Jiang
984fdca853 test/nvme_fabric: cases for fabric qpair connecting
Change-Id: I8b7babc5c3feb87c2b38c79dbf3cd158e2178162
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7580
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-04 22:56:36 +00:00
Mao Jiang
da71236778 test/nvme_pcie: cases for pmr mapping
Change-Id: Ie5af8012c15d63625abc4fe92e905aa6a9dc619c
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7943
Community-CI: Mellanox Build Bot
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>
2021-06-04 22:56:28 +00:00
Michal Berger
9c3ba11a29 test/vhost: Commonize some of the environment
Also, remove the unecessary FIXME.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I3feda936cff62d79e921247dd40613c389ac3a3c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6586
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-04 22:52:21 +00:00
jiaqizho
81a8bc670c iostat : add -x to display extended statistics
Signed-off-by: jiaqizho <jiaqi.zhou@intel.com>
Change-Id: Ia25257093a13987c40a682c9b5ace4daa15ac607
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4847
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>
2021-06-04 22:47:44 +00:00
Jiewei Ke
84588b3ba8 util: rename RB_ROOT into _RB_ROOT
In examples/bdev/fio_plugin/fio_plugin, it will include fio.h which
defines the RB_ROOT macro. To workaround the RB_ROOT redefined error,
rename RB_ROOT to _RB_ROOT.

Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Change-Id: Ied4f835e4d1657ca5a0a80c13c72845c774618d8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8044
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>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-04 22:46:40 +00:00
Jiewei Ke
2246a93718 thread: speed up io_device lookup by using rbtree
Use the macros for red black tree provided by Free BSD to speed up
io_device lookup.

Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Change-Id: Ib3bd382bbeb610503194e7d7bfd569f60a0d0121
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7894
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-04 22:46:40 +00:00
Mao Jiang
661825cfc9 test/nvme_ns_cmd: cases for namespace command reading and setup
Change-Id: I774c386480bc5fb20ce40a58ce9b72798f280e6d
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7029
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-04 22:14:58 +00:00
Karol Latecki
7cccf5c5f4 test/common: update irdma driver version to 1.5.2
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I696870dbdc9fa654e270d9fe76f12b7044455527
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7946
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-04 22:14:42 +00:00
Changpeng Liu
45b5676738 nvmf/vfio-user: rename vfio_user_stop_ctrlr() to vfio_user_destroy_ctrlr()
The original function will disconnect queue pairs first and then free
controller memory finally, so rename it to vfio_user_destroy_ctrlr().

Change-Id: Idc235e4186bd4164be712fc9d4cda4991efc6248
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7624
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: <dongx.yi@intel.com>
2021-06-04 22:14:23 +00:00
Changpeng Liu
0cc8bcf508 nvmf/vfio-user: rename destroy_ctrlr() to free_ctrlr()
The coming destroy_ctrlr() function will disconnect
queue pairs and free controller at last, so here
rename the original destroy_ctrlr() to free_ctrlr().

Change-Id: I527b2742142d60b0383be5a12391c77dd50d47a7
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7623
Community-CI: Mellanox Build Bot
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
2021-06-04 22:14:23 +00:00
Changpeng Liu
3d4b9ba0d4 nvmf/vfio-user: rename destroy_qp to free_qp
The original destroy_qp() only release the queue pair
related memory, and free_qp() will be called inside
destroy_ctrlr() function, so also remove one duplicated
line here.

Change-Id: I2a06a6704b514361685068acda4e65ed5d502f0d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7622
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
2021-06-04 22:14:23 +00:00
Changpeng Liu
12de3673f0 nvmf/vfio-user: remove controller ready field
The controller concept in NVMf is like a session, for any
new connection in nvmf_vfio_user_accept() with the endpoint,
we treat it as a new controller, we don't need the `ready`
field in controller to indicate the connection state, we
need the connection state in endpoint, so here just use
endpoint->ctrlr point to indicate the socket connection
is valid or not.

Change-Id: I588dbba7973cb61a1d79d81324a43e052f7dafb0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7621
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-04 22:14:23 +00:00
Michal Berger
e9a4350381 pkgdep/git: Patch QAT driver for changes in crypto API
Details here:

git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0eb76ba29d16df2951d37c54ca279c4e5630b071

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ica523bc4ec6b68fab2549a02476872b4d250a8f0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8041
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-04 20:11:58 +00:00
Shuhei Matsumoto
b7cc001a04 bdev/ocssd: find_io_path() returns bdev_ocssd_ns and spdk_nvme_ns pointers directly
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifd5a3f5ab2e87d383da1c3b94949fa2ffd916ecc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8150
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-04 20:11:42 +00:00
Shuhei Matsumoto
55e4be3432 bdev/nvme: find_io_path() returns spdk_nvme_ns pointer directly
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3f2b047c162c7d9cab69c273ca8ac5c2236314fa
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8149
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-04 20:11:42 +00:00
Shuhei Matsumoto
980b501c98 bdev/nvme: Separate helper function find_io_path() between nvme and ocssd
This enables us to optimize nvme_bdev for multipath.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I09dcc6b34b4529fe1f90dbe0fddcbee807cf217e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8148
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-04 20:11:42 +00:00
matthewb
6127461c93 lib/bdev: Added iov to spdk_bdev_zcopy_start
Adding iov to the spdk_bdev_zcopy_start function enable spdk_bdev_zcopy_start to
be used by transport layers as the iov is owned by the transport command

Signed-off-by: matthewb <matthew.burbridge@hpe.com>
Change-Id: I6d2be7f49566048bf25b7711ada8d2fb49fea6ee
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6816
Community-CI: Mellanox Build Bot
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>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-06-04 20:10:07 +00:00
matthewb
51d7f9b13f lib/bdev: Removed ZCOPY emulation
ZCOPY emulation is not required. Modules can check if the bdev module
supports ZCOPY.  If not supported the module uses the existing
READ and WRITE operations.

Signed-off-by: matthewb <matthew.burbridge@hpe.com>
Change-Id: Idac0a4d27a79a6c7e567c420e15637e826c347c8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6815
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
2021-06-04 20:10:07 +00:00
Jim Harris
b333f00627 nvme: save last transport_failure_reason in transport
If a reconnect fails, we restore the original
transport_failure_reason after we're done with
the failed reconnect.  Save the original reason
in the qpair itself rather than a local variable,
to facilitate upcoming changes where connect will
be asynchronous.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I20ff43fc687a379aa5c930e17cf3ff8d730320be
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8116
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-04 20:03:25 +00:00
Jim Harris
43b4883217 nvme: don't reinit qpairs for vfio-user during reset
Previously we were only checking trtype==PCIE to
determine whether a controller was fabrics.  This
skipped the vfio-user case.  So use the new
spdk_nvme_transport_id_is_fabrics() API instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I81f26853f44b1c47522ce6354e5aa4a905796bd0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8089
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-04 20:03:25 +00:00
yupeng
b832f99f88 nvmf: Add nvmf_set_crdt RPC
Set the three CRDT values at SPDK_RPC_STARTUP time.

Signed-off-by: Peng Yu <yupeng0921@gmail.com>
Change-Id: I2fb4c4a3e367a4888cfec4658e6bf6899c7ae1f4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8007
Community-CI: Mellanox Build Bot
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-06-04 20:02:42 +00:00
Ziye Yang
26004a40fb accel_engine: Use the vector based crc32c function.
Purpose: Use the new function in order to reduce duplicated code.

Change-Id: Ie848c7586575b3f0bb617d7e767cf459b43d4783
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8174
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-06-04 20:01:20 +00:00
Michal Berger
c2feee4fef test/common: Free stderr fd from tracing
Consider this:

foo() { echo bar >&2 ; }
set -x
foobar=$(foo 2>&1)
[[ $foobar == "bar" ]]

The above test will fail since $foobar will also include tracing
strings as stderr is where set -x redirects the output. Since in
some cases this may troublesome, replace stderr with a dedicated
fd allocated dynamically.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ia6609e4463b371c07fab42d2bd291c9e43742df5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8158
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-04 19:58:56 +00:00
Michal Berger
70f7ea3e30 test/nvmf: Simplify get_nvme_devs()
This function was unintentionally including trace lines in its output
by playing with stderr (where -x is redirecting its output by default).
Avoid that by simply listing the devices and doing proper checks from
within the actual test.

Spotted in https://github.com/spdk/spdk/issues/1973

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: If15375aca152aaa49267c9cc51e70fd859685ea1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8156
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: Ben Walker <benjamin.walker@intel.com>
2021-06-04 19:58:56 +00:00
Curt Bruns
522faef3e2 nvme: add cuse support for RESCAN IOCTL
Nvme-cli submits a RESCAN IOCTL after a format command to
update any information that may have changed during the
format, such as LBA Format.  This patch adds support
for RESCAN by executing nvme_ctrlr_update_namespaces to
update the controller information.

Fixes: #1964

Change-Id: I9f03e00a7f39339947ff02390f69ce806e1cfa0e
Signed-off-by: Curt Bruns <curt.e.bruns@gmail.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8146
Community-CI: Mellanox Build Bot
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: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-06-04 19:58:41 +00:00
Tomasz Zawadzki
47a6578ee5 lib/event: calculate last_stats in event framework
Rather than to rely on schedulers to access and modify
last_stats values over multiple scheduling periods, move that
operation to event framework.

Providing this to the schedulers in generic manner is better
than enforcing that each scheduler has to keep track of this
data on their own.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Icaf3b4af80d86fafaddf328fd230db9743d21ab5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7971
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-06-04 19:58:24 +00:00
Tomasz Zawadzki
005b22d299 ut/event: fix test_scheduler UT
This UT was not working as intended, and was covered by
scheduler implementation and direct modification
of the lw_thread stats in UT.

A single _reactor_run() iterates over all active pollers.
If at least one returns busy, so does the thread.
Thread load at the begining of UT is not 'low', but 100% busy.

To emulate loads outside of the 100% busy/idle, multiple
spdk_thread_polls need to be exectued.

As such to keep this case simple, the busy poller is removed.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I21b4c607977ed5926e0bb2743c33636cfc49f328
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8021
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.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>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-06-04 19:58:24 +00:00
Tomasz Zawadzki
dd743a3285 ut/event: verify tsc stats in test_scheduler
At no point in the UT thread and reactor stats
were verified. This patch makes sure that those are
checked and points out a glaring issue fixed in the
next patch.

Please note that spdk_get_ticks() and spdk_delay_us()
increase a single global value, which does not play
well with tests simulating multiple reactors.
As such each round through reactors resets the
global timer and verifies it at the end.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I27878fe35c1606ec20c548fe3bb5ede0102c8a63
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8020
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.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>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-06-04 19:58:24 +00:00
Changpeng Liu
a7f526ba1a nvme/opal: check Security Protocol 00h before sending TCG SP
A Security Receive command with the Security Protocol field cleared to
00h shall return information about the security protocols supported by
the controller, so we can check the TCG security protocol is supported
or not before sending it.

Fix issue #1961.

Change-Id: Id061defe45db981b276e2794fd0b59f8db70b7f4
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8083
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.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>
2021-06-04 19:57:36 +00:00
Changpeng Liu
1136107e21 nvme: optimize the error log when OPAL isn't supported
We will print a notice log if the drive can support SECURITY
SEND/RECEIVE commands but not OPAL, so remove the error logs.

Change-Id: Ib26aa727ad1e703d53c387af8507b920606ea9c6
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8055
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.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>
2021-06-04 19:57:36 +00:00
paul luse
475fadf365 examples/accel_perf: don't allocate channel just to get engine caps
Getting/putting the channel races with getting real IO channels
causing issues with an upcoming design. Avoid it entirely by using
the first worker channel to get the capabilties.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I750a8d59e294f4cda9f71f3327afc03e15342768
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8170
Community-CI: Mellanox Build Bot
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>
2021-06-04 15:48:22 +00:00
paul luse
f31ad9b6f1 lib/idxd: add cache control flag to op codes that support it
Perf improvement, directs DSA to write to cache as opposed to
mem.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I0d6ba157af8f1b54f8aae3b8e54a6f7754e4a9de
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8169
Community-CI: Mellanox Build Bot
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>
2021-06-04 15:48:22 +00:00
paul luse
3e2e2a5765 examples/accel_perf: don't schedule final callback when using HW
This results in a significant performance improvement when using
HW offload engines.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I54d3e39f186c9f878fcf8bed8e9242e29d1e1bf1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8162
Community-CI: Mellanox Build Bot
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: Ziye Yang <ziye.yang@intel.com>
2021-06-04 15:48:22 +00:00
paul luse
2e8ae7294a lib/idxd: stop polling on the first uncompleted location
We already keep a list of outstanding completion locations to
poll and were previously polling all of them.  New ones are
added at the tail and we poll the oldest first from the head
so if we break when we find a slot that hasn't completed we
can get more work done while the HW finishes. This is a proven
performance improvement in limited testing.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Icc15041605586f9a31435d447d253c381c00b1f8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8161
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-04 15:48:22 +00:00
Changpeng Liu
c52e700774 libvfio-user: update submodule
1. struct pxdcap.per is changed to struct pxdcap.rer
Which matches the name in the nvme spec.
2. use new API return value.
3. update specification changes.

Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Change-Id: Ida421c4cffd1c65d550e83011ab123b321ea9dff
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8088
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-03 04:03:04 +00:00
Changpeng Liu
5b532e80c8 test/vfio-user: add subnqn for all vfio-user tests
After commit a31e319f "nvme: init discovery ctrlr using nvme_ctrlr_process_init"
SPDK will not initialize vfio-user subsystem if we didn't specify it
in the command line, so add this parameter as other transports already use it.

Change-Id: I5331459e9a88d8d94fa8b6ce693e086516b9f0bc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8120
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-03 04:03:04 +00:00
Changpeng Liu
b70b16acba nvmf: don't use request internal variable after req_complete callback
vfio-user transport `req_complete` callback will zero the internal
NVMe command and response fields, the common NVMf library should
not use them after the callback, so here we use stack variables
to save them before the `req_complete` callback.

Fix issue #1965.

Change-Id: Iff2342b6095d9496cdf112d657a0a99ce1fb5d12
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8129
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-03 04:03:04 +00:00
Shuhei Matsumoto
fdc4c13e9e bdev/nvme: Rename nvme_io_channel by nvme_io_path
By the next patch, nvme_io_channel will be used as an I/O channel
to a single nvme_bdev. This channel is created to a single
nvme_bdev_ctrlr and has a corresponding I/O qpair. nvme_io_path
will be a better name especially when we support multipath.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic34162f3c383676c5249396a09173329fc6febce
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8095
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-02 11:37:58 +00:00
Shuhei Matsumoto
5863f95ae4 bdev/nvme: Submit abort command for admin command on the current thread
Previously only a single thread could submit abort commands for admin
commands and it was the thread of the corresponding controller.

When we support multipath, we need to traverse the list of controllers
to which the target admin command is submitted. Threads of controllers
may be different.

On the other hand, the previous implementation made the I/O flow very
clean, but the I/O flow will not be clean if there are many controllers
and the subsystem does not have its thread.

This patch changes the policy so that any SPDK thread can submit abort
commands for admin commands.

Then when multipath is supported, we will be able to traverse the
list of controllers simply on the current thread to abort either I/O
command or admin command.

We already are able to submit any admin command on any thread anytime
including abort command. Hence this will not cause any issue.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib69de33f2e84b03861c7d95ce060035bdb589e4b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8121
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-02 11:37:58 +00:00
Shuhei Matsumoto
a4f96d93a8 nvme: Initialize ANA state to optimized if ANA reporting is not supported
Initialize ANA state of each namespace to optimized regardless of
whether ANA is supported or not. This will simplify the code to get
the optimal I/O path because we do not have to care if the namespace
supports ANA.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I24dfe08674af398671de6528b884e9d82409eeae
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7890
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-02 11:37:58 +00:00
Shuhei Matsumoto
a3f581e83b bdev/nvme: Inline nvme_bdev_to_bdev_ns() and remove it
It is unlikely that managing namespaces by nvme_bdev is complicated.
Hence we do not need the helper function nvme_bdev_to_bdev_ns().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I77b4dcd12b2f2a219f58e5bc7b7e51dd10635da4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8118
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-06-02 11:37:58 +00:00
Shuhei Matsumoto
d4558c6132 bdev/nvme: Reduce conversion between spdk_bdev_io and nvme_bdev_io
We can hold bdev_io directly in nvme_bdev_ctrlr as an outstanding reset.

We can put spdk_bdev_io_from_ctx(bio) into a parameter for a few
functions because it is used only once in a function.

Passing not spdk_bdev_io but nvme_bdev_io to bdev_nvme_verify_pi_error()
remove unnecessary substitution.

This is a little more efficient and simplifies the implementation.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If49ad9fa42abf27decf3afcd8c994f55faa3bc70
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8094
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-06-02 11:37:58 +00:00
Mao Jiang
f70180d50d test/nvme_cuse: cases for cuse submitting io
Change-Id: I21f640c1d633884543961b382c400449caba241b
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6935
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-06-02 11:37:33 +00:00
Ziye Yang
b85127cc6f util/crc32c: Add spdk_crc32c_iov_update.
Purpose: To support caculating crc32c for iovs.

Change-Id: I7ea6d8b71ea2cf6e8b81903439787870923b9bef
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8093
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-06-02 11:37:17 +00:00
Ziye Yang
ee8f6dd1d5 sgl.h: Add a new internal header file.
The purpose is to reduce the duplicated code in nvmf and iscsi
layer.

Change-Id: I7e96f0d5bb1ba4b81378addca3cdd929056384e9
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8132
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
2021-06-02 11:34:27 +00:00
ChengqiangMeng
6a49507c47 unittest/nvme_rdma: increase code coverage for nvme_rdma.c
nvme_rdma_parse_addr and nvme_rdma_qpair_init code comprehensive coverage.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: I7474281a2b80c092f0ed516e1da3649473eb0fa3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7337
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-06-02 10:23:51 +00:00
Jim Harris
9f5e3c99f2 nvme: add spdk_nvme_ctrlr_is_fabrics()
We map the SPDK_NVME_TRANSPORT_* values directly to
the NVMe-oF trtype values.  Since PCIe isn't
Fabrics, we choose 256 which is outside of the
8-bit trtype range of values.

So we can just check if trtype >= 256 to determine
if the trid is for fabrics or not.  This is
preferable to checking PCIE || VFIOUSER in case
additional non-fabrics transport types are added
in the future.

I considered taking a trid as the parameter instead,
but went this route since it is consistent with
the existing spdk_nvme_ctrlr_is_discovery().

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib62ff4d30549b2324486c81f2dce67f0f1741e9b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8077
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-06-01 07:43:12 +00:00
Jim Harris
d6f6ffd274 nvme: add NVME_CTRLR_STATE_CONNECT_ADMINQ
Connect the adminq as part of controller initialization
instead of controller construction.

We never actually 'connected' the adminq for
PCIe or vfio-user transports, since its a nop.
But their connect_qpair transport ops function
is also a nop for the adminq, so it's fine to
generically connect the adminq across all transports.

Note that we cannot read registers (cc or csts)
during controller initialization now until after
the adminq has been connected since reading fabrics
registers depends on a connected adminq.  This gets
special cased for now, but eventually reading
cc and csts will need to be part of the state machine
itself to make it asynchronous.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia5566d7c549d78d24b94ea253df51e697da6237f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8079
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-06-01 07:43:12 +00:00
Mao Jiang
0651ffe3f1 test/nvme_rdma: cases for rdma group connecting qpair
Change-Id: Ia2d76fb364671971d3c78555ab203c3c565ec2f3
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8029
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-06-01 07:42:55 +00:00
Ziye Yang
252430a053 nvme_tcp: Correctly handle the data digest err
According to NVMe-oF 1.1 spec, it is not a fatal error.
So according to Figure 126 in NVMe Base specification,
we should return "Transient Transport Error".

Change-Id: I601304ae2bb24508882fb1ec8c7e53ec587ab515
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7795
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-05-31 07:15:16 +00:00
Michal Berger
860a61f6eb autobuild: Export EXTERNAL_MAKE_HUGEMEM if set
EXTERNAL_MAKE_HUGEMEM can be currently used from the external_code
suite.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I4359edc62ebdee91b261133877523c52175cb248
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8059
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-05-31 07:14:28 +00:00
Michal Berger
3a53213fb3 autobuild: Run scan-build under a dedicated test flag
Also, move ocf build outside the autobuild suite to make sure
scanbuild also picks up all the pieces.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I5f0de407cc55b1dc153cc856f68e053a54fc0682
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6841
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-31 07:14:28 +00:00
Karol Latecki
4e4c2cd8e3 scripts/nvmf_perf: make rate_iops actually optional
Change-Id: Ie46df6e4f52b59941a90eeb786954fe7d5f1d089
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8040
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-28 14:25:54 +00:00
Jim Harris
a31e319fbb nvme: init discovery ctrlr using nvme_ctrlr_process_init
This ensures the discovery ctrlr initialization is
done the same as normal ctrlrs.  This will be
critical as we make the driver fully asynchronous.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I33c4fd7c82d241c30e7adb89abe79b8088c8776a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8090
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-28 08:14:06 +00:00
Jim Harris
f5ba8a5ef5 nvme: add NVME_CTRLR_STATE_READ_CAP
Read CAP (Capabilities) register as part of controller
initialization instead of controller construction.

For now, still read CAP in the pcie and vfio-user
controller construction, since they need the
drstd (doorbell stride) to construct the admin
queue.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I000fe880f2ec0d6de1d565c883d7ea0ae1ac2c81
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8078
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-28 08:14:06 +00:00
Jim Harris
df01076f70 nvme: add NVME_CTRLR_STATE_READ_VS
Read VS (Version) register as part of controller
initialization instead of controller construction.

This prepares for upcoming changes to make
controller attach fully asynchronous.  Since reading
fabrics registers is an asynchronous operation, it
will be easier to read the VS register as part of
controller initialization which operates as an
asynchronous state machine.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I771386dbdf5902633e0d9f91b3b20be98f26fdc3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8076
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-28 08:14:06 +00:00
Jim Harris
a12cf26cdd nvme: add NVME_CTRLR_STATE_CHECK_EN
We're going to be adding some new states (READ_CAP
and READ_VS) in future patches, that we want to
come before the current "INIT" state.

So we will simply make "INIT" have the same
value as this new NVME_CTRLR_STATE_CHECK_EN state
for now.  That means existing code won't have to
change later once we add new states that come
before CHECK_EN.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I07ca92e28ab1cd8d838cdef5c3ff36ba80a224bf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8075
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-28 08:14:06 +00:00
Tomasz Zawadzki
3db73426f2 lib/event: update current_stats at the time of thread reschedule
_reactor_schedule_thread() zeroes out the lw_thread on move.

To properly calculate thread stats since the move,
save them right after reschedule.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I44cc3b5907adda35b3117c2dd7268dc813d59853
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7919
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-28 08:13:48 +00:00
Tomasz Zawadzki
e0d448e7f6 lib/event: remove snapshot_stats
spdk_thread keeps track of tsc from its whole lifetime,
those can be requested with spdk_thread_get_stats() at any time.

spdk_lw_thread uses stats from above and keeps track of two points in time:
- current_stats reflecting stats at the time of gather_metrics stage
- last_stats reflecting stats from previous gather_metrics stage

1)
Before this patch current_stats were duplicated in snapshot_stats.
There is no need for that so now they are removed.

2)
Removed _spdk_lw_thread_get_current_stats() since it would be copying
current_stats to current_stats, thus not perform any action.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I5e5d4039cd0f7cc10ba150a3d915b90ec96589d7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7842
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-28 08:13:48 +00:00
Tomasz Zawadzki
0598e484d7 lib/event: set thread for each event executed
Whenever an event executes, it might change the currently
set thread or reset it to NULL.
To prevent it from affecting other events, set the current
thread each time an event executes.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6f1e7f8b7acab25353b4782058e87a9e01aab2c8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8045
Community-CI: Mellanox Build Bot
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>
2021-05-28 08:13:48 +00:00
Tomasz Zawadzki
a4bf3e1099 scheduler_dynamic: exit early from _get_thread_load()
_get_thread_load() is function used to determine
the load of a thread based on relation of busy/idle tsc
from previous scheduling period.

In order to avoid division by 0 calculating the percentage,
we can simply exit early determining that thread was not
doing any work.

Having this check here will make sure that no matter
the changes in event framework, scheduler dynamic will work.

Removed the place that updated last_stats if they weren't
yet updated at least once (first scheduling period iteration).
In this case after change to _get_thread_load() will be the same,
as only the latest iteration will be used to calculate thread load.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I75f0f12f024675f2473a26e30596d6eb28093d46
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7917
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-05-28 08:13:48 +00:00
Ziye Yang
d172854aa7 configure: Fix the nasm version detection.
I used the nasm with unstable version while compiling SPDK with ISA-L.
And when running nasm -v, it shows:

NASM version 2.16rc0 compiled on May 27 2021

So the version checking in the script is not correct,
it will get "2.16rc0", but not "2.16".  Then the version comparison
will fail.

This patch will fix such issue when users use an unstable nasm and it
also works for the stable version.

Change-Id: I950458f681642d7e1f5fc69acf2ced2e1342c9cf
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8082
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-28 07:20:35 +00:00
Changpeng Liu
cfff04aea2 nvme/cuse: add subsystem reset IOCTL support
Change-Id: Id85989d0ae1246cb60fff4a41e5847a2d84e271f
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8084
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-28 07:20:23 +00:00
matthewb
8a7f6e71b6 test/bdev/bdevperf : Added check for ZCOPY Support
If the -Z option has been specified bdevperf checks that the bdev
module supports ZCOPY.

Signed-off-by: matthewb <matthew.burbridge@hpe.com>
Change-Id: I0bebad68090f48a1b1250afe4bc4c752c2061bfb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7352
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-27 07:35:59 +00:00
Rui Chang
080118cd83 lib/nvmf: Add current qpair count to poll group statistic
In struct spdk_nvmf_poll_group_stat, there are statistics of cumulative IO and
admin queue pair counts. But current qpair counts are not reflected. Use
this patch to add current admin and io qpair counts for a poll group.

Signed-off-by: Rui Chang <rui.chang@arm.com>
Change-Id: I7d40aed8b3fb09f9d34e5b5232380d162b97882b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7969
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Eugene Kochetov <evgeniik@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-27 07:35:49 +00:00
Changpeng Liu
75a507736b vhost-blk: use device name for VIRTIO_BLK_T_GET_ID
Block device product name is same among same type
of the block devices, while Guest VM may use this
value to generate UUID, so here we change it to
block device name instead.

Change-Id: I58c5fb271a6a436c15520616c2065eee9c37300a
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7996
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-27 07:35:37 +00:00
Michal Berger
43aca60458 scripts/fio-wrapper: Move devices sync to configure_devices()
This is to make sure we sync devices for both nvmf and iscsi
protocols.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ifec6cc2d240a5b22b73e9f4087ae328568e4fe4a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8042
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: Ziye Yang <ziye.yang@intel.com>
2021-05-27 07:35:29 +00:00
sunshihao520
c1a41845cf lib/bdev: Change spdk_bdev_read_blocks_with_md arg offset definiton from int64_t to uint64_t.
Signed-off-by: sunshihao520 <sunshihao@huawei.com>
Change-Id: I25c3ae4f12d0ab4e2f3811e36028a04a1f32d862
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7869
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-27 07:35:17 +00:00
John Levon
940f06490c vfio-user: update for libvfio-user region offset API change
Now, vfu_setup_region() must specify the region fd offset (which is always zero
in our case).

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I10795d848a4c73ee9e1e78ea63776074401c4b17
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8022
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-27 01:33:31 +00:00
Shuhei Matsumoto
924bfd067e bdev/nvme: Add ANA state per namespace into JSON info dump
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Idc0e783a2a4373a4269276aab8b1d857ed73caae
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7509
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:22:55 +00:00
Shuhei Matsumoto
8c2738a8fe bdev/nvme: Add UUID and EUI64 comparison to check if two namespaces are identical
Following Linux NVMe host, add UUID and EUI64 comparison to
bdev_nvme_compare_ns().

Besides, previously the return value of memcmp() had been used as
the return value of bdev_nvme_compare_ns() and this was wrong.
Fix it in this patch together.

Add unit test cases for bdev_nvme_compare_ns().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I069ab53e77741d6348b847d51e84a9338e2f3787
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7755
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-26 09:22:55 +00:00
Jiewei Ke
eabe783cc4 bdev: speed up bdev name lookup by using rbtree
Use the macros for red black tree provided by Free BSD to speed up bdev
name lookup in spdk_bdev_get_by_name().

In the bdev_multi_allocation test, we can get 3x ~ 5x speed up when
creating multiple bdevs for various bdev nums.

Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Change-Id: I49a2fbcccf06d4c36cbd445ce59e0b0dd4ada31d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7837
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:22:06 +00:00
Jiewei Ke
1a22f9b6ac bdev: clean up spdk_bdev_register()
Clean up spdk_bdev_register() to facilitate the upcoming patch which
uses RB tree to speed up bdev name lookup.

* move TAILQ_INSERT from bdev_start() into bdev_init();
* rename bdev_init() to bdev_register() and rename bdev_start_finished()
  to bdev_register_finished();
* inline bdev_start() into spdk_bdev_register().

Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Change-Id: Idbfc800472bc8c6f9b615046e082772e9f6026e3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8043
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:22:06 +00:00
Ziye Yang
c3cf9ec295 rbd/rpc: Add a rpc call to get the info of the clusters.
Purpose: Let the users know the current available registered Rados
cluster and the related info.

Change-Id: I115c129ae6e4b0372579aad168fd88f8be136357
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7990
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-26 09:21:48 +00:00
ChengqiangMeng
f90eaf1672 unittest/nvme_ctrlr: increase code coverage for nvme_ctrlr_identify_namespaces_iocs_specific_next
nvme_ctrlr_identify_namespaces_iocs_specific_next code comprehensive coverage.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: Icf039e15a983b04fcd1b558559ba651e495a6cd1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8006
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:21:10 +00:00
Rui Chang
fcc389490a configure: add gcc version check for ARM Neoverse-N1 platform
When doing debug build on ARM Neoverse-N1 platform, if gcc version is
lower than 8.4.0, we may met following errors:

/tmp/cc24qua1.s: Assembler messages:
/tmp/cc24qua1.s:53: Error: selected processor does not support `casp x0,x1,x2,x3,[x4]'
/tmp/cc24qua1.s:85: Error: selected processor does not support `caspa x0,x1,x2,x3,[x4]'
/tmp/cc24qua1.s:117: Error: selected processor does not support `caspl x0,x1,x2,x3,[x4]'
/tmp/cc24qua1.s:149: Error: selected processor does not support `caspal x0,x1,x2,x3,[x4]'

The change also fix the problem by pass armv8.2-a+crypto as target architecture.

Signed-off-by: Rui Chang <rui.chang@arm.com>
Change-Id: I2053b9440e06873066480d63e471802df2e69d4e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7949
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:20:58 +00:00
Michal Berger
3f674e1e29 test/setup: Perform custom alloc based on hugepages' size not quantity
512 and 1024 number of hugpages is not a sensible value in case 1G
hugepages are in use. Instead of setting fixed number of hugepages,
determine it safely based on the default size and allocate 1GB for
node0, 2GB for node1 (if present).

Fixes: #1954

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I850ba877332527a68ec4ddf7408fcc183835cda6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8012
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-26 09:20:44 +00:00
Jiewei Ke
d07c581b7d nvmf: nvmf_get_ana_log_page should use iov to store the log page
nvmf_get_ana_log_page used req->data to store the log page result.
While the req->data only contains the first iov, if req->iovcnt is
larger than 1, the req->data may not hold the complete log page; and
even worse, the log page result may be written to invalid address and
cause memory corruption.

The following patch will fix the same issue for other commands in
nvmf_ctrlr_get_log_page.

Fix #1946

Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Change-Id: I495f3be05c82be5cd53609772c655c8924b9179f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7923
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:20:30 +00:00
Ziye Yang
2250abaeca nvme/tcp: Raname send_pdu to pdu in tcp_req.
Since we will reuse send_pdu for other purpose in the next
patch.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Iee5166131b70a25bc13aaa847bfc9066231f31a9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8028
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:20:15 +00:00
Ziye Yang
9776b89444 nvme/tcp: Fix the bug when doing offloading.
For nvme/tcp connection, we use the synced manner
if the qpair is not fully connected. Thus without
the check, we will stuck here. And this patch
fixes this issue.

Change-Id: I72815bf5b4c0b31c4866bc1b9034b0e42b81d3f1
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8025
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:20:15 +00:00
Ben Walker
dde419084b event: Move json config loading to init
Loading subsystems and restoring state from a JSON config file is useful
outside of the SPDK application framework, so move it to lib/init.

Change-Id: I7dd3ceace2e7b1b28eef83c91ce6a4eedc85740e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6645
Reviewed-by: Tom Nabarro <tom.nabarro@outlook.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:13:34 +00:00
Ben Walker
9f62796127 event: Move RPC server initialization to init
I'm not sure whether this should go into lib/init or to lib/rpc
directly, but I've chosen lib/init for now.

This is to support applications that want to run the SPDK JSON
RPC server, but aren't using the SPDK application framework.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I79ca39aa0ca6e1a3a6905b0bf73e6cc99b086e55
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6644
Reviewed-by: Tom Nabarro <tom.nabarro@outlook.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:13:34 +00:00
Ben Walker
dc9374dd2f init: Declare a formal public API
The functions to initialize the SPDK subsystems or tear them down
was previously an internal-only API. Make it public for use by
applications that aren't leverage SPDK's application framework.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I2ebfd020e6fa4c1947fa1c1a2ac509ce9b0242f8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6643
Reviewed-by: Tom Nabarro <tom.nabarro@outlook.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:13:34 +00:00
Ben Walker
1a8467b02c init: Make some functions entirely private
There were some functions in the internal header that can be entirely
private to the init library. Move them over.

Also, remove the support for including the header from a C++ file
because these headers are internal to SPDK which is pure C.

Change-Id: Ic4323b2b8664e70106a57b3ca8acbc7c2efe621d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6642
Reviewed-by: Tom Nabarro <tom.nabarro@outlook.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-26 09:13:34 +00:00
Ziye Yang
00b0dc6624 nvme/tcp: Do not offload header crc32c calculation if header digest is enabled.
The header size is very small, which does not have too much value to
offload such calculation by hardware.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Iaa82f39312df7eef3282325a33677ea41ab735ab
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8011
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-25 07:12:43 +00:00
Changpeng Liu
51b6cbb9a7 examples/nvme/identify: pass nsid to Error Recovery feature
The P5800X drive will report the following error when getting Error Recovery
feature, according to the specification we should pass valid nsid.

nvme_qpair.c: 238:nvme_admin_qpair_print_command: *NOTICE*: GET FEATURES ERROR_RECOVERY cid:23 cdw10:00000005 PRP1 0x0 PRP2 0x0
nvme_qpair.c: 452:spdk_nvme_print_completion: *NOTICE*: INVALID NAMESPACE OR FORMAT (00/0b) qid:0 cid:23 cdw0:0 sqhd:000f p:1 m:0 dnr:1
get_feature(0x05) failed

Fix issue #1955

Change-Id: I30ce60cddcddbf78e57a8c172a2056a82ac72802
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8009
Reviewed-by: Chengqiang Meng <chengqiangx.meng@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-25 07:12:20 +00:00
Changpeng Liu
7ee25c2e4c examples/nvme/identify: rename get_features to get_ctrlr_features
This will help us to add get namespace features later.

Change-Id: I7e809cd9e3bcb3874ce141183b9c4ee82543616c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8008
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-05-25 07:12:20 +00:00
Tomasz Zawadzki
42ad9d0379 lib/blob: resize open_blobids on bs load
open_blobids holds bit array of currently open blobs,
this is a way for quicker determination than iterating
over all blobs. See patch introducing it:
(30ee8137)blob: Add a bitmask for quickly checking which blobs are open

That patch added resizes of this bit array to bs init
and bs recovery path (not shut down cleanly).

But that patch skipped over bs load from a clean shutdown.
This resulted in blob open having multiple blob pointers that
target the same blob id.

Fixes #1937

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I3c42a63d168d1f5b013b449f010c5b207936045b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7998
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: Ziye Yang <ziye.yang@intel.com>
Community-CI: Mellanox Build Bot
2021-05-25 07:12:07 +00:00
Tomasz Zawadzki
e65310624b lib/event: accumulate idle_tsc when reactor has no threads
Before this patch idle_tsc was sum of all idle tsc of all
threads running on a reactor.

There are cases when no threads are present on the reactor,
and _reactor_run() spins doing nothing.

To give more accurate representation of the reactors state,
the idle_tsc now adds time spent doing idle spinning.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If797b2a03507d17b07367d56d5f6c40cefbbbd49
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7900
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-25 07:11:53 +00:00
Tomasz Zawadzki
a5ad0f8051 lib/event: update reactor tsc_last going poll mode
Disabling interrupt mode on reactor now updates the tsc_last
to current time. So any further tsc caulations will not account
for the time when reactor was in interrupt mode.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I56fb8a738eea60ee5de3b49d586f7cb228b54510
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7901
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-25 07:11:53 +00:00
Tomasz Zawadzki
7438c388a0 lib/event: fix tsc_last for first thread on reactor
tsc_last value is used to update thread stats
during _reactor_run(). See:
spdk_thread_poll(thread, 0, reactor->tsc_last);

If no threads were present on the reactor,
this value got outdated and resulted in
adding time reactor spent with no threads to
stats of the first thread placed on that reactor.

This patch fixes thread stats by making sure
that argument to spdk_thread_poll() is up to date.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I0c35fdba1b63b6ee19a5a2b34751090839cb2438
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7845
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-05-25 07:11:53 +00:00
Tomasz Zawadzki
320fdaa325 ut/event: add current reactor tsc accounting
This patch does not change the UT in functional way.

Added accounting of last_tsc and spdk_get_ticks() similar
to the real application.
First the reactor_run() [not _reactor_run()] starts
reactor->tsc_last to current time. UT now set it at the start
and never touch it again directly.

Second the spdk_get_ticks() is updated to the elapsed time
to simulate flow of time, and make sure that its further
usage is up to date to the current time.

Fixed typo in test case description for test_reactor_stats.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Iaa2eb00fa3bffc2f21f1692da0259f1d023086b8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7904
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
2021-05-25 07:11:53 +00:00
Ben Walker
af935f768e event: Shift subsystem initialization code to a separate library
This is useful for applications even if they elect not to use the SPDK
event framework.

This doesn't shift everything in one go - just the subsystem
initialization logic. Configuration file loading also needs to move
in a separate patch later.

Change-Id: Id419df1045442d416650ed90e5ee78adfdd623d7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6641
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-24 10:12:50 +00:00
ChengqiangMeng
36cb16219e unittest/nvme_tcp: increase code coverage for some handle
nvme_tcp_c2h_data_payload_handle and nvme_tcp_c2h_term_req_payload_handle and nvme_tcp_icresp_handle code comprehensive coverage

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: Ib7ccc7dbab11990f851807c0b07e7c0e67e61bde
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7872
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-05-24 10:12:14 +00:00
Mao Jiang
f596245ce6 test/nvmf/ctrlr: cases for ctrlr creating and destruct
Change-Id: Ib4b3c124e6906e63409afc7e225d5afb89a28e76
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7612
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-05-24 10:11:52 +00:00
Michal Berger
cf091238f5 test/make: Ignore abidiff's exit status
Upon running abidiff to get the list of impacted interfaces it seems
to exit with != 0 status. This triggers errexit causing the script
to exit in the middle of processing the lib files so we don't get
the full picture of all potentially impacted files. Ignore the
exit status in this case and allow the loop to go through all the
.sos.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I7edc5122161b0927fdd9a918571419f32fd46dac
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7815
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-24 10:11:05 +00:00
Michal Berger
24e0f403b8 test/make: Fix LTS tag lookup
Replicating 00afb74669.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I19049e35ad959a34342cd714d805db6bdd933ea4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7814
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-24 10:11:05 +00:00
Michal Berger
6c1a1a3dca scripts/rpc: Make sure address argument is properly interpreted
In case the addr argument was not an existing unix socket file the rpc
client would consider it to be an actual ip address. As a result
connect() would be called with improper set of arguments. This could
cause the rpc.py to block for undesired amount of time until connect()
finally decided to return (seen on some fedora33 builds).

This was affecting sh wrapper functions like waitforlisten() which
use rpc.py to determine if given app is ready to be talk to blocking
execution of the tests for way too long then intendent.

To avoid such a scenario determine the format of the address and use
routines proper for given address family.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Iaac701d72c772629fa7c6478ff4781b0c5d485d5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7777
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-05-24 10:11:05 +00:00
Michal Berger
ef68667a82 pkgdep/git: Remove 20.01 release workarounds
There's already a new LTS release in place, hence these workarounds
are not needed anymore.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Idf597a5cf8da18d75f2630d59a277d4545fadc0f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7987
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-24 10:10:41 +00:00
Michal Berger
f8d6541d04 freebsd: Replace use of \s with [[:space:]]
In latest 13.0 release of freebsd sed is not accepting \s anymore,
hence it needs to be replaced. Note that only parts of the repo
which are touched by freebsd during the tests are updated.

Details https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253893

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I217208511af8f98e7033f8f24a343b5ca9c48825
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7986
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-24 10:10:41 +00:00
Michal Berger
022ecaa7f1 vm_setup: Don't fail on freebsd if etc_os-release package is missing
This package is not available under latest 13.0 release, however,
the /etc/os-release we are looking for is already installed there.
For older versions, and in case this package is missing, we still
can determine that we are running under freebsd as part of the
fallback check to uname().

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I6a04eb66392d91899a4b55d4eb508bef140e924a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7985
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>
2021-05-24 10:10:41 +00:00
Ben Walker
15ae31fb0c nvmf: Rearrange spdk_nvmf_requset for cache line locality
Get all of the hot stuff to the first cache line.

* Shrink the xfer enum to one byte (it only has 3 values).
* Pull out the dif enabled flag form the dif structure so it
  can be access separately
* Rearrange the members

Change-Id: Id4a2fe90a49c055a4672642faac0028671ebfae9
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7827
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-24 10:10:19 +00:00
Ziye Yang
d33f44866d rbd: Fix the name comparison bug.
Checked the definition of strncmp. If substring s1
is found in strnmp(s1, s2, len), then it will return 0.

For the len value, it is better to use strcmp. Otherwise,
if s1=cluster1, s2=cluster & len=strlen(s2),
strncmp will return 0. But they are two different strings. For
cluster names, they are different.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I15a06184d834cd1567b329d0322cd6bdea6fee4b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7991
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-05-24 10:09:44 +00:00
Tomasz Zawadzki
1180c390c1 lib/thread: fix iterating over paused pollers
(cd83ea4a)thread: Add SPDK internal APIs spdk_thread_get_first/next_active/timed/paused_poller()
Patch above by mistake iterates over active_pollers list
for function that lists paused pollers.

Fixes #1947

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1b69d942675f34f5f046ec46feacc8d81d89f015
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7952
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: <dongx.yi@intel.com>
2021-05-24 10:08:34 +00:00
Tomasz Zawadzki
ceaa0c7fa9 lib/blob: complete multiple persists
When blob persist starts, there can already be multiple
of such requests pending. It is possible to complete
a set of persists at once, if blob state after their
execution would be the same. This is the case when
persists are already pending when a particular persist
request is started.

This patch implements such mechanism by introducing
persists_to_complete queue, containing entries that
were previously queued up before starting the current
persist request. If there are any entries in this queue,
further requests are put into pending_persists.

When first request from persists_to_complete is persisted,
completions are issued for all requests on that queue at once.
If at that point there are any new entries on pending_persists,
all of them are put into persists_to_complete. Persist process is started
again with the first request from that queue.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I10063e55d6f821b1863de016d3148da6a719a422
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7643
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>
2021-05-24 10:08:00 +00:00
Rajarshi Chowdhury
119158cda8 configure: Added --disable-apps option.
Together with options to disable examples, tests and unit-tests
this will enable us to build SPDK without linking any executables.

This is useful for packaging SPDK in applications - especially
those using own ENV.

Fixes #1877

Signed-off-by: Rajarshi Chowdhury <rajarshi.chowdhury@oracle.com>
Change-Id: I0467ec497d2abe2fad40cdb4ba723a240bee46d6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7462
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-24 10:05:34 +00:00
Michal Berger
7bea0a074f scripts/vagrant: Create user netdev for openstack network
The openstack tests require to have one interface available under
specific ip, 10.0.2.15. This ip is a first lease VM receives from
the user network which is preconfigured in libvirt environment.

Use this instead of defining completely separate network which
by the very default will serve its own DHCP service as well. This
may result in a cosmetic issues (e.g. two ips, static one and
dynamic one on the interface) of having inconsistent config on the
VM depending on how the net device is configured by the underlying
distribution.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ie3da26eebcfb0de668166c4a0120c65aec104540
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7441
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-05-24 09:58:17 +00:00
Michal Berger
0c25e6fbbc test/openstack: Clean up the test
This is done as part of the work to fix currently existing CI job
using this particular test suite.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Id5e9e8a814fb3025f192871650b8aa317f2de910
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7440
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-05-24 09:58:17 +00:00
Krzysztof Karas
994be25fe1 spdk_top: move mvhline() function call inside show_core
Moves "mvwhline(core_win, 6, 1, ACS_HLINE, CORE_WIN_WIDTH - 2);"
upwards to increase readability by placing this call in order
(to print the line in 6th row after data in 5th row is done printing)

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Icec340231090aeb57c600f52b3c687dbc78cc4b9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7959
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-24 09:57:47 +00:00
Krzysztof Karas
6f9d124888 spdk_top: change where sore_last_run_counter() is called
Changes where store_last_run_function() is called. Before this patch
this function was used inside refresh_pollers_tab() and it overwrote
last run counters of each poller before show_poller() function had a
chance to use them. As a result poller details window was always
showing zeroes instead of actual difference in run count between each
application loop.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I96219698f7f0b51b94ffe8c0d6bf40f73cbf8a82
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7951
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-24 09:57:47 +00:00
Krzysztof Karas
49bc3005f5 spdk_top: move store_last_run_counter() function
Moves store_last_run_counter() function to allow next patch to
call it earlier in the code, inside get_data() function.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I1e37080ec86309bbf33442fa12cbe9dc575cc864
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7950
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-24 09:57:47 +00:00
Krzysztof Karas
39950bc8f9 spdk_top: reduce number of poller global structures
Deletes g_pollers_history and store_pollers_last_stats() function
to simplify spdk_top code.

Adds last_run_counter to show_poller() function to get last state
of poller's run counter for comparision with current value and
display in pop-up window.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I236fbcac31e67a617d37ba15888aeb30e3763e01
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7925
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-24 09:57:47 +00:00
Krzysztof Karas
081a4a0943 spdk_top: reduce number of global thread data structures
Deletes g_thread_history and g_thread_info to use g_threads_stats
across the whole application to simplify spdk_top code.
Now instead of separate struct, fields last_busy and last_idle are
being used.

get_data() function now uses local structure to get RPC data instead
of filling global one. This has been changed so that g_threads_stats
keeps its last_busy and last_idle fields unchanged.
free_rpc_threads_stats has been moved down so that in future patches,
when multithreading is implemented, there is no need to lock
g_threads_stats during RPC call.

Changes places of allocation/deallocation of g_threads_stats, since
we want to save last_idle and last_busy fields instead of zeroing them
out each application loop.

Changes show_thread() function to use local copy of threads array
instead of pointers to global struct. This is for the convenience
in the future patches implementing multithreading to avoid the need
to lock the global struct for details display.


Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I0dc87eac4c1b89fa16f14f5387d94ee176dfdf43
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7587
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-24 09:57:47 +00:00
Krzysztof Karas
22edbe9626 spdk_top: change where get_data() and free_data() are called
Move part of code with get_data(), refresh_tab() and free_data()
inside show_stats() upwards to make sure data structures are
up to date for pop-up details windows.

Delete get_data(), free_data() calls from show_thread(), show_poller()
and show_core functions.

Add data freeing right before rpc calls inside get_data() to let
pop-up details windows to use updated data before freeing it.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I0d78eb7a48b0cdff4284815afc1a214b0effd7fc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7953
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-24 09:57:47 +00:00
Krzysztof Karas
e2b6cf2f96 spdk_top: move sort_threads function
This function is going to be needed in get_data() in the next patch.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I9368b4567a92ca20d830c3475e3120ee691b84c1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7947
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-24 09:57:47 +00:00
paul luse
eb5a111398 lib/idxd: move the crc destination * from the desc to comp record
Was using reserved field in CRC to store the final address of where
to put the result, this not legal.  Move to the completion record
and slightly re-arrange the struct to keep it at 96 bytes.

Refacorted the IO prep function so the caller can udpate both the
descriptor and completion records instead of continuing to add
parameters to the prep function for opcodes that need something
unique in the completion record.  This also allowed for a minor
fix where the prep function was returning NULL when vtophys failed
which would have indicated busy as opposed to failire.  Now we can
proprely fail that path.

fixes #1929

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ic23bc7b68bdd5757c30b7963880677f423368e20
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7735
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>
2021-05-22 18:42:35 +00:00
Michal Berger
274f52b527 autobuild: Separate unit tests from autobuild
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: If6ce4d3f7bc58855ba61b352be71dff404c87720
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6819
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-21 12:56:48 +00:00
Karol Latecki
7908736c22 autobuild: update patches for mainline DPDK
Patches stopped applying cleanly because of dpdk/dpdk changes:
7d5cfaa7508de0fd248b05effbf421a98317006a
4ad4b20a79052d9c8062b64eaf0170c16a333ff8
Needed to rebase custom patches.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I1006f7f6ba21a3cee5b607cfc44adedb4c1d5830
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7903
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-21 08:04:49 +00:00
Mao Jiang
bb27314c03 test/nvme_pcie: cases for mapping io cmd
Change-Id: Icf174668e9b1361bb232db4a0cc53921423a17a4
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7671
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-21 08:04:39 +00:00
Karol Latecki
b686c82581 scripts/nvmf_perf: update add_listener rpc call
nvmf_subsystem_add_listener() in rpc/nvmf was modified
by 64debe0453 and the
change was not reflected in performance scripts.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I7bb8c39ab225421964e37883aa7b0f824e8df683
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7978
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-21 08:04:24 +00:00
Jacek Kalwas
dd9350c7e6 build: fix missing pthread dependency for syslibs pc
SYS_LIBS var is used to generate Lib.private section of
spdk_syslibs.pc

lack of pthread can result in linking issue when spdk's *.pc are used

please note that usage of -lpthread and -pthread is not consisent
within system wide pc files

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I2dd327371d5621ea12f1e2f7abdfe6b7aa6602eb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7253
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Maciej Szulik <maciej.szulik@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-05-21 08:04:09 +00:00
Jim Harris
887109bf9e scripts: add bpf/syscalls.bt
This script counts how many times each syscall
is called by the SPDK application.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ife5efccee73e407e1d819293786f2acdfa317f78
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7713
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-05-21 08:03:27 +00:00
Jim Harris
dca7ef2759 scripts: add bpf/readv.bt
This script captures a histogram of the returned values
from the readv syscall.  It can be useful for analyzing
the efficiency of our sock/posix implementation.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I910eb2e81e3416855cda7a3854982cd02476850e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7712
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-05-21 08:03:27 +00:00
Jim Harris
cbb57e0d96 scripts: add bpf/send_msg.bt
This script tracks spdk_thread_send_msg and
spdk_for_each_channel calls.  It also uses usym
to get the name of the function pointer passed to
these calls.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia0cf5b50538bd26a3e15e35cbab765fe3c327c73
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7711
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-05-21 08:03:27 +00:00
Jim Harris
af0bf0f006 scripts: add bpftrace.sh
This script simplifies execution of bpftrace scripts
for SPDK application analysis. The script should be
invoked as:

scripts/bpftrace.sh `pidof spdk_tgt` script.bt

where 'script.bt' is the name of the bpftrace script
you wish to execute.

The script helps simplify the following:

1) replace __EXE__ markers in the bpftrace script with
   the full path of the spdk executable (required for
   usdt probes);  it uses /proc/<pid>/exe to get the
   full path
2) replace __PID__ markers in the bpftrace script with
   the PID of the spdk process under analysis - this
   allows for doing things like filtering system call
   counts for just the SPDK process
3) invoke bpftrace with the -p <pid> option

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib271f26efe4ba326d951a7b30f61b22be755dda7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7710
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-05-21 08:03:27 +00:00
Jim Harris
5a1c74bfa4 usdt: add User Space DTrace support to SPDK
For now, we will keep this disabled by default,
enable with --with-usdt option to the configure
script.  Long-term we will want to enable this by
default, and only disable via configure.

Modules can include spdk_internal/usdt.h and add
probes such as:

SPDK_DTRACE_PROBE2(probe_name, ptr, val);

When USDT is enabled, these will translate to
DTRACE_PROBE2(spdk, probe_name, ptr, val).  When
USDT is disabled, these will translate to nothing.

Later patches will add some probe points to the
nvmf target, some bpftrace scripts, and instructions
for how to successfully capture data with these
probe points and scripts.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id168e2c800fa5522815a175026386319014cfdaa
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7173
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-21 08:03:27 +00:00
Shuhei Matsumoto
9e1c13c5f1 bdev/nvme: Move bdev_nvme_compare_ns() up in a file
bdev_nvme_compare_ns() will be used to check if all namespaces of
one nvme_bdev are identical, and this is the convenient location.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3fa6072c1cceec53268e53bf398fa1e8f069035e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7169
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-21 08:02:50 +00:00
Shuhei Matsumoto
9391bc33a7 bdev/nvme: Factor out the internal of _bdev_nvme_check_pending_destruct()
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I27d7e81fe0ecc35b374277c8e40233db2a3ed914
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7273
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-05-21 08:02:50 +00:00
Shuhei Matsumoto
a0ea252399 bdev/nvme: Factor out reset_io completion into a helper function
This will be helpful to simplify the following patches.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I66939f2953c66582bfcb79cfe187814280e89680
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7324
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-21 08:02:50 +00:00
Shuhei Matsumoto
73b4b9ad68 bdev/nvme: Put all nvme_bdev_ctrlr accesses into a place in bdev_nvme_create_cb()
When multipath is supported, a subsystem has multiple controllers and
bdev_nvme_create_cb() will create a channel per nvme_bdev_ctrlr by
iterating the list of nvme_bdev_ctrlrs, and will hold lock while
doing it.

If the code to access nvme_bdev_ctrlr is put in a place, the
following patches will be easier and smaller.

Hence reorder the code of bdev_nvme_create_cb() as a preparation.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2f2e66758c3374c678cc44bbb0116f4611c6753a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7754
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-21 08:02:50 +00:00
Shuhei Matsumoto
81b4379cd8 bdev/nvme: Factor out spdk_bdev_io_complete() calls into a helper function
Factor out spdk_bdev_io_complete() calls into a helper function
bdev_nvme_io_complete().

This simplifies the code a little and will be helpful for the following
patches to retry I/Os. These are not performance critical but we
specify inline explicitly by following bdev_nvme_io_complete_nvme_status().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9fafacfd8571c037c3bc34382c251317309da334
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7497
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-05-21 08:02:50 +00:00
Shuhei Matsumoto
e4ec38c336 bdev/nvme: Factor out spdk_bdev_io_complete_nvme_status() calls into a helper function
Factor out spdk_bdev_io_complete_nvme_status() calls into a helper
function bdev_nvme_io_complete_nvme_status().

This simplifies the code a little and will be helpful for the following
patches to retry I/Os. Specify inline explicitly to avoid performance
regression.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1ac451486e1c6a4401842490411e986fac191d59
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7484
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-21 08:02:50 +00:00
Shuhei Matsumoto
30d17fff30 bdev/nvme: Delegate processing -EBUSY of bdev_nvme_reset() to its caller
bdev_nvme_submit_request() calls spdk_bdev_io_complete() with failed
if bdev_nvme_reset() returns negated rc other than -ENOMEM.

So let bdev_nvme_submit_request() process it.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2569634ff0f18fb433cb685de1366e43abf5a9fe
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7524
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-21 08:02:50 +00:00
Shuhei Matsumoto
5a6cd5b31c bdev/nvme: Inline _bdev_nvme_submit_request()
This is called only in a place. Inlining this into bdev_nvme_submit_request()
will simplify the following patches by removing unnecessary cast.

Besides, use -ENXIO if I/O path is not found. This will be better than -1.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib6c38f89db1c1e651941aad18d31dd0891f380de
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7871
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-21 08:02:50 +00:00
Shuhei Matsumoto
b2c0e3761b bdev/nvme: Consolidate exit paths of get_buf_cb()
I/Os will be retried if spdk_bdev_io_complete() is called with
SPDK_BDEV_IO_STATUS_FAILED. To do it easier, consolidate exit paths
of bdev_nvme_get_buf_cb().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0a67b88a107d616c5a5b0fc5ff963ad1402f5651
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7487
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-21 08:02:50 +00:00
John Levon
c41508b7e2 libvfio-user: update submodule
Update libvfio-user to the current version, updating the client for the relevant
changes.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: Ic64ace08ac0c7e9676f04f8d1f47a9c0388a2652
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7983
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
2021-05-21 03:01:21 +00:00
Krishna Kanth Reddy
b73d3e6894 test/nvme: Simple Copy Command takes nlb as a 0's based value
Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: I10a33d6478ce10fd2786c8eca2f179a9809764dc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7973
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>
2021-05-20 20:15:51 +00:00
Maciej Szwed
3703ebc710 doc: Add information about shutdown_cb
Fixes GH 1539

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I5256a53c619b13951382fcc0439a157aa29b61aa
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7859
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>
2021-05-20 15:22:19 +00:00
yupeng
5cc565999e nvmf: support NVME ACRE feature
Support ACRE (Advanced Command Retry Enable) feature. Currently set
all crdt to 0 and only select crdt[0] (crd=1) when the IO has any
error.

Signed-off-by: Peng Yu <yupeng0921@gmail.com>
Change-Id: If7bc30f91f5b2d0839002dead17188a4b3a52d5d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7885
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-20 15:18:52 +00:00
Alexey Marchuk
103f5c62f5 nvmf: Remove qpair from poll group when it is deleted
That prevents nvmf target from starting to destroy poll
groups prematurely

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I833f6198ef0e3083fdadf70dd3b62844c905aceb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7881
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-20 15:18:29 +00:00
Evgeniy Kochetov
d8eb6957a0 ut/nvme: Add tests for NVMe controller namespace handling
Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com>
Change-Id: Id2d3d1a15df22512f8d0d4414b5b3d35e79149f4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6505
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-20 15:17:41 +00:00
Evgeniy Kochetov
f0e248586e nvme/ctrlr: Always access namespaces via getter function
Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com>
Change-Id: I16e327c0c0485057dc90a87cae316c4d6b62720d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6504
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-20 15:17:41 +00:00
Evgeniy Kochetov
65ff07719d nvme/ctrlr: Retrieve active NS list before NS construct
This patch changes the order of IDENTIFY_ACTIVE_NS and CONSTRUCT_NS
controller states. It is required to further improve memory management
for namespaces by allocating memory only for active ones.

Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com>
Change-Id: Ie540442b1bd9e897afcbaa4319c139109dd0c515
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6503
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-20 15:17:41 +00:00
Evgeniy Kochetov
75ddfd6511 nvme/ctrlr: Handle namespaces construction failure
Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com>
Change-Id: I3b14e2dce3bd4b2ce42e3946592cfde9d4300f28
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7361
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-20 15:17:41 +00:00
Evgeniy Kochetov
aebbce2520 nvme: Refactor active namespace list retrieval
Previous implementation allocated memory just once at the beginning of
active NS list retrieval procedure. It allocated memory for maximum
possible number of active namespaces, i.e. 'cdata.nn'.

This patch changes allocation logic. One page is allocated at the
beginning. If more is needed, reallocation is done with one more
page.

This patch also removes SPDK_MALLOC_DMA flag from allocation since we
don't do RDMA directly into this buffer.

Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com>
Change-Id: Iaa80c4d70c54daaf71dcbf755c63a01a1d83b772
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6502
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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: Jim Harris <james.r.harris@intel.com>
2021-05-20 15:17:41 +00:00
Michal Berger
fead05c025 test/nvmf: Rework the traps
Declare single trap from nvmftestinit() instead overriding main trap
depending on the use-case (veth vs phy).

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I23c66fc5728510d06eee9837843f0734b2d03dcf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7850
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-20 15:16:21 +00:00
Michal Berger
9b3773db68 scripts/common: Cache pci modalias
Additionally, include the first resolved alias of the module.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I71c7c15398ea36f3dea3340f5c98568ff6b6a68a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7848
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>
2021-05-20 15:16:21 +00:00
Michal Berger
5f61a0c919 scripts/common: Cache the pci driver
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ie0ab6b31757b0446c697f59bfc789e78207b6e34
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7847
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>
2021-05-20 15:16:21 +00:00
Michal Berger
a3a0651569 autotest: Run dd tests under SPDK_TEST_URING
As these tests were limited to SPDK_TEST_BLOCKBDEV the spdk_dd was
not being tested against liburing. Make sure it is the case now.
Also, fail the test if spdk_dd is not linked to liburing in case
where such tests were requested.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I5704577530048ed4775ea15a6cdacf23380b5072
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7653
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>
2021-05-20 15:15:33 +00:00
Tomasz Zawadzki
1c71de70bd perf/nvmf: add FIO I/O rate limit to the config
Added 'rate_iops' FIO option to the performance scripts.

This will be used during tests where limiting factor
has to be artifically imposed, rather than come from
the target/initiator system or enviroment.

One case for this are scheduler tests, to limit
each connection and balance the threads accordingly.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I10bb09be9205a8b7ba90b36cd4e0bf922b0ecbc3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7840
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-05-20 15:14:59 +00:00
Ben Walker
1ae601b573 sock/posix: Avoid extra readv calls after draining recv_pipe
Move from a single flag indicating that the socket is on the
pending_events list to two flags - pipe_has_data and socket_has_data. If
either flag is true, the socket is on the socks_with_data list.

This is necessary to track enough state to avoid doing extra recv()
system calls.

Change-Id: I65e5701dccb0a5bade19f266f164f26706b110d4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7595
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-20 15:14:08 +00:00
Shuhei Matsumoto
4e9adb3bf9 thread: Replace TAILQ by Red Black tree for timed pollers
Use the macros for red black tree provided by Free BSD to manage
timed pollers efficiently.

Allow RB_INSERT() to insert elements with duplicated keys by changing
the compare function to return 1 if two keys are equal.

Check the return code of RB_INSERT() because this is the first use case
for RB tree macros in SPDK. We did the same for RB_REMOVE() by
adding another temporary variable but we remove it from this patch
because it is not so important compared with RB_INSERT().

When a timed poller is inserted, update the cache for the closest (leftmost)
timed poller only if the tree was empty before or the closest (leftmost)
timed poller was actually changed. We do not have to use RB_MIN()
because all duplicated entries are inserted on the right side.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibe253ca8eecc10116548b5eedbcdba8fb961b88d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7722
Community-CI: Mellanox Build Bot
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>
2021-05-20 15:13:27 +00:00
Shuhei Matsumoto
4eb96aeba0 thread: Inline poller_remove_timer() into thread_poll()
We already hold thehe next closest timed poller in tmp. Inlining
poller_remove_timer() into thread_poll() makes the cache update
more efficient.

After this patch, poller_remove_timer() is called only in a single case
and the case is compiled only on Linux. So add it inside of a temporary
block is much clearner. However it will be used by spdk_poller_reschedule()
in the end of this patch series. So keep
the current position.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2e6858223713eed84f5d70b160da6122edae6d03
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7910
Community-CI: Mellanox Build Bot
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>
2021-05-20 15:13:27 +00:00
Shuhei Matsumoto
83c197633f thread: Consolidate poller_remove_timer() calls into a single place
This enable us to optimize the cache update when RB tree is supported.

Call poller_remove_timer() after getting the next element because
as TAILQ_FOREACH_SAFE() and RB_FOREACH_SAFE() do, TAILQ_NEXT() may
not be valid after the current element is removed.

Previously, the patch had called poller_remove_timer() before getting
the next element. However, thanks to the nice testing, this bug was
found.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I18afb4412115dc1696cc568610cbe3dc618c2357
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7909
Community-CI: Mellanox Build Bot
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>
2021-05-20 15:13:27 +00:00
Shuhei Matsumoto
3ca15e33e4 thread: Set poller to PAUSING even when it is in RUNNING
This change is a preparation to first dequeue the closest timed poller
always when it is expired. Previously the poller_remove_timer() calls
were not consistent and difficult to follow.

spdk_poller_pause() sets poller to PAUSING even when it in RUNNING
and move it to PAUSED after returning from its context.

If spdk_poller_pause() and spdk_poller_resume() are called while poller
runs, it is moved to WAITING. Hence thread_execute_poller() and
thread_execute_timed_poller() ignore such cases.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I29340613a2ec0c3529d0886f4d81c0a0fdf8745d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7908
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-20 15:13:27 +00:00
Shuhei Matsumoto
50487701b1 ut/thread: Test if multiple timed pollers are expired simultaneously
Add a little complex test cases to avoid regression by the following
patches.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1c94edd913f0a582868e355be085a1faf9bd1a94
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7913
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-20 15:13:27 +00:00
John Levon
2975e0dbb5 vfio-user: support cmake3
libvfio-user now uses cmake3 if available, so check for that as well as cmake.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: Idf7a496d0d3fec21140afeede56337e53ad475fd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7954
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-05-20 15:12:22 +00:00
Jim Harris
f651e22a98 bdev: remove all references to spdk_bdev_open
This API was removed previously, so remove remaining
references in map file and unit tests.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iba2f6a5f5ba590d3996dc133c8181083a33d7405
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7963
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-20 15:02:59 +00:00
Changpeng Liu
f4d2ba4371 test/nvmf: use recommended nvmf_create_subsystem rpc
There are logs like below in existing CI tests:
"nvmf_subsystem_create is deprecated, use nvmf_create_subsystem instead."

Change-Id: Id257ab13120a71ad3d0ae7ed22ed6e0a4f005cf0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7670
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-20 15:00:22 +00:00
Tomasz Zawadzki
706aa1ff08 dpdk: update submodule to DPDK 21.02
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I794f2266e0de175fe85ceea3a01b8db118550ada
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6617
Community-CI: Mellanox Build Bot
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>
2021-05-19 08:09:58 +00:00
Ziye Yang
5c0160263c bdev/rbd: Revise bdev_rbd_create rpc function.
Revise bdev_rbd_create rpc call to add an optional
parameter "--cluster-name", e.g., "--cluster-name Rados".

Then users can create a rbd bdev with registered
Rados Cluster. This shared strategy can be used to
remove the thread creation overhead if multiple rbds
are connected to the same Ceph cluster.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ide5800f8fc6b2074805272a59731c666fe279b9a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7584
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-19 08:08:39 +00:00
Mao Jiang
4e4d865fa0 test/nvme_cuse: cases for getting cuse ns device
Change-Id: I117b81554b6cf0f6eb1af7bd1050ff06cc351af9
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7442
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-19 07:50:53 +00:00
Jim Harris
40a9b64352 nvme/perf: add -F option for zipf distribution
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I818c5671574f556176a6cc5a0e372735a9e8a51a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7792
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>
Community-CI: Mellanox Build Bot
2021-05-19 07:50:28 +00:00
Jim Harris
6ee7dd5375 nvme/perf: move rand_r seed to ns_entry_
This eliminates the thread-local seed variable.  But
we're also adding zipf distributions in an upcoming
patch, and we'll want to store that context in the
ns_entry rather than making it thread local.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Icc4a8b7bdbc9cd35525f2d35c9ada8e3ec0ba76c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7791
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>
Community-CI: Mellanox Build Bot
2021-05-19 07:50:28 +00:00
Jim Harris
bef22f45e7 bdevperf: add -F option for zipf distribution
Currently this will only support a global setting
that must be set on the command line.  We can make
it per-job later, but will require adding float
support to the conf library.

Tested by running bdevperf with some malloc
bdevs.  Performance with low theta values (i.e. 0.2)
are almost identical to random w/o zipf.  But
higher zipf values start to show better performance,
because we get more hits on data that is already
in the CPU cache.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I55b1587cdec2919973b488786d361042ca210606
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7790
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>
Community-CI: Mellanox Build Bot
2021-05-19 07:50:28 +00:00
Jim Harris
760452eefe bdevperf: store the rand_r seed in the bdevperf_job
This eliminates the thread-local seed variable.  But
we're also adding zipf distributions in an upcoming
patch, and we'll want to store that context in the
job rather than making it thread local.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If8079682e7d3da8f989ee6b880edc8d3fcb4fdd8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7789
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>
Community-CI: Mellanox Build Bot
2021-05-19 07:50:28 +00:00
Jim Harris
e6b7e58574 examples: add zipf example app
This app shows how to use the SPDK zipf functionality,
and uses spdk_histogram to show the cumulative
distributions.

Usage:

build/examples/zipf 1.2 100000000 10000

This will generate 10000 random numbers from a range
[0, 100000000) using zipf theta parameter = 1.2.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I36486399b54f57e771cbc5530ae4905afca60b64
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7780
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-19 07:50:28 +00:00
Jim Harris
0346e733e1 histogram: add handling for datapoint == 0
__builtin_clzll(0) is technically undefined, but
returns 64 on all currently tested architectures,
which is the desired value.  So remove the
assert(datapoint != 0) and instead just set clz=64
for that case so that we aren't depending on
undefined behavior.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ibb05f756e07f20a250d24f0c5adecc4dfbc5a056
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7939
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>
Community-CI: Mellanox Build Bot
2021-05-19 07:50:28 +00:00
Changpeng Liu
7e9d5ae123 doc/vhost: update example parameter when starting VM
Some Linux distributions reports kernel panic using the same
command line as we suggested in this document, that's because
number of IO queues is bigger than number of CPUs, so here
just fix it and added a comment on the number of IO queues
parameter.

See issues #1295 and #1737.

Change-Id: Ie1e18d5e83a80523f71d98b8761d13a8d57cc9ab
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7852
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-05-18 21:33:50 +00:00
Rui Chang
d424e2449a test/json_config: Fix json_config test fail for multiple nvme disk config
In json_config test, when there are multiple nvme disks, we see errors like:

ERROR: expected event 'bdev_register:Nvme0n1p1' but got 'bdev_register:Nvme1n1' (whole event line: bdev_register:Nvme1n1:1)

The reason is when there are multiple nvme disks in the system, when
start nvmf_tgt, it will register all the disks in bdev, so there would
be multiple bdev_register events for these disks before we run
create_bdev_subsystem_config. So in create_bdev_subsystem_config we need
add these events to expected events list first.

Signed-off-by: Rui Chang <rui.chang@arm.com>
Change-Id: Ice8f5464975e68ae63fec891ef18dbc7590a9ab5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7858
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-18 12:44:35 +00:00
Alexey Marchuk
6263457ca3 nvmf: Remove spdk_nvmf_request_get_buffers_multi API
It is not used.

Change-Id: I238c5e2b2d557063f8443ca703551e02b35ba2c7
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7882
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-18 12:44:18 +00:00
Alexey Marchuk
019a5361a5 nvmf/rdma: Use contig buffers for multi SGL payload
Currently we allocate buffers perf each SGL descriptor.
That can lead to a problem when we use NVME bdev with
PRP controller and length of the 1st SGL descriptor is
not multiple of block size, i.e. the initiator may send
PRP1 (which is SGL[0]) which end address is page aligned
while start address is not aligned. This is allowed by
the spec. But when we read such a data to a local buffer,
start of the buffer is page aligned when its end is not.
That violates PRP requirements and we can't handle such
request. However if we use contig buffer to write both
PRP1 and PRP2 (SGL[0] and SGL[1]) then we won't meet
this problem.

Some existing unit tests were updated, 1 new was added.

Fixes github issue #1853

Change-Id: Ib2d56112b7b25e235d17bbc6df8dce4dc556e12d
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7259
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-18 12:44:18 +00:00
Richael Zhuang
c07a6a949b event/reactor: fix bug when showing core state
It should print "intr" when target->in_interrupt==1.

Change-Id: I74479da1dc66d937899fdf5c619cdf1a09951918
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7857
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-18 12:44:02 +00:00
Krishna Kanth Reddy
861bf2d1c3 test/nvme: Add test application to verify Simple Copy Command support
Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: I7bf61d98c444b473ec73f6afaf31ac408af6e409
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7696
Community-CI: Broadcom CI
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-18 12:43:24 +00:00
Mao Jiang
75f9a150a6 test/nvme_pcie_common: cases for creating and deleting IO queue
Change-Id: I79237a63b0f3b414cb3300bf41ee6193ce35e60f
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7632
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-18 12:42:52 +00:00
Niklas Cassel
99550a756d bdev/fio_plugin: fix typo in README.md
The definition is that:
max active zones >= max open zones.

The REAME.md incorrectly writes max active twice.
Fix this typo in the README.md.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I4b7d24d7bd1efcbe1608d3ee04d8900f83857f5e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7912
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-18 12:42:38 +00:00
Niklas Cassel
6e57273783 nvme/fio_plugin: implement support for fio .get_max_open_zones callback
Implement support for the recently added fio .get_max_open_zones callback.

If our ioengine does not implement this callback, fio will always result
in an error when using --zonemode=zbd, on platforms which does not have a
fio oslib implementation for this callback, e.g. FreeBSD.

On Linux, fio will by default try to parse sysfs, which will of course not
work on SPDK.

Implement this callback so that our ioengine will be able to provide fio
with the proper max open zones limit.

This will ensure that fio will be able to fetch the proper max open zones
limit, regardless of OS.

While our SPDK nvme ioengine did overwrite the max_open_zones option if it
was set to zero, this is a bit of a hack. The new fio callback is the
proper way to inform fio about the max open zones limit, so that fio itself
can have access to the actual device limit.
(Just overwriting the requested max_open_zones option will not allow fio
to know if the requested max_open_zones option exceeds the device limit.)
Remove the SPDK specific hack and update our README.md accordingly.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I532a0fa065b9e215ee6229b9100135e5403f198e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7898
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-18 12:42:38 +00:00
Niklas Cassel
ddf27c3d15 nvme/fio_plugin: move get_fio_qpair() out of ifdef and reuse it
Move get_fio_qpair() out of ifdef and reuse it in spdk_fio_queue(),
since the code is next to identical.
The only difference is that get_fio_qpair() returns NULL if qpair->ns
is not set.

Since we know that get_fio_qpair() returns NULL if qpair>ns is not set,
we can also remove the equivalent check in spdk_fio_queue().

Also use ns pointer instead of qpair->ns pointer in two other places
in spdk_fio_queue().

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ie647a814ff0b7a6f2bb81cbc9d7e95537fbe5256
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7897
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-18 12:42:38 +00:00
Niklas Cassel
afc432ba96 bdev/fio_plugin: implement support for fio .get_max_open_zones callback
Implement support for the recently added fio .get_max_open_zones callback.

If our ioengine does not implement this callback, fio will always result
in an error when using --zonemode=zbd, on platforms which does not have a
fio oslib implementation for this callback, e.g. FreeBSD.

On Linux, fio will by default try to parse sysfs, which will of course not
work on SPDK.

Implement this callback so that our ioengine will be able to provide fio
with the proper max open zones limit.

This will ensure that fio will be able to fetch the proper max open zones
limit, regardless of OS.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ia9c281290e11e4204d270ba4090edb73212ce20f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7896
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-18 12:42:38 +00:00
Jim Harris
199fa6015d util: add zipf random number generator
zipf is a power law probability distribution. When
applied to performance testing of block devices, it
will select blocks over the full range of LBAs, but
will more frequently select lower-numbered LBAs.
The theta parameter governs the distribution - higher
values of theta will concentrate the distribution on
a smaller number of LBAs.

Note that fio supports zipf, so adding it to SPDK
will enable our perf tools (bdevperf, nvme-perf) to
provide similar functionality.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7df129c9d61996a2070188c6cd9f1fde631ac208
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7779
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-17 11:29:52 +00:00
Jim Harris
da9766336e nvmf: delay remove subsystem cb until no qpairs remain
We cannot solely rely on the qpair_ctx->count reaching
0, because qpairs that are in process of being
disconnected will immediately invoke the qpair
disconnect cb.

Instead, we need to wait until the poll group
no longer has any qpairs remaining on the subsystem.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I977747d367d14a4bf60f66a1147b3d75679e5179
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7870
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
2021-05-17 09:52:37 +00:00
Richael Zhuang
d92a67be47 spdk_top: fix display of core_freq
When running scheduler/interrupt.sh, the core_freq displayed from
refresh_cores_tab() and show_core() mismatch for lcore 1. We should
get core_freq from cores[] array which has been qsort.

Change-Id: I4eba9b023cfa00700ab82c679d42fff22b85be46
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7854
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-17 09:52:26 +00:00
Ziye Yang
e18eaee2af bdev/rbd: Add cluster register/unregister RPC support
This patch is used to add two rpc calls:
bdev_rbd_register_cluster
bdev_rbd_unregister_cluster

Then in the next patch, rbd bdev constructed on the same cluster object
can share the common Rados_t structure in order to remove the thread creation
overhead and improve the scalability.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I898cc4ffabb8e6721ba5bef099cbf948c64d2c98
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7551
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-17 09:52:18 +00:00
Shuhei Matsumoto
fb68d4e9ac util: Add Free BSD Red-Black tree macros
Copy Free BSD's sys/sys/tree.h to SPDK's include/spdk/tree.h by
changing as little as possible.

A few changes are as follows:
- Remove a few lines located at the head of the file.
- Change the name of ifdef from _SYS_TREE_H_ to SPDK_TREE_H.
- Change the type __uintptr_t to uintptr_t.
- Change the attribute __unused to __attribute__((unused))
- Insert a space to the front and the end of CONSTCOND.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I26488d8fd61f80508cf7d96fbeb6007f12080a01
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7721
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-05-14 10:08:02 +00:00
Shuhei Matsumoto
4748ebef40 thread: Cache the closest timed poller into thread
When we introduce RB tree, getting the closest timed poller is not
O(1) but O(log N). To mitigate such delay, cache the closest timed
poller into thread, and update the cache when its content is changed.

Add unit test cases for this change. They will also clarify the current
behavior of spdk_poller_unregister() and spdk_poller_pause() for
timed pollers.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibb98a54c261859a3210034038d3953e5c93ef8aa
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7720
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-05-14 10:08:02 +00:00
Konrad Sztyber
4f11fa5b6c scripts/setup: use test -e to test for msr presence
Current `test -f` never succeeds, because `/dev/cpu/0/msr` is a
character device file.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Iaa28f04866ab24140668ad43351a37f0ccccef65
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7166
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-14 10:06:41 +00:00
Wojciech Malikowski
180d281c7f lib/ftl: Drain retry queue before shutdown
Requests that still reside on retry queue should be
submitted to disk before shutdown.

Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Change-Id: Id2d020fcaef6443d01cfd8628686e9b0f34a1cfa
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6771
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-14 10:05:34 +00:00
Alexey Marchuk
4642d7b264 nvmf/rdma: Embed fill_wr_sge into fill_wr_sgl
This patch reduces admount of changes in the next patch,
no functional changes added.
The next patch will add usage of contig IO buffers for
multi SGL payload. To support it we need to pass an
offset to fill_wr_sgl function. Also in the current
version we assume that for 1 iteration we fill 1 IO
buffer, the next patch will change it and we'll need
to swtich to the next IO buffer in special case. That
can't be done easily if we use fill_wr_sge function

Change-Id: Iee8209634637697f700f8fa9fe61ead156b6d622
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7258
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-14 10:03:56 +00:00
Ben Walker
64a9432c00 nvmf/tcp: Don't attempt to offload header digest calculations
The header is small enough that it likely won't ever make sense
to offload the digest computation.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ib6baa201a76d769d978f498f5c65985d5ab06ffd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7766
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-14 10:03:05 +00:00
Changpeng Liu
b885e23b95 bdev/iscsi: apply max_unmap and max_unmap_segments to bdev layer
The bdev layer can do the unmap split now based on the backend
device.  For now we only use 1 unmap descriptor, the bdev layer
can help us to do the split.

Fix issue #1888

Change-Id: Iaf740bafd4f2bb4b108133fee2aafd2f53da9b2b
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7519
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-14 10:00:54 +00:00
Changpeng Liu
2594e757e5 bdev/iscsi: save Block limits VPD unmap settings
Also free scsi_task data structure for the asynchronous
libiscsi APIs.

Change-Id: I0bff706bfb795e51a4b10c357913ae66493dca5d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7513
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-14 10:00:54 +00:00
Changpeng Liu
938cc7d959 bdev/iscsi: use req data structure as the input parameter
Change-Id: I70bf01fdb812044e172c4e022819bebd1e865e54
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7572
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-14 10:00:54 +00:00
Krishna Kanth Reddy
f795dd6e66 test/unit: Add unit test for Simple Copy Command
Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: Ia43f5d0588133027e80dc5707fd5940c44605c68
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7695
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-05-14 09:59:54 +00:00
Krishna Kanth Reddy
7a12f4812d lib/nvme: Add support for Simple Copy Command
Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: I7aae5abca6ba5621e99fd604d146d84401eb45cd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7694
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-14 09:59:54 +00:00
Jaylyn Ren
5f179d8bd1 perf: Fix an error about perf cores usage
There is an error when collecting the cpu usage data in perf.c.

The cpu busy data exceeds 100% when running perf tool with mutli-cores.

Signed-off-by: Jaylyn Ren <jaylyn.ren@arm.com>
Change-Id: I9a00f86a51fb52e115c37199aee6f849b235d868
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7431
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-13 10:27:10 +00:00
Michal Berger
8651ef29ab autotest: Make sure entire EXIT trap is executed
process_core() indicates error where any core files are found. If
that happens to be the case when the trap is called, the remaining
pieces won't be executed due to errexit being enabled. With that
in mind, simply ignore process_core's exit status.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I83527468bd1b41bf92b9ee8189a4c425be914552
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6990
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-13 10:19:49 +00:00
Ziye Yang
00c9dd5879 accel_engine/ioat: If no ioat devices found, we should return.
If no ioat devices are registered, we should return.

Change-Id: I03435946716ef653b230515da32e8ccbdf5a188a
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7834
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>
2021-05-13 10:18:48 +00:00
Ziye Yang
9442881ab9 accel_engine: Fix the coredump issue if no idxd engine is found.
The coredump info can be viewed in
https://github.com/spdk/spdk/issues/1935

We face this issue because no idxd device is attached, but we
still register the hw engine by spdk_accel_hw_engine_register
in accel_engine_idxd_init.

Fixes #1935

Change-Id: I537f06e2b2923faac7f2cd6a28903e77f1f6aaa5
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7832
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>
2021-05-13 10:18:48 +00:00
Changpeng Liu
6b372f419d nvmf: fix heap corruption of Reservation Report command
We should use `ns->registrants` to count the number of registered
controllers(REGCTL) for Reservation Report command, as `subsystem->ctrlrs`
only list current active sessions(controllers).

Also use the output data buffer directly so that we don't need to calloc/free
during the process of Reservation Report command.

Fix #1928

Change-Id: I650224b751a08416208b8a504b82debff31e92fd
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7822
Community-CI: Broadcom CI
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: wanghailiang <hailiangx.e.wang@intel.com>
2021-05-13 10:10:42 +00:00
Alexey Marchuk
3ebf25e020 test/unit/nvme: Use page size in nvme_pcie_qpair_construct_destroy
Some systems may have page size other than 4096 bytes

Change-Id: Id56bb1566fff480edbe1a293121fc7a68c74252a
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7820
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-05-13 10:09:45 +00:00
Michal Berger
3c578739e9 scripts/fio-wrapper: Make sure all nvme block devices exist
This is needed before we can start looking up attributes
of the block subsystem under sysfs. In some occasions they
may simply not exist yet at a given time.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I4261d17e92e02acec31b8affaccd0aa11c2b851e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7863
Community-CI: Broadcom CI
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>
2021-05-13 10:09:03 +00:00
Tomasz Zawadzki
42c82595c3 bdev/aio: respond to create RPC after bdev is examined
This makes use of newly added spdk_bdev_wait_for_examine(),
to only respond to RPC when bdev was fully examined.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If82cd913ab6653e8cc0da38c639b384b6c0303ba
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5482
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-13 10:07:07 +00:00
Tomasz Zawadzki
1c9125e78e test: add bdev_wait_for_examine to static JSON configs
Runtime RPCs such as bdev creation has no chance to wait for
bdev examination to finish. To handle this case commit below
introduced bdev_wait_for_examine RPC, and built it into all newly
saved JSON configurations:
(e57bb1af)lib/bdev: build bdev_wait_for_examine into subsystem

Some tests generate the configuration by hand, rather than
saving it from an existing application.
This patch embeds this RPC into the test configs.

Fixes #1760

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I79f998d722a2d19aa98b78333c64dbd2c1151444
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7861
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-13 10:07:07 +00:00
Tomasz Zawadzki
d69b16dac8 test/iscsi: remove comma from initiator_json_config
Function initiator_json_config is never called with
additional arguments that would fill up the subsystem
JSON.

Handling for the comma is removed.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6ce5648a0eac29cb0f45d210696edf7977dfe89d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7860
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-13 10:07:07 +00:00
Tomasz Zawadzki
64c6ddbf95 bdev/nvme: respond to attach RPC after bdev is examined
This makes use of newly added spdk_bdev_wait_for_examine(),
to only respond to RPC when bdev was fully examined.

Fixes #1760

Issue above was triggered in DD tests where application
finished before the examine had a chance to fully finish.
This patch addresses it by making sure that nvme attach
RPC waits for completion of the examine.
Later patch in series adds the bdev_wait_for_examine RPC
to multiple static configuration files. Making sure similar
issues do no occur for bdev modules which do not have changes
in their RPC as here.
The issue does not occur for JSON configs generated from apps,
see patch:
(e57bb1af)lib/bdev: build bdev_wait_for_examine into subsystem

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ie3ca2933af97a40ae01ecc3eefe2161d2d34c602
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5483
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-13 10:07:07 +00:00
Shuhei Matsumoto
54bc83dcc7 thread: Make struct spdk_thread and enum spdk_thread_state private in thread.c
Move the definition of struct spdk_thread and enum spdk_thread_state
from include/spdk_internal/thread.h to lib/thread/thread.c.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iab8cec9776e76668ebfb3c75064c316d10607421
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7802
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
6edc4abe4b thread: Change remaining direct accesses outside lib/thread to spdk_thread to helper functions
Use spdk_thread_get_last_tsc() and spdk_thread_get_stats() in
unit tests for reactor. As a result, we can change one inclusion
from spdk_internal/thread.h to spdk/thread.h.

This is the same effort as spdk_poller.

The following patches will move the definition of struct spdk_thread and
enum spdk_thread_state from include/spdk_internal/thread.h to
lib/thread/thread.c.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I24d4a52ecf885b6e7db749616ee1f95b82574dc5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7801
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
bd2fae2f0e thread: Change remaining direct accesses to io_channel outside lib/thread to helper functions
This is the same effort as spdk_poller.

The following patches will move the definition of struct spdk_thread and
enum spdk_thread_state from include/spdk_internal/thread.h to
lib/thread/thread.c.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7f7bdfdd7a7b1b834d16d79638a4fd2d63e9daf6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7800
Community-CI: Mellanox Build Bot
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>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
5fdb2b761b thread: Make struct spdk_poller and enum spdk_poller_state private in thread.c
Move the definition of struct spdk_poller and enum spdk_poller_state
from include/spdk_internal/thread.h to lib/thread/thread.c.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4480a0b7a2a94ef97ff3185e458221e8c473665d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7799
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
1aec9334d9 thread: Change direct accesses to poller outside lib/thread to helper functions
Most accesses to the struct spdk_poller outside lib/thread have been
done via functions but a few direct accesses remain.

Change these to indirect accesses by addinng a few helper functions
as SPDK internal APIs.

Add spdk_poller_get_name() to get the name of the poller.

Remove spdk_poller_state_str() and add spdk_poller_get_state_str().
Exposing enum spdk_poller_state outside lib/thread is not really
necessary.

This removal requires us to update major SO version.

Add spdk_poller_get_period_ticks() to get the period ticks of the
poller.

Add struct spdk_poller_stats and spdk_poller_get_stats() to get
the stats of the poller.

The next patch will move the definition of struct spdk_poller and
enum spdk_poller_state from include/spdk_internal/thread.h to
lib/thread/thread.c.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id597dae074a15fcd8af09fd9d416a22ce2f403c3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7798
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
9ff6238b88 event/scheduler: Include not spdk_internal/thread.h but spdk/thread.h
It is better if the internal of poller or thread is not accessed
outside lib/thread.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I80d488a111fd9a67a0da32d1e63695ce5a6bcb4c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7776
Community-CI: Mellanox Build Bot
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: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
f5313b5501 thread: Factor out removing timed poller from list into a helper function
The following patches will update the cache to the closest timed
poller when removing it from the list. To do it easier, factor out
the operation to remove a timed poller from timed_pollers list into
a helper function.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I25016d86117b240a2651d1f06e23bea0342211f1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7719
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
c204c3d786 thread: Change TAILQ_FOREACH_SAFE to TAILQ_FIRST() and _NEXT() for timed poller
When we introduce red black tree for timed pollers, we will not use
RB_FOREACH_SAFE() but cache the leftmost (smallest) node and iterate
from it via RB_NEXT() instead.

As another preparation, separate TAILQ_FOREACH_SAFE() into TAILQ_FIRST()
and TAILQ_NEXT().

The next patch will cache the first element to thread and refer it
first.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie03c387b5b3a055c668e7b439a5eb05ed77eaa81
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7718
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
aca41b43a3 thread: Factor out convert period from usec to ticks into a helper function
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1dc0a202aab61a42511d3afac6b6533cfe6d1ade
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7666
Community-CI: Mellanox Build Bot
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: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
42ad32da60 thread: Change if-else_if to switch-case blocks of spdk_poller_pause/resume()
It will be sufficiently reasonable to check if the caller thread is valid
even if spdk_poller_pause() or spdk_poller_resume() does nothing.
Besides, let's write all possibles states explicitly in switch - cases.

This refactoring clarifies the logic and makes the following patches easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1163eff388fe741d6b6924f474a82b1aa7d18acb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7665
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
3f45ed2467 thread: Change if-else_if to switch-case blocks of thread_execute_poller()
Change if - else if - else blocks of thread_execute_poller() and
thread_execute_timed_poller() to switch - cases blocks and specify
possible states explicitly in these switch - cases blocks.

The code will be simpler and clarified, and then the following patches
will be easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2e283894f5d69e1bd67466ae070c5b8bb9014616
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7664
Community-CI: Mellanox Build Bot
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: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
54215a1e9b thread: Factor out executing poller or timed poller into helper functions
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8792b698f5de85c24482d6781fc3d47afce0c414
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7663
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
84ec998976 thread: Check if timed poller is expired first in iteration of thread_poll()
There will be no issue even if time poller is unregistered or paused
after it is expired. The iteration is stopped anyway after the head poller
is found not to be expired.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2b394b8b517930a6630dd31f59fcaea12eb80572
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7662
Community-CI: Mellanox Build Bot
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: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
cd83ea4a6d thread: Add SPDK internal APIs spdk_thread_get_first/next_active/timed/paused_poller()
The following patches will introduce red black tree to manage
timed pollers efficiently but it will be based on macros available only
in lib/thread/thread.c. Hence then it will be difficult to expose the
internal of timed pollers tree outside the file. On the other hand,
we do not want to include JSON into the file.

Hence add a few SPDK internal APIs to iterate pollers list transparently.

For spdk_thread_get_next_active/timed/pause_poller(), we omit the parameter
thread and get it internally from poller->thread even if the names include
the term "thread". This will be slightly cleaner.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I000801a2e4dc42fa79801a2fd6f2b06e1b769c88
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7717
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-13 10:03:44 +00:00
Shuhei Matsumoto
d5b7f3c580 thread: Add check if the correct thread called spdk_poller_pause/resume()
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie2156a331bc2384a1cebe66fcddb90ef5aa1c380
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7661
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: <dongx.yi@intel.com>
2021-05-13 10:03:44 +00:00
Jonathan Teh
be6a01efb3 nvmf: Allow configurable controller ID range
Add {min,max}_cntlid to spdk_nvmf_subsystem, defaulting to 1 and
0xFFEF, respectively, and add nvmf_subsystem_set_cntlid_range() to
allow the controller range to be configured in the range [min_cntlid,
max_cntlid].

Also add {min,max}_cntlid to the nvmf_create_subsystem RPC to allow
the controller ID range to be specified when creating an nvmf
subsystem.

Signed-off-by: Jonathan Teh <jonathan.teh@mayadata.io>
Change-Id: I936db3bb0c9a38569063a6fd3c11df262dfad776
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7322
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-12 09:18:48 +00:00
Niklas Cassel
acca0749df nvme/fio_plugin: change zone append print to SPDK_DEBUGLOG
Change zone append print to SPDK_DEBUGLOG() instead of an unconditional
print. Since we already print a warning when zone append isn't supported,
there is no need to unconditionally print something for the success case.
This also matches the behavior of the SPDK fio bdev plugin.

Also improve the zone append help text to match the SPDK fio bdev plugin.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ic7604ea4bdf17e0cddfe2638f3db7944ee652474
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7804
Community-CI: Broadcom CI
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>
2021-05-12 09:18:10 +00:00
Niklas Cassel
367784a641 bdev/fio_plugin: update README.md and add example zbd config
Update README.md with information specific to zoned block devices.
Additionally, add an example config that can be used to test the
--zonemode=zbd fio option using the virtual zoned block device
SPDK module on top of a Malloc bdev.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I68bbc07ab70ad1ce8e38abc91dd8c15c49f90656
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7758
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-12 09:18:10 +00:00
Niklas Cassel
e415c253a3 bdev/fio_plugin: add support for --zone_append
Add support for using zone append commands instead of write command,
for bdevs that support it.

In the SPDK NVMe plugin, the target struct (called spdk_fio_qpair) is
allocated in .setup(), but the qpair is first created in .open_file.

In the SPDK bdev plugin, the target struct (called spdk_fio_target)
is allocated in spdk_fio_bdev_open(). This function also creates the
I/O channel. (spdk_fio_bdev_open() is called by .init().)

Since certain options has to be saved in the struct spdk_fio_target,
which is allocated quite late, we cannot reuse spdk_fio_handle_options(),
which has to be called before threads are created.

Therefore, we unfortunately need another option parsing function in the
SPDK bdev plugin.

If we fail to handle any of the per target options, the target is never
added to the list of targets, and is freed immediately.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Iacd1924c8f0d3d324f2a6f1b0a54f86459f39d31
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7727
Community-CI: Broadcom CI
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>
2021-05-12 09:18:10 +00:00
Mao Jiang
3067ecaa0c nvme/ctrlr: fix namespaces indexed overflow risk
Change-Id: Ied1de194621a02f6eeaafc23ce5ff467760a71aa
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7772
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-12 09:17:38 +00:00
Ziye Yang
b940247b3e bdev/rbd: Use the same Rados cluster object in the same RBD bdev
This patch is design to use the single Rados Cluster
object in the same RBD if there are multiple I/O channels created.

And this patch will be prepared for the next patch to share
the same cluster among different RBD bdevs.

Change-Id: I1509f29a9c1088da308a3f88980f0c7fed26476f
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7601
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-12 08:49:25 +00:00
Changpeng Liu
67eb36c7fa nvme: remove aligned attribute
When testing vfio-user target with QEMU, there is following error log:

ctrlr.c:2143:31: runtime error: member access within misaligned address 0x7fe526a73d98 for type 'struct spdk_nvme_ctrlr_data', which requires 16 byte alignment

For vfio-user transport, the memory buffer is allocated by clients, so
we can't assume the memory is always aligned, just remove the
aligned attribute.

Change-Id: Ie80530415013ebd7bcb8cdabca97d7d0e34857f9
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7797
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-12 08:48:47 +00:00
ChengqiangMeng
744f401cc9 test/nvme_fabric: Remove priority assert check for rdma.
It's only for tcp now, but the transport here is rdma. So there is no need to assert.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: Ieffaac9d31a8f9c79a0d9fd226d74268986b7a77
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7823
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
2021-05-12 08:48:28 +00:00
Michal Berger
b96ec35dc8 scripts: Remove fio.py
With https://review.spdk.io/gerrit/c/spdk/spdk/+/7684 there are no
more active uses of it in the test suites.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: If6f8227b68f1fe1a4038cec2b6107eac82ad44de
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7698
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>
2021-05-12 08:48:10 +00:00
Michal Berger
19f0c9a0d0 autotest: Replace fio.py with a bash wrapper in tests
fio.py simply wraps itself around fio and doesn't do anything that
would require python to be in use. Having it in a simple bash form
makes it easier to integrate it with autotest's common sh tooling
and to debug any potential issues with the underlying tests.

This also fixes #1919 by making sure only proper nvme devices are
selected for the nvmf targets.

Fixes: #1919.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I111d00df3c7b2517f431cae865e258a665c2ecb3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7684
Community-CI: Broadcom CI
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>
2021-05-12 08:48:10 +00:00
Changpeng Liu
55189bee6b libvfio-user: update submodule
This update will stop using `struct vfio_device_info` from
<linux/vfio.h>.

Fix issue #1922.

Change-Id: Ia7ad745db8d7ed8f5248ca13e3188ebd540b0e40
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7831
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-12 08:46:29 +00:00
Krishna Kanth Reddy
78a794b9a3 examples/identify: Identification of Simple Copy Command support
Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: I251f3b1a6c7e36b946ddc8bd8a07b0f588e23c9e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7693
Community-CI: Mellanox Build Bot
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: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-11 12:04:54 +00:00
Jim Harris
b549f4113c build: relink apps when vfio-user library is updated
Look for 'vfio_user' in SPDK_LIB_FILES to determine
whether the target application actually needs to be
rebuilt.

Fixes issue #1930.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If3f699c91972e20dc4520e25c655ed11f6843be0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7826
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-11 12:04:36 +00:00
Jim Harris
1f5bae841a build: also look for vfio-user libraries in 'lib'
At least on some Ubuntu distributions, default
vfio-user install puts libs in usr/local/lib instead
of usr/local/lib64.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib312d8ca9b4ce9e858a9a9e76525fc8afd48ced5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7825
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-05-11 12:04:36 +00:00
Tomasz Zawadzki
a8fe601853 lib/blob: delay executing blob persist completions
This helps in next patch in series where multiple
completions will be executing.

UT is adjusted since one additional poll is required.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id72377ddef91e40cdbc2bdea6f33c23309b0ca3d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7642
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-11 12:03:57 +00:00
Tomasz Zawadzki
958364b4a0 lib/blob: only verify cluster allocation when I/O is not frozen
During snapshot creation the original blob becomes
a thin provisioned blob that will only the diff of data after
snapshot creation.

Despite the comment in the UT the number of polls before issuing
blob write was hitting blob BEFORE it swapped with new one.

Issuing I/O during this period shall check for io freeze
before checking cluster allocation.

Otherwise bs_io_unit_is_allocated() hits assert for thin
provisioned blob. This is because cluster map of blob is
empty, but properties have not been updated yet.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I742e1a50b14d456ae1e6de13b5111caec3e8322c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7641
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-11 12:03:57 +00:00
Changpeng Liu
d0b4deab2b UT/bdev: add unmap UT to cover the split case
Change-Id: I902c9ce113cfbb2549ecb720951403496dec6d06
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7579
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-11 12:03:28 +00:00
Changpeng Liu
218d6ac8cc bdev: add bdev_unmap_split() support
Also for the purpose to avoid a burst of children unmap request,
we will submit at most up to 8 children request at a time for
a big UNMAP command.

Change-Id: Iaf0f18b07517e0a8f84dc04e8c93b95691a1a43c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7518
Community-CI: Broadcom CI
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: Ben Walker <benjamin.walker@intel.com>
2021-05-11 12:03:28 +00:00
Changpeng Liu
e6db8e02e5 bdev: add a helper function to process IO split submission
Both UNMAP and R/W will share the some logic to process the submission,
so combine them to a helper function first.

Change-Id: Ia4f234c6a58f078d3e9f88cacaf1510a17f07acc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7606
Community-CI: Broadcom CI
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>
2021-05-11 12:03:28 +00:00
jiaqizho
64debe0453 rpc: add a command parser
The changes in the nvmf_create_transport show
how this command parser work. And there have
two benefit for this changed.

1. Simplify the definition of rpc method. no need add
so many args anymore. Also it retains its original
functions, so we can also check the input args.

2. Make the rpc call more versatile, for example.
when user extend the subparsers(add new args
into subparsers), they can pass some private args
into the rpc method by command parser.

Signed-off-by: jiaqizho <jiaqi.zhou@intel.com>
Change-Id: Iaf916e3454f23715cf9216794bb80c65b2b4603f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6652
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-11 12:02:00 +00:00
Mao Jiang
980a139631 test/nvmf/ctrlr_bdev: cases for identify namespace
Change-Id: I315f48185268da696e4047e1c7ac5cf2a4221765
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7285
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-11 12:00:15 +00:00
Swapnil Ingle
2421e99849 scsi: Cache physical block size locally
Addressing review comment from 6cebe9d0.
Minor optimisation to cache result of spdk_u32log2() into local variable
instead of calling it multiple times.

Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Change-Id: I2fd6afd1e3ee461662de3f9d278958664224e106
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7806
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: sunshihao <sunshihao@huawei.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
2021-05-11 11:59:31 +00:00
Shuhei Matsumoto
646f41476d ut/nvme_fabric: Fix access to local variable after returning from the function
Fix issue #1936

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iaa2b8060053d3f798001a6b207a6fcb0335c4b23
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7833
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-11 11:58:46 +00:00
Jim Harris
53447f060f nvmf: remove a bdev_module.h #include
ctrlr_discovery.c doesn't need this #include.
Including it causes bdev_module.h types to be
emitted to the debug symbols at least with some
compilers, which can result in unwanted abidiff
errors.

The unit tests do need it, so just include it
there instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iad28f9778ce08b11b52325658583ae9032295f3a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7813
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-11 11:57:01 +00:00
Jim Harris
8a12e2e715 scsi: don't include bdev_module.h
The library itself doesn't need it. The unit tests
do need it, so just include it there.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9aefd303ae12928d45141029436509f185105bd3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7812
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-11 11:57:01 +00:00
Jim Harris
eef5159387 module/blob/bdev: use __SPDK_BDEV_MODULE_ONLY
This module only requires the spdk_bdev_module
APIs, so use this #define to avoid having to
bump so version when spdk_bdev is modified.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I292c38e60cbf21d0d5a6583cb2a2b097c524f3d1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7811
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-11 11:57:01 +00:00
Rafal Stefanowski
8fcb8b966d bdev/ocf: Improve cache line size handling
- Use consistent cache line size units in KiB across RPC calls
and config files. The KiB units are much easier to use then
the bytes units and are more human readable.
- Properly handle cache start when cache line size is incorrect.
- Add test to check if cache line size value is reported correctly.
- Add cache line size info to JSON RPC documentation.

Fixes #1858

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
Change-Id: Iec9ede85f6884b64605d2d112947b3f175cbd938
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7614
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-11 11:56:04 +00:00
Michal Berger
eb4b79919a pkgdep/git: Bump vanilla qemu to v6.0.0
Older version wasn't providing full support for PMR setup, this one
does.

Rewrite get-pmr such that it supports CMB/PMR sizes greater than 4GB.
Also, since CMB and PMR can coexist in newer versions of qemu try to
detect both under single device.

E.g.:

nvme0:0000:00:04.0:64-bit:prefetchable:0x700000000:0x707ffffff:0x08000000:cmb
nvme0:0000:00:04.0:64-bit:prefetchable:0x400000000:0x5ffffffff:0x200000000:pmr
nvme1:0000:00:05.0:64-bit:prefetchable:0x708000000:0x70fffffff:0x08000000:cmb
nvme2:0000:00:06.0:64-bit:prefetchable:0x600000000:0x6ffffffff:0x100000000:cmb

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ic159f5c12d3ef39db77617f7d64f825356c255a4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7539
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>
2021-05-11 11:51:01 +00:00
Ziye Yang
f99d46d5f7 bdev/aio: move disk free operation in spdk_io_device_unregister's call back
Recently, checked the spdk_io_device_unregister function,
it will have deferred free behaviour, and the io_device
will possibly be freed in put_io_channel function.

And this means that it is not safe to directly call:
    spdk_io_device_unregister (io_device, NULL);
    Then free io_device relately resource.

Because there will be channel to use the resources associated
with io_device. Then we will possibly cause a NULL pointer access.

I found this issue in bdev rbd module, and I think that the
same issue could happen in other modules. So it is better to put the
resource free function as the call back function.

Change-Id: Icc1f86d72b672faefb3b7f416030b818a8cf45ce
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7646
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-11 11:50:48 +00:00
Tomasz Zawadzki
47c4304d83 subsystem/nvmf: remove cpu_mask hint when creating poll group
Passing cpu_mask hints that match only single core were
usefull to prevent any accidents when doing round-robin
in case of 'static' scheduler.
In practice this is not required in case of 'static' scheduler,
the threads will be spread out over all reactors anyway.

This hinders other schedulers which try to respect the cpu_mask
hints, as they would not move the thread to any reactor.
Preventing bunching up less used threads on single reactor.

Drawback of this patch is that poll group names will not match
the cores they are on.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I5fb308362dd045228ea9fcca24f988388854c054
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7028
Community-CI: Broadcom CI
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: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-11 11:49:52 +00:00
Robert Baldyga
d20f41881b spdk_zmalloc: Remove unnecessary memset()
Normally, unless RTE_MALLOC_DEBUG is set, DPDK zeroes memory in rte_free().
If RTE_MALLOC_DEBUG rte_free() fills memory with poison pattern, but then
(and only then) the memory is zeroed in rte_zmalloc_socket(). Relying on
this behavior allows to avoid unnecessary memset() in spdk_zmalloc() path.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
Change-Id: If3efa4dd22f1568949c3fb529b604bd597ceb32f
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6975
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-11 11:49:06 +00:00
Ziye Yang
c94648ff91 lib/accel: Add the missed seed assignment for chain crc32c support.
We did not find this issue, because we always use seed = 0 to test.
Definitely, we need to assign the seed value.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I6bec1b6d61480cdd7c9e27578dcaf5de2f65cf44
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7716
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-05-10 11:14:37 +00:00
Jonas Pfefferle
19faf91293 nvmf: ctrlr_create - fix missing free qpair_mask on error
This patch fixes missing free of qpair_mask when a listener error
occurs in ctrlr_create.

Signed-off-by: Jonas Pfefferle <pepperjo@japf.ch>
Change-Id: I09162b86d8ac73bf9fc2006a08dcc0a955f222b3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7818
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-10 11:14:24 +00:00
paul luse
e8fc521f7d lib/idxd: set error status on any completion error.
Not just one with extra available info.  Also remove the extra
read of the error register, not required.

fixes: #1927

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I28badb45d8cc8d16b72f7019bd2a2044998fc402
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7729
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-05-10 11:13:26 +00:00
Curt Bruns
b89ad84532 nvme: add support for NVME_IOCTL_IO_CMD for cuse
Nvme-cli uses NVME_IOCTL_IO_CMDs for "io-passthru"
commands to cuse devices.  This patch adds support
for that IOCTL.

Signed-off-by: Curt Bruns <curt.e.bruns@gmail.com>
Change-Id: I20e0ac91ba08fce91bc5da1f4a1e454058cdd1e7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7741
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-10 11:13:09 +00:00
Curt Bruns
f3edd7a359 nvme: rename "admin" to "passthru" for cuse
The nvme cuse IOCTLs are actually creating passthru commands
that can be either IO passthru commands or admin commands.
Renaming the routines to correctly reflect that should limit
the confusion when reading the code.  Passthru commands that
are admin commands will go to the spdk_nvme_ctrlr_cmd_admin_raw
interface and passthru commands that are IO will be sent to the
spdk_nvme_ctrlr_cmd_io_raw interface.

Signed-off-by: Curt Bruns <curt.e.bruns@gmail.com>
Change-Id: I8d427fe8b5f503fdb2d193236c77d410d5b13886
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7740
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-10 11:13:09 +00:00
Curt Bruns
4c19332b0c nvme: add cuse support for BLKSSZGET IOCTL
Nvme-cli uses BLKSSZGET so support needs to be added for
nvme cuse devices.

Signed-off-by: Curt Bruns <curt.e.bruns@gmail.com>
Change-Id: Ic8316713b2d017c8ff32a225efff6bcb95842799
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7708
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-10 11:13:09 +00:00
Curt Bruns
0ba168fe39 nvme: add SPDK_DEBUGLOG support for nvme_cuse
It is useful to have debug log information in the nvme_cuse
path when debugging IOCTls and flows.

Signed-off-by: Curt Bruns <curt.e.bruns@gmail.com>
Change-Id: Ifef1bb82c96438e2fcbb9ad2fafe3f3eb66bed51
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7707
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-10 11:13:09 +00:00
Ziye Yang
bcbccf8bb5 lib/nvme_tcp: Refactor the code to generate _nvme_tcp_pdu_payload_handle
The purpose is to prepared for implement the async crc32 caculation
in the future patch.

Change-Id: Ia75f28154c49f08b527d48c63b9da79a6bdfede8
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7794
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-10 11:12:57 +00:00
Ziye Yang
bc35dab91c lib/nvmf: Refactor the code to generate _nvmf_tcp_pdu_payload_handle
The purpose is to prepared for implement the async crc32 caculation
in the future patch.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I49f84ea1966f0acdd6f5aeb7192896f91fd16dee
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7793
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-10 11:12:57 +00:00
Ziye Yang
4e0ca20a8a idxd: Do not present pci device info in accel_engine_idxd.c module
Purpose: We will also support the kernel idxd driver, so we do not
need export this feature in the module file.

Change-Id: I965e031497920f527962ba187bccd81de6977b8f
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7336
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-10 11:12:40 +00:00
Konrad Sztyber
a7c37873b4 module/zone_block: don't align size to optimal open zones
There's no good reason to reduce the capacity by aligning it to the
number of optimal open zones.  If such alignment is required by the
users of the zone block bdev, it should be done on their own layer.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ic8614a82715e9f064619aa8fdb75d1a0b851490c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7656
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-05-07 20:37:22 +00:00
Ziye Yang
cf41deae8b idxd: update the major so version for libspdk_idxd
Change-Id: I6ad71a65244526e99a36920c630096cc9739d94d
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7809
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-05-07 15:03:44 +00:00
Niklas Cassel
e3997dc23b bdev/fio_plugin: add support for --initial_zone_reset
--initial_zone_reset has to be done before fio creates its threads.
Since --zonemode=zbd only supports --create_serialize=1 (default),
this is possible.

Since this requires an I/O channel, and is called before threads
are created, follow the same pattern as spdk_fio_report_zones()
and simply initialize the thread early if this option is used.

Just like spdk_fio_report_zones(), thread cleanup has to be
called explicitly in case of error. (Since fio will only call
.cleanup() on threads that it has called .init() on.)

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I7d4dedce88309e4c6e5800ed3d56cd5ccb297551
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7726
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-07 11:41:46 +00:00
Niklas Cassel
36728cd80d bdev/fio_plugin: implement callbacks needed for fio --zonemode=zbd
Implement callbacks needed for fio --zonemode=zbd, so that we can use fio
to exercise the bdev-zone layer in SPDK.

spdk_fio_report_zones() will be called before SPDK normally initializes
the threads.

spdk_fio_report_zones() simply initializes its spdk thread when called.
Threads not running against a zoned block device are not affected.

Each spdk thread is still destroyed after the fio run has completed,
as normal. If spdk_fio_report_zones() encounters an error, we have
to call spdk_fio_cleanup() so that the thread is added to the global
list of spdk threads that are cleaned up after main loop exit.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ia094eae8c9e44d8cfc66a5d9b7100f09f9db456a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7725
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-07 11:41:46 +00:00
Niklas Cassel
af72965519 bdev/fio_plugin: fix scan-build error
spdk_fio_init_thread() assigns td->io_ops_data.
spdk_fio_init_thread() can return an error, but currently lacks error
handling code.

Add error handling code, and add an assertion that fio_thread
(td->io_ops_data) is assigned when spdk_fio_init_thread() didn't return
an error.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I8de7d59db0373599c90aa57fffa476c6707b6104
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7732
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-07 11:41:46 +00:00
Ziye Yang
82e4bfd346 nvme/tcp: Change the type of recv_pdu to pointer.
This is prepared for using the hardware offloading
engine in accel framework. And some fields in nvme_tcp_pdu
needs to be DMA addressable.

Change-Id: I75325e2cd7ff25fe938bea0ac9489a5027e3e0e9
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7770
Community-CI: Mellanox Build Bot
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>
2021-05-07 11:41:24 +00:00
Ziye Yang
f8ac678ec3 lib/nvmf: Change the pdu_in_progress in tqpair to pointer.
This is used to prepare using the accel framework to calculate
the crc32 because some fields in this structure needs to be allocated
in DMA addressable memory.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ib8def5596e60f4702709da647145c4e2b6d6848f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7767
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-07 11:41:24 +00:00
Mao Jiang
d16c5b49dd test/nvme_pcie: cases for cmb mapping
Change-Id: I8b781b519aca901f34697f9ff165a92d0511201c
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7490
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-05-07 11:40:40 +00:00
sunshihao520
cd9619a3db bdev/bdev_nvme: Don't send abort cmd to ctrlr if the reset is running.
Signed-off-by: sunshihao <sunshihao@huawei.com>
Change-Id: Ib16cfaddc00ed0d461fa04b835134de403223553
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7024
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-05-07 11:40:20 +00:00
Scott Peterson
f98623bb55 nvmf: define vendor specific log page range
Also add a macro to test a given log page ID.

Signed-off-by: Scott Peterson <scott.d.peterson@intel.com>
Change-Id: Id4d00f5c3d8af76b24ce010d6f922025a31312b4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4115
Community-CI: Mellanox Build Bot
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>
2021-05-07 11:38:32 +00:00
Mao Jiang
c68200086f test/fabric: cases for fabric discovery
Change-Id: I00c7f6e827fc7d2cd4775129a6acd866245ecdb4
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7690
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-07 11:37:49 +00:00
Mao Jiang
8e3d60a116 test/nvme_pcie_common: cases for pcie qpair construct and destroy
Change-Id: I2ff57cec09139d54743a06d24dc5294f574d8378
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7059
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-07 11:37:00 +00:00
Jim Harris
de6e5c30c9 scsi: use SPDK_TRACE_ARG_TYPE #defines
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ifc2a79891ab26643a2783d0e6482d58449a300f5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7764
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 11:35:38 +00:00
Jim Harris
40cf86f20a nvmf: use SPDK_TRACE_ARG_TYPE #defines
Note: a lot of the TCP and FC trace registers were
specifying '1' which means the arg type is a pointer,
but in reality it is always passing 0 for arg1.  So
this patch just changes them to SPDK_TRACE_ARG_TYPE_INT.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I18d3cedd21e516f16cb2cd0a7f8c16670b1895d7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7763
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 11:35:38 +00:00
Jim Harris
a7ea7cbc57 iscsi: use SPDK_TRACE_ARG_TYPE #defines
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I033aa060feb0f6e4a9abedd8cf1335b25437fa99
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7762
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 11:35:38 +00:00
Jim Harris
12cc5e2e50 doc: use SPDK_TRACE_ARG_TYPE #defines
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Idcffe9ae197fc0257b89ca0854fe722fbf1ca916
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7761
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 11:35:38 +00:00
Jim Harris
469a504bae bdev: use SPDK_TRACE_ARG_TYPE #defines
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iddcc9ab7b5077368a4fbda72e650b381ef42b6cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7760
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 11:35:38 +00:00
Jim Harris
a4c37c6a56 ftl: use SPDK_TRACE_ARG_TYPE #defines
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I10a0a2bf3f2bdcef0b4e4c76ee6958151c2b61e6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7759
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 11:35:38 +00:00
Jim Harris
b8fb7d67be iscsi: track PDU object for WRITE_START/WRITE_DONE events
We already pass the PDU as arg1, so by changing the
trace register descriptions, we can map the PDUs to
more readable IDs when running the spdk_trace app.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iad7106eeb0f5fe738f81da5ee174515d1cf4b6ce
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7757
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 11:35:38 +00:00
Jim Harris
7e52eb740a iscsi: fix ISCSI_READ_PDU spdk_trace_record
This was accidentally moved to the wrong place as
part of some earlier iSCSI refactoring.  This trace
record should be executed when we have finished
reading all of the data for any PDU, not just those
with immediate data.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib1d17e5e79ff220e9e9b3dd55e247e745bd58019
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7756
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 11:35:38 +00:00
Jim Harris
3faf457f56 bdev/nvme: do not use DSM to emulate write zeroes
We cannot rely on DSM/DEALLOCATE as a write zeroes
alternative, even if DLFEAT reports that deallocated
blocks will be read as all zeroes.  DEALLOCATE is
advisory, meaning that blocks may not actually be
deallocated.  In cases where they are not deallocated,
they will not be read back later as zeroes.

QEMU 6.0 started reporting DLFEAT as returning zeroes
for deallocated blocks but for some of our write
zeroes tests, blocks aren't actually deallocated.

We may be able to add quirks in the future if we know
that a controller reliably deallocates blocks, but
for now we need to revert this completely.

Note that since bdev/nvme module now does not support
write zeroes in any cases, we need to disable the
write zeroes call in the unit tests.

Fixes issue #1932.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I79f0673774b621a9ffcc46891728cc7719e34cdb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7723
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-07 11:32:23 +00:00
John Levon
bbfbcc1967 vfio-user: add disable-mappable-bar0 flag
It can be useful for testing or development purposes to force clients to write
to doorbells using vfio-user messages instead of directly into shared memory;
add a transport-specific option to disable the shared mapping.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I7ed062fbe211ba27c85d00b12d81a0f84a8322ed
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7554
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-07 11:31:20 +00:00
Changpeng Liu
4f1530c9eb bdev: add bdev_unmap_should_split() function
Change-Id: I2680eef93da13d8378527349cdc5ba36859f89dc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7517
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-07 11:30:55 +00:00
Changpeng Liu
d4d5e20d29 bdev: rename bdev_io_split to bdev_rw_split
This will help us to add unmap split function, also
remove bdev_io_type_can_split() because we changed
to use swith(io_type) ... case now.

Change-Id: I449d6a9f5bf2d0b43dd124bbfc9e1ca2afddc15a
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7516
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-05-07 11:30:55 +00:00
Changpeng Liu
f6d5b9cd92 bdev: introduce unmap attributes to bdev layer
The backend device module can report such capabilities
to the bdev layer, and we can split unmap request into
multiple children requests in the bdev layer.

Change-Id: I81daf7e58b797a2673ef102f2a037de20771092e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7515
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-05-07 11:30:55 +00:00
Changpeng Liu
518d28dba9 scsi/bdev: free bdev_io when there are split requests
Only the last bdev_io can be freed without this fix.

Change-Id: I0d05b5d89e38ef60872ebc0f23aaed0c622593c4
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7571
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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: <dongx.yi@intel.com>
2021-05-07 11:30:55 +00:00
Ziye Yang
20698a4a8d idxd: Split the idxd library into common and user space part.
Purpose: This patch is used to prepare to add the kernel
idxd support later.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: If89665f95d622c7342ab75050664158ec6fc615a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7330
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 08:56:20 +00:00
Swapnil Ingle
6cebe9d06b nvmf: Support physical block size if exposed by bdev
(Note: this patch was previously applied as b32cfc46 and then reverted
as 63642bef.)

Today the in-guest nvme device shows physical_block_size=512 even though
the backend iSCSI bdev supports physical_block_size=4K

iSCSI targets exposes physical block size using
logical_block_per_physical_block_exponent in READ_CAPACITY_16

NPWG is one of the way to let Linux nvme driver set
physical_block_size of the nvme block device.

This patch adds spdk_bdev.phys_blocklen which is updated if the iSCSI
backend exposes physical_block_size.
Later phys_blocklen is used in nvmf to set NPWG and NAWUPF to report
back during NS identity.
Linux driver uses min(nawupf, npwg) to set physical_block_size.

Similarly in scsi_bdev fill lbppbe in READ_CAP16 response
based on spdk_bdev.phys_blocklen.

Fixes #1884

Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Change-Id: I0b6c81f1937e346d448f49c927eda8c79d2d75c0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7739
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-06 07:14:40 +00:00
Jim Harris
fa79643725 nvmf: remove struct spdk_bdev definition dependencies
1) use spdk_bdev_get_name() accessor
2) use __SPDK_BDEV_MODULE_ONLY #define

The latter allows nvmf to just get the spdk_bdev_module
definitions and APIs that it needs for claiming bdevs
for purposes of avoiding the same namespace used in
different subsystems.

This also ensures that future changes to structures
like spdk_bdev and spdk_bdev_io will not cause
lib/nvmf so version changes.

Note: we include bdev_module.h explicitly in the
nvmf/subsystem unit tests now, before including
subsystem.c, because the unit tests do depend on
knowing the internal structure of spdk_bdev.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2f499a741d19f4749eadb402641f28137245fd23
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7738
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-06 07:14:40 +00:00
Jim Harris
2b9ec05ba7 bdev: add __SPDK_BDEV_MODULE_ONLY to bdev_module.h
We have some cases where libraries need the
spdk_bdev_module structure definition and a couple
of related APIs, but not everything else (i.e.
spdk_bdev, spdk_bdev_io), for purposes of avoiding
abidiff errors.

For example, nvmf creates a dummy spdk_bdev_module,
and then uses it with the spdk_bdev_module_claim_bdev
API to ensure multiple subsystems cannot add the same
bdev as a namespace.

But when nvmf includes bdev_module.h, it pulls in the
spdk_bdev structure definition as well.  This means
when the spdk_bdev structure is modified, it requires
a major version bump since abidiff detects the
difference in the debug info.

Alternatives considered:

* We could add a specific suppression into our abidiff
script for nvmf and struct spdk_bdev, but it would be
a risk (albeit very very small one) that we could
add a real dependency on struct spdk_bdev in the future,
and the suppression would hide the difference.

* We could also break out bdev_module.h into multiple
header files, but the ways of doing that either result
in odd file naming, or modifying every bdev module to
include a new header.

* We could add a public bdev API to expose what the
bdev library needs, but that seemed even more intrusive
than this change. nvmf is kind of abusing the bdev_module
API here, and I'd prefer to not promote that kind of
usage by adding something to the bdev API.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie8fdef8ea294d005b9ae7934dde49c62748420d1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7737
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-06 07:14:40 +00:00
Jim Harris
3e54a5bb43 bdev: rearrange bdev_module.h
Move some of the bdev_module APIs immediately after
the bdev_module structure definition.  This prepares
for an upcoming patch.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I78d534ba047048ec27d8d3159666584a52211de3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7736
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-06 07:14:40 +00:00
Mao Jiang
bc7da85481 test/nvme_qpair: cases for getting sgl print information
Change-Id: Ic3cff09a102c4224eda3c4f6e2da0c17e50db303
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7552
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-06 07:13:09 +00:00
Mao Jiang
912dc67755 test/nvme_ctrlr_cmd: cases for command security receiving and sending
Change-Id: I07c7863ddadf333f15cfb2ebb64e7b3dcf5554d1
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7364
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-06 07:12:42 +00:00
Changpeng Liu
ed2942461d nvmf/vfio-user: ignore unmapped DMA regions
libvfio-user DMA APIs report all regions notified by the client, including those
that don't have a corresponding shared mapping.  There are several of these for
a typical VM, so just ignore this case.

Signed-off-by: John Levon <john.levon@nutanix.com>
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Change-Id: I37b06f4bc6d1818a03c8742616ed142f575d3f0e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7532
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-05 14:25:32 +00:00
Mao Jiang
517164a5fd test/nvme_ctrlr: cases for setting arbitration feature and ctrlr state
Change-Id: I7467049e5f5f256704f5eb8fd51a0c9c1c44a581
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7196
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-05 13:33:51 +00:00
Maciej Wawryk
33227bbcc0 test/nvmf: add remove non-existent subsystem listener test
Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I3504e874d8ec1c8bacbd394e3d4d208dc155f45c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7038
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-05 13:33:11 +00:00
sunshihao520
2fc1ccae77 lib/nvme: add value check to fix value inversion
When payload_size is 0, we may get wrong cdw10 because of the calculate: 0 - 1,
add value check to fix value inversion bug.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Change-Id: I3bcd38ba981c854ff917282341d32aac47d22b76
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7443
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@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>
2021-05-05 13:32:30 +00:00
Jim Harris
32999ab917 jsonrpc: use SOCK_NONBLOCK in socket() calls
This allows us to remove separate fcntl() calls to
set O_NONBLOCK.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I1a590cfb3b65b3174bb5ef33e060cdc9bb7ac86c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7598
Community-CI: Mellanox Build Bot
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-05-05 13:31:10 +00:00
Jim Harris
c86075607b nbd: use SOCK_NONBLOCK with socketpair() call
This simplifies the code a bit, removing the need
for the separate fcntl() calls.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4fef8f01a055d1471df87bd979c21d6198e9868a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7596
Community-CI: Mellanox Build Bot
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-05-05 13:31:10 +00:00
Ziye Yang
988af676da nvmf/tcp: Remove the unnecessary qpair setting.
It is already set by nvmf_tcp_req_pdu_init
when we get the pdu. So we do not set it again.

Change-Id: I034bbc46e600afd802457c0b152e303f16bafba3
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7714
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-05-05 13:29:37 +00:00
Michal Berger
d97b106f81 pkgdep: Update liburing version to 2.0 release
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I239c6eb2e9919a4605a14d39f4462b3aa5f54883
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7496
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
2021-05-05 13:27:16 +00:00
yidong0635
40549bb48e log_rpc: Unify codes in end path.
Unify the end path, and remove duplicate codes.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: Ie36cb2182b2b0b23f36670780b6e7af3652dc94b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7520
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-05 13:26:06 +00:00
John Kariuki
b69796f777 scripts/perf: fix json param names
Fixed parameter names in the sample json config file.

Change-Id: I4e221b17c533c0957a325e24043a627b5acb6220
Signed-off-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7688
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>
2021-05-05 13:25:48 +00:00
Ben Walker
a922a2e24a lvol: Don't include bdev_module.h in the public header
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I8590bdedd8b1c3d0e417694f07f40deb3297ef24
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7728
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-05-04 21:07:42 +00:00
Ben Walker
63642befd3 Revert "nvmf: Support physical block size if exposed by bdev"
This reverts commit b32cfc467b.

This commit fails the ABI checks and only got through because the checks
were disabled until 21.04 hit.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Id26b8f8ba551193d99b1ccbd31b35378b4095a20
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7731
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-04 00:48:34 +00:00
Swapnil Ingle
b32cfc467b nvmf: Support physical block size if exposed by bdev
Today the in-guest nvme device shows physical_block_size=512 even though
the backend iSCSI bdev supports physical_block_size=4K

iSCSI targets exposes physical block size using
logical_block_per_physical_block_exponent in READ_CAPACITY_16

NPWG is one of the way to let Linux nvme driver set
physical_block_size of the nvme block device.

This patch adds spdk_bdev.phys_blocklen which is updated if the iSCSI
backend exposes physical_block_size.
Later phys_blocklen is used in nvmf to set NPWG and NAWUPF to report
back during NS identity.
Linux driver uses min(nawupf, npwg) to set physical_block_size.

Similarly in scsi_bdev fill lbppbe in READ_CAP16 response
based on spdk_bdev.phys_blocklen.

Fixes #1884

Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Change-Id: I0b6c81f1937e346d448f49c927eda8c79d2d75cf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7310
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-03 18:59:34 +00:00
Mao Jiang
eb76ccb04c test/nvme_tcp: cases for connecting sock and sending icreq
Change-Id: Iece99816ad67ac585b6285cbd43e415425b75239
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6821
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-30 09:49:44 +00:00
jwyka
cddfa0241a lib/nvme: allign cuse ctx data to 4k
We have seen that dptr was not alligned to 4k using cuse. Added allignment of data in cuse ctx to 4k same as it is done in nvme_allocate_request_user_copy
Signed-off-by: jwyka <jakub.wyka@intel.com>
Change-Id: Ic5c2482eae20d64ba467016eb61f5255467f70a9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7453
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI
2021-04-30 07:36:12 +00:00
Tomasz Zawadzki
469d8f32d0 so_ver: reenable test preventing increasing SO version
This check was disabled after 21.01 LTS to allow for
clear break of SO versions. Now that SPDK 21.04 is being
released, this test should be reenabled.

See following patch for details:
(e4070ee0)so_ver: increase all major versions

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I8a299a340338e7a2ab3439b81153818778b4c93a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7616
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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>
Reviewed-by: <dongx.yi@intel.com>
2021-04-30 07:06:12 +00:00
Liu Xiaodong
ac0c36d72a test: add functional test for reactor_set_intr
test script 'test/interrupt/reactor_set_intr.sh' will
do various reactor set intr operations on interrupt_tgt
without spdk_thread and with spdk_thread.

Change-Id: Ie5af1dc68b0272c34a91e8a66b78088c3794907c
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7348
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-29 07:10:26 +00:00
Tomasz Zawadzki
50935184c8 lib/blob: force execution of queued persists
When performing snapshot creation the I/O is frozen
during the process. The blob persists for extent page
allocation is delayed until snapshot creation is finished.

This results in multiple blob persists executing one after
the other, with only intent of writing out updated extent table
pointing to new extent pages.
Since blob->state is marked DIRTY before issuing each persist,
but a single persist completion marks state CLEAR.

Blob serialize correctly expects each persist to contain
dirtied metadata, in order to avoid unnecessary md writes.
Since all other instances of marking blob DIRTY is explicit,
assert in blob serialize is left as is.

Instead when running the queued up blob persists, the blob
state is marked DIRTY.

Side effect is that it will write out same md in some cases.

Fixes #1909

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I39f37299f3f0ebfccbdd4063781b5ecce286e993
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7640
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-29 07:10:13 +00:00
Nick Connolly
0fdd826a00 ut/nvme_ctrlr_cmd: add missing mutex init
Add missing mutex init for ctrlr ctrlr_lock.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Ib3d665a28e91a72d1f1f6d09c374583ff731fb6f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7613
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-29 07:10:05 +00:00
Jim Harris
5354d0c63f nvme: reset mapping_length correctly for contig SGL
spdk_vtophys() takes a mapping_length parameter, so
it can return the length for which the returned
virtual address is valid.

But spdk_vtophys() will only return the max
between the valid length and the input mapping_length
parameter.

So the nvme SGL building code for contiguous buffers
was broken, since it would only set the mapping_length
once, before the loop started.  Worst case, if a buffer
started just before (maybe 256 bytes) before a huge page
boundary, each time through the loop we would create
a new SGL for only 256 bytes at a time, very quickly
running out of SGL entries for a large buffer.

Fixes #1852.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7659
Community-CI: Mellanox Build Bot
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>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-29 07:09:43 +00:00
Jim Harris
6fd1cc3716 nvme: remove IDENTIFY_CNS quirk from normal QEMU SSDs
The IDENTIFY_CNS quirk was applied as part of QEMU
OCSSD handling in commit 6442451b.  But it was applied
not only to the OCSSD dev ID, but also the dev ID
for non-OCSSD NVMe controllers.

Starting with QEMU 5.2, QEMU will allocate a default
256 namespaces, but only some are active (associated
with the backing disks specified by the user).  QEMU
supports IDENTIFY_CNS, but since this quirk was set,
we wouldn't send a real IDENTIFY_CNS and instead
would just populate a fake list where all namespaces
were considered active.  This causes breakage in
a few places - mainly where we iterate through
the active namespaces, and then are surprised that
calling spdk_nvme_ns_is_active() returns false.

It was also breaking bdev_nvme_attach_controller RPC,
since by default we can only support returning 128
names, but since all of the namespaces were deemed
active, it was trying to return 256.

Fixes #1916.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7658
Community-CI: Mellanox Build Bot
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>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-29 07:09:43 +00:00
Mao Jiang
9ed384dab0 test/nvme_pcie: cases for building PRP and SGL request
Change-Id: I41c13f95b36308154dfa61ef8c6c54592ee7525d
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7143
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-27 08:38:12 +00:00
Karol Latecki
e1fe11875b autobuild: enable -Wno-stringop-overflow for DPDK builds only for GCC > 10
Use -Wno-stringop-overflow only for GCC > 10.
Change made to use the same condition as in
dpdkbuild/Makefile.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I6a396e250807f46720ff5dcaf21f13d802404a1b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7537
Community-CI: Mellanox Build Bot
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>
2021-04-27 08:37:12 +00:00
Karol Latecki
71b4e2a968 autobuild: build mainline DPDK with -Werror only for GCC > 5
DPDK now officially supports only GCC > 4.9.0.
Some older systems like Centos7  (gcc 4.8.5) can still
build DPDK, but sometimes fail due to -Werror enabled.
Disable this option to increase build success chance.

Fixes #1891

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I0950ad01e2d8361851e9ac42c556004980e00ff4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7536
Community-CI: Mellanox Build Bot
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>
2021-04-27 08:37:12 +00:00
Rui Chang
8af74b5ac7 test/setup: fix failure in allowed() when there is only one device
If there is only one device in ${devs[*]}, we see failure backtrace:
========== Backtrace start: ==========

in /home/jenkins/spdk_repo/spdk/test/setup/acl.sh:41 -> allowed([])
     ...
   36  	}
   37
   38  	allowed() {
   39  		PCI_ALLOWED="${devs[0]}" setup output config \
   40  			| grep "Skipping denied controller at " \
=> 41  			| grep -v "${devs[0]}"
   42  		verify "${devs[@]:1}"
   43  		setup reset
   44  	}
   45
   46  	setup reset

Signed-off-by: Rui Chang <rui.chang@arm.com>
Change-Id: I9aba6b19f6de6bea7149e0f39da8d5d8d6978a4e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7467
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-27 08:36:35 +00:00
Mao Jiang
a417658803 test/nvme_ns: cases for identifying id descriptor and find descriptor
Change-Id: I20d0a798423ee08f4a9e019aa62b93981586d134
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7161
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-27 08:35:27 +00:00
Tomasz Zawadzki
5f106e26c9 version: SPDK 21.07 pre
This is first commit that should go into latest SPDK
after the code freeze for SPDK 21.04.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I515772a0c90a362bd4a23a7717281a8d7a9e4393
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7615
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-27 08:29:12 +00:00
Alexey Marchuk
2fd97e28bf sock: Deprecate enable_zerocopy_send in sock_impl_set_options RPC
This deprecated parameter will be removed in SPDK 21.07

Change-Id: I2b2fbcc798bb50fa6f9dfe35045f66e41c1ceaa9
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7608
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-27 08:13:32 +00:00
Alexey Marchuk
8e85b675fc sock: Add new params to configure zcopy for server, client sockets
When zcero copy send is enabled and used by initiator,
it could significantly increase latency in some payloads.
To enable more fine graing configuration of zero copy
send feature, add new parameters enable_zerocopy_send_server
and enable_zerocopy_send_client to spdk_sock_impl_opts to
enable/disable zcopy for specific type of sockets.
Exisiting enable_zerocopy_send parameter affects all types
of sockets.

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I111c75608f8826980a56e210c076ab8ff16ddbdc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7457
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-27 08:13:32 +00:00
486 changed files with 26073 additions and 10452 deletions

View File

@ -1,6 +1,193 @@
# Changelog
## v21.04: (Upcoming Release)
## v21.07.1: (Upcoming Release)
## v21.07: Kernel DSA, Init lib, Userspace DTrace
### accel_fw
Added API `spdk_accel_submit_copy_crc32c` to perform a CRC32C while copying data.
Added API `spdk_accel_batch_prep_copy_crc32c` to batch CRC32C + copy commands.
Added API `spdk_accel_submit_copy_crc32cv` to submit chained CRC32C + copy commands.
### bdev
Change `spdk_bdev_read_blocks_with_md` arg offset definition from int64_t to uint64_t.
Red-black tree has been used to organize the bdev names and aliases uniformly
to provide faster lookup.
Removed ZCOPY emulation: The bdev module can be checked to see if it supports ZCOPY
and if not supported then use existing READ/WRITE commands.
Added iov to spdk_bdev_zcopy_start.
### dpdk
Updated DPDK submodule to DPDK 21.05.
### idxd
Remove the `probe_cb` parameter in `spdk_idxd_probe` function. And remove the definition
of `spdk_idxd_probe_cb` function pointer. It should be implemented in idxd_user.c.
Added API `spdk_idxd_submit_copy_crc32c` to perform a CRC32C while copying data.
Added API `spdk_idxd_batch_prep_copy_crc32c` to prepare a batch operation to perform
a CRC32C while copying data.
We have userspace idxd driver under accel_engine library (module/accel/idxd/accel_engine).
And kernel idxd driver usage is also added under the accel_engine library. This approach
implemented a wrapper library to use IDXD device by leveraging the kernel DSA driver in
SPDK idxd library (lib/idxd). Then users can leverage the RPC later to configure how to
use the DSA device by user space driver or kernel driver.
### init
Added new `init` library that initializes the SPDK subsystems, which previously was
internal to application framework. That functionality has been made public and for
use by applications which don't leverage SPDK's application framework.
### iscsi
New parameters, `pdu_pool_size`, `immediate_data_pool_size`, and `data_out_pool_size`,
were added to the RPC `iscsi_set_options` to run iSCSI target with varying amount of
available memory.
### json
Added API `spdk_json_write_named_uint128` and `spdk_json_write_uint128` to perform
the uint128 related data.
### net
Removed deprecated `net` library.
Added support for ZCOPY. ZCOPY is used in preference to READ and WRITE if the
bdev module supports ZCOPY and the bdev module has ZCOPY enabled.
### nvme
`spdk_nvme_map_prps` and `spdk_nvme_map_cmd` were moved to nvmf/vfio-user as internal APIs
as vfio-user is the only user for the above two APIs.
Added a new function `spdk_nvme_ns_cmd_copy` to submit a Simple Copy Command to a Namespace.
Update the `spdk_nvme_generic_command_status_code` structure with new status code
according to the definition in NVMe 1.4 spec.
`spdk_nvme_ctrlr_get_default_ctrlr_opts` now sets `use_cmb_sqs` to false. This means
that if a controller has a CMB and supports SQs in the CMB, SPDK will not use
the CMB for SQs by default - the user must set `use_cmb_sqs` to true in
the `spdk_nvme_ctrlr_opts` structure prior to controller attach.
Add a new function `spdk_nvme_detach_poll` to simplify a common use case to continue
polling until all detachments complete.
Added new argument `timeout_admin_us` to `spdk_nvme_ctrlr_register_timeout_callback` so callers
can specify a different timeout for admin commands vs. io commands.
An existing function `spdk_nvme_detach_async` was updated to add one or more detachments
to an active context while it is being polled.
Rename a variable in the member `cmic` of the struct `spdk_nvme_ctrlr_data` from
`multi_host` to `multi_ctrlr`. The variable means that the NVM subsystem may have two or
more controllers if set to 1. However `multi_host` had indicated a particular use case
such that the NVM subsystem is used by multiple hosts.
A new option `disable_read_ana_log_page` was added to struct `spdk_nvme_ctrlr_opts` to disable
reading ANA log page. The upper layer is expected to read ANA log page instead if `true`.
The default value is `false`.
New APIs, `spdk_nvme_ctrlr_reset_async` and `spdk_nvme_ctrlr_reset_poll_async`, have been added to
reset a controller asynchronously.
New RPC `bdev_nvme_reset_controller` was added, to reset an NVMe controller.
Added `spdk_nvme_ns_get_nguid` function to get NGUID for the given namespace.
Added `spdk_nvme_ctrlr_is_fabrics` function to indicate whether a ctrlr handle
is associated with a fabrics controller.
### nvmf
Added `min_cntlid` and `max_cntlid` to `nvmf_create_subsystem` to limit the controller ID range.
Added `spdk_nvmf_subsystem_get_min_cntlid` and `spdk_nvmf_subsystem_get_max_cntlid` to request those values.
`spdk_nvmf_request_get_buffers_multi` API is removed.
Added the `nvmf_set_crdt` RPC for setting command retry delay times.
Expanded `spdk_nvmf_poll_group_stat` with current qpair count statistics.
Removed following deprecated APIs:
- `spdk_nvmf_poll_group_get_stat` (function in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_get_stat` (function in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_free_stat`(function in `nvmf.h`),
- `spdk_nvmf_rdma_device_stat` (struct in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_stat` (struct in `nvmf.h`),
- `poll_group_get_stat` (transport op in `nvmf_transport.h`),
- `poll_group_free_stat` (transport op in `nvmf_transport.h`).
### rpc
New RPC `bdev_rbd_register_cluster` and `bdev_rbd_unregister_cluster` was added, it allows to create
and delete the rados object cluster, then users can choose the cluster to create related rbd
device.
Revised `bdev_rbd_create` parameter, it allows to use an optional parameter `--cluster-name`
to create a rbd bdev with an already registered Rados Cluster Object.
New RPC `bdev_rbd_get_clusters_info` was added, it allows to get the info of the registered
Rados Cluster names.
New optional parameter, `timeout_admin_us`, added to the bdev_nvme_set_options RPC.
Revised a parameter `--stripe-size_kb` to `--stripe-size-kb` of `bdev_raid_create` method
provided in `scripts/rpc.py` for consistency.
An new optional parameter `config_kernel_mode` was added to the RPC `idxd_scan_accel_engine`,
and this is used to enable using the kernel mode IDXD driver.
Removed deprecated parameter `enable-zerocopy-send` of RPC `sock_impl_set_options`,
use `enable-zerocopy-send-server` or `enable-zerocopy-send-client` instead.
Removed deprecated parameter `disable-zerocopy-send` of RPC `sock_impl_set_options`,
use `disable-zerocopy-send-server` or `disable-zerocopy-send-client` instead.
### rpm
Removed deprecated `pkg/spdk.spec`, please use `rpmbuild/spdk.spec` instead.
See [RPM documentation](https://spdk.io/doc/rpm.html) for more details.
### thread
Red-black tree has been used for timed pollers to provide faster insertion and deletion
and for io_devices to provide faster lookup.
Removed `spdk_io_channel` structure from public header and moved it to thread_internal.h.
### trace
Added `spdk_trace_register_description_ext` function to register variable number of tracepoint arguments.
Added ability to chain multiple trace entries together to extend the size of the argument buffer.
### util
Red-black tree macros has been added by using the macros provided by the FreeBSD operating system
under the same BSD license.
Add an new macro `SPDK_SIZEOF_MEMBER` to get the size of a member of a struct.
`spdk_crc32c_iov_update` function was added to support calculating the crc32c of the iovs.
Added zipf random number generator with power law probability distribution.
When applied to performance testing of block devices, it will select blocks over
the full range of LBAs, but will more frequently select lower-numbered LBAs.
## v21.04:
### accel
@ -161,6 +348,16 @@ For `bdev_raid_create` RPC, the deprecated parameter `strip_size` was removed.
New RPC `bdev_nvme_get_transport_statistics` was added, it allows to get transport statistics
of nvme poll groups.
Parameter `enable-zerocopy-send` of RPC `sock_impl_set_options` is deprecated and will be removed in SPDK 21.07,
use `enable-zerocopy-send-server` or `enable-zerocopy-send-client` instead.
Parameter `disable-zerocopy-send` of RPC `sock_impl_set_options` is deprecated and will be removed in SPDK 21.07,
use `disable-zerocopy-send-server` or `disable-zerocopy-send-client` instead.
Added cmd_parser.py used to parse the args from argparse. There are
two benefit to use command parser:
- Simplify the definition of rpc method. It will reduce the rpc method code.
- Make the rpc call more versatile. User can add private args into rpc method.
### rpm
Added support for new RPM spec, rpmbuild/spdk.spec, which can be used for packaging the
@ -179,6 +376,12 @@ sockets to be marked using the SO_MARK socket option as a hint for which hardwar
queue they should be associated with. This mode leverages that by setting the same
value for all sockets within a poll group.
New parameters `enable_zerocopy_send_server` and `enable_zerocopy_send_client` were added
to struct spdk_sock_impl_opts, these parameters enable or disable zero copy send for server
and client sockets which are created using `spdk_sock_listen` and `spdk_sock_listen_ext` (server);
`spdk_sock_connect` and `spdk_sock_connect_ext` (client) functions. Existing parameter
`enable_zerocopy_send` enables or disables zero copy send for both server and client sockets.
### thread
A new API `spdk_io_channel_get_io_device` was added to get the io_device for the specified

15
CONFIG
View File

@ -76,6 +76,9 @@ CONFIG_UNIT_TESTS=y
# Build examples
CONFIG_EXAMPLES=y
# Build apps
CONFIG_APPS=y
# Build with Control-flow Enforcement Technology (CET)
CONFIG_CET=n
@ -86,6 +89,10 @@ CONFIG_ENV=
# This directory should contain 'include' and 'lib' directories for your DPDK
# installation.
CONFIG_DPDK_DIR=
# Automatically set via pkg-config when bare --with-dpdk is set
CONFIG_DPDK_LIB_DIR=
CONFIG_DPDK_INC_DIR=
CONFIG_DPDK_PKG_CONFIG=n
# This directory should contain 'include' and 'lib' directories for WPDK.
CONFIG_WPDK_DIR=
@ -171,4 +178,12 @@ CONFIG_FUSE=n
CONFIG_RAID5=n
# Build with IDXD support
# In this mode, SPDK fully controls the DSA device.
CONFIG_IDXD=n
# Build with USDT support
CONFIG_USDT=n
# Build with IDXD kernel support.
# In this mode, SPDK shares the DSA device with the kernel.
CONFIG_IDXD_KERNEL=n

View File

@ -40,8 +40,9 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y += lib
DIRS-y += module
DIRS-$(CONFIG_SHARED) += shared_lib
DIRS-y += app include
DIRS-y += include
DIRS-$(CONFIG_EXAMPLES) += examples
DIRS-$(CONFIG_APPS) += app
DIRS-y += test
DIRS-$(CONFIG_IPSEC_MB) += ipsecbuild
DIRS-$(CONFIG_ISAL) += isalbuild
@ -57,11 +58,13 @@ export MAKE_PID := $(shell echo $$PPID)
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
ifeq ($(CURDIR)/dpdk/build,$(CONFIG_DPDK_DIR))
ifneq ($(SKIP_DPDK_BUILD),1)
ifneq ($(CONFIG_DPDK_PKG_CONFIG),y)
DPDKBUILD = dpdkbuild
DIRS-y += dpdkbuild
endif
endif
endif
endif
ifeq ($(OS),Windows)
ifeq ($(CURDIR)/wpdk/build,$(CONFIG_WPDK_DIR))

View File

@ -43,7 +43,7 @@ CFLAGS += -I$(SPDK_ROOT_DIR)/lib
C_SRCS := iscsi_tgt.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event_iscsi event_net
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event event_iscsi
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
SPDK_LIB_LIST += env_dpdk_rpc

View File

@ -37,7 +37,6 @@
#include "spdk/event.h"
#include "iscsi/iscsi.h"
#include "spdk/log.h"
#include "spdk/net.h"
static int g_daemon_mode = 0;

View File

@ -39,7 +39,7 @@ APP = nvmf_tgt
C_SRCS := nvmf_main.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event_nvmf
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event event_nvmf
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
SPDK_LIB_LIST += env_dpdk_rpc

View File

@ -39,6 +39,6 @@ APP = spdk_dd
C_SRCS := spdk_dd.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event_bdev
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event event_bdev
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -41,7 +41,7 @@ C_SRCS := spdk_tgt.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_iscsi event_nvmf
SPDK_LIB_LIST += event event_iscsi event_nvmf
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
SPDK_LIB_LIST += env_dpdk_rpc

View File

@ -39,6 +39,6 @@ APP = spdk_top
C_SRCS := spdk_top.c
SPDK_LIB_LIST = rpc
LIBS=-lncurses -lpanel -lmenu
LIBS=-lpanel -lmenu -lncurses
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,8 @@ include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
APP = spdk_trace
SPDK_NO_LINK_ENV = 1
SPDK_LIB_LIST += json
CXX_SRCS := trace.cpp
include $(SPDK_ROOT_DIR)/mk/spdk.app_cxx.mk

View File

@ -32,6 +32,11 @@
*/
#include "spdk/stdinc.h"
#include "spdk/env.h"
#include "spdk/json.h"
#include "spdk/likely.h"
#include "spdk/string.h"
#include "spdk/util.h"
#include <map>
@ -41,8 +46,29 @@ extern "C" {
}
static struct spdk_trace_histories *g_histories;
static struct spdk_json_write_ctx *g_json;
static bool g_print_tsc = false;
/* This is a bit ugly, but we don't want to include env_dpdk in the app, while spdk_util, which we
* do need, uses some of the functions implemented there. We're not actually using the functions
* that depend on those, so just define them as no-ops to allow the app to link.
*/
extern "C" {
void *
spdk_realloc(void *buf, size_t size, size_t align)
{
assert(false);
return NULL;
}
void
spdk_free(void *buf)
{
assert(false);
}
} /* extern "C" */
static void usage(void);
struct entry_key {
@ -79,10 +105,28 @@ struct object_stats {
object_stats() : start(), index(), size(), tpoint_id(), counter(0) {}
};
struct argument_context {
struct spdk_trace_entry *entry;
struct spdk_trace_entry_buffer *buffer;
uint16_t lcore;
size_t offset;
argument_context(struct spdk_trace_entry *entry,
uint16_t lcore) : entry(entry), lcore(lcore)
{
buffer = (struct spdk_trace_entry_buffer *)entry;
/* The first argument resides within the spdk_trace_entry structure, so the initial
* offset needs to be adjusted to the start of the spdk_trace_entry.args array
*/
offset = offsetof(struct spdk_trace_entry, args) -
offsetof(struct spdk_trace_entry_buffer, data);
}
};
struct object_stats g_stats[SPDK_TRACE_MAX_OBJECT];
static char *g_exe_name;
static int g_verbose = 1;
static uint64_t g_tsc_rate;
static uint64_t g_first_tsc = 0x0;
@ -93,10 +137,19 @@ get_us_from_tsc(uint64_t tsc, uint64_t tsc_rate)
return ((float)tsc) * 1000 * 1000 / tsc_rate;
}
static const char *
format_argname(const char *name)
{
static char namebuf[16];
snprintf(namebuf, sizeof(namebuf), "%s: ", name);
return namebuf;
}
static void
print_ptr(const char *arg_string, uint64_t arg)
{
printf("%-7.7s0x%-14jx ", arg_string, arg);
printf("%-7.7s0x%-14jx ", format_argname(arg_string), arg);
}
static void
@ -107,14 +160,13 @@ print_uint64(const char *arg_string, uint64_t arg)
* for FLUSH WRITEBUF when writev() returns -1 due to full
* socket buffer.
*/
printf("%-7.7s%-16jd ", arg_string, arg);
printf("%-7.7s%-16jd ", format_argname(arg_string), arg);
}
static void
print_string(const char *arg_string, uint64_t arg)
print_string(const char *arg_string, const char *arg)
{
char *str = (char *)&arg;
printf("%-7.7s%.8s ", arg_string, str);
printf("%-7.7s%-16.16s ", format_argname(arg_string), arg);
}
static void
@ -136,26 +188,106 @@ print_object_id(uint8_t type, uint64_t id)
static void
print_float(const char *arg_string, float arg)
{
printf("%-7s%-16.3f ", arg_string, arg);
printf("%-7s%-16.3f ", format_argname(arg_string), arg);
}
static struct spdk_trace_entry_buffer *
get_next_buffer(struct spdk_trace_entry_buffer *buf, uint16_t lcore)
{
struct spdk_trace_history *history;
history = spdk_get_per_lcore_history(g_histories, lcore);
assert(history);
if (spdk_unlikely((void *)buf == &history->entries[history->num_entries - 1])) {
return (struct spdk_trace_entry_buffer *)&history->entries[0];
} else {
return buf + 1;
}
}
static bool
build_arg(struct argument_context *argctx, const struct spdk_trace_argument *arg,
void *buf, size_t bufsize)
{
struct spdk_trace_entry *entry = argctx->entry;
struct spdk_trace_entry_buffer *buffer = argctx->buffer;
size_t curlen, argoff;
argoff = 0;
while (argoff < arg->size) {
if (argctx->offset == sizeof(buffer->data)) {
buffer = get_next_buffer(buffer, argctx->lcore);
if (spdk_unlikely(buffer->tpoint_id != SPDK_TRACE_MAX_TPOINT_ID ||
buffer->tsc != entry->tsc)) {
return false;
}
argctx->offset = 0;
argctx->buffer = buffer;
}
curlen = spdk_min(sizeof(buffer->data) - argctx->offset, arg->size - argoff);
if (argoff < bufsize) {
memcpy((uint8_t *)buf + argoff, &buffer->data[argctx->offset],
spdk_min(curlen, bufsize - argoff));
}
argctx->offset += curlen;
argoff += curlen;
}
return true;
}
static void
print_arg(uint8_t arg_type, const char *arg_string, uint64_t arg)
print_arg(struct argument_context *argctx, const struct spdk_trace_argument *arg)
{
if (arg_string[0] == 0) {
printf("%24s", "");
return;
}
uint64_t value = 0;
char strbuf[256];
switch (arg_type) {
switch (arg->type) {
case SPDK_TRACE_ARG_TYPE_PTR:
print_ptr(arg_string, arg);
if (build_arg(argctx, arg, &value, sizeof(value))) {
print_ptr(arg->name, value);
}
break;
case SPDK_TRACE_ARG_TYPE_INT:
print_uint64(arg_string, arg);
if (build_arg(argctx, arg, &value, sizeof(value))) {
print_uint64(arg->name, value);
}
break;
case SPDK_TRACE_ARG_TYPE_STR:
print_string(arg_string, arg);
assert((size_t)arg->size <= sizeof(strbuf));
if (build_arg(argctx, arg, strbuf, sizeof(strbuf))) {
print_string(arg->name, strbuf);
}
break;
}
}
static void
print_arg_json(struct argument_context *argctx, const struct spdk_trace_argument *arg)
{
uint64_t value = 0;
char strbuf[256];
switch (arg->type) {
case SPDK_TRACE_ARG_TYPE_PTR:
case SPDK_TRACE_ARG_TYPE_INT:
if (build_arg(argctx, arg, &value, sizeof(value))) {
spdk_json_write_uint64(g_json, value);
} else {
spdk_json_write_null(g_json);
}
break;
case SPDK_TRACE_ARG_TYPE_STR:
assert((size_t)arg->size <= sizeof(strbuf));
if (build_arg(argctx, arg, strbuf, sizeof(strbuf))) {
spdk_json_write_string(g_json, strbuf);
} else {
spdk_json_write_null(g_json);
}
break;
}
}
@ -167,17 +299,10 @@ print_event(struct spdk_trace_entry *e, uint64_t tsc_rate,
struct spdk_trace_tpoint *d;
struct object_stats *stats;
float us;
size_t i;
d = &g_histories->flags.tpoint[e->tpoint_id];
stats = &g_stats[d->object_type];
if (d->new_object) {
stats->index[e->object_id] = stats->counter++;
stats->tpoint_id[e->object_id] = e->tpoint_id;
stats->start[e->object_id] = e->tsc;
stats->size[e->object_id] = e->size;
}
us = get_us_from_tsc(e->tsc - tsc_offset, tsc_rate);
printf("%2d: %10.3f ", lcore, us);
@ -193,7 +318,6 @@ print_event(struct spdk_trace_entry *e, uint64_t tsc_rate,
printf("%-*s ", (int)sizeof(d->name), d->name);
print_size(e->size);
print_arg(d->arg1_type, d->arg1_name, e->arg1);
if (d->new_object) {
print_object_id(d->object_type, stats->index[e->object_id]);
} else if (d->object_type != OBJECT_NONE) {
@ -201,22 +325,100 @@ print_event(struct spdk_trace_entry *e, uint64_t tsc_rate,
us = get_us_from_tsc(e->tsc - stats->start[e->object_id],
tsc_rate);
print_object_id(d->object_type, stats->index[e->object_id]);
print_float("time:", us);
print_float("time", us);
} else {
printf("id: N/A");
}
} else if (e->object_id != 0) {
print_arg(SPDK_TRACE_ARG_TYPE_PTR, "object: ", e->object_id);
print_ptr("object", e->object_id);
}
struct argument_context argctx(e, lcore);
for (i = 0; i < d->num_args; ++i) {
print_arg(&argctx, &d->args[i]);
}
printf("\n");
}
static void
print_event_json(struct spdk_trace_entry *e, uint64_t tsc_rate,
uint64_t tsc_offset, uint16_t lcore)
{
struct spdk_trace_tpoint *d;
struct object_stats *stats;
size_t i;
d = &g_histories->flags.tpoint[e->tpoint_id];
stats = &g_stats[d->object_type];
spdk_json_write_object_begin(g_json);
spdk_json_write_named_uint64(g_json, "lcore", lcore);
spdk_json_write_named_uint64(g_json, "tpoint", e->tpoint_id);
spdk_json_write_named_uint64(g_json, "tsc", e->tsc);
if (g_histories->flags.owner[d->owner_type].id_prefix) {
spdk_json_write_named_string_fmt(g_json, "poller", "%c%02d",
g_histories->flags.owner[d->owner_type].id_prefix,
e->poller_id);
}
if (e->size != 0) {
spdk_json_write_named_uint32(g_json, "size", e->size);
}
if (d->new_object || d->object_type != OBJECT_NONE || e->object_id != 0) {
char object_type;
spdk_json_write_named_object_begin(g_json, "object");
if (d->new_object) {
object_type = g_histories->flags.object[d->object_type].id_prefix;
spdk_json_write_named_string_fmt(g_json, "id", "%c%" PRIu64, object_type,
stats->index[e->object_id]);
} else if (d->object_type != OBJECT_NONE) {
object_type = g_histories->flags.object[d->object_type].id_prefix;
if (stats->start.find(e->object_id) != stats->start.end()) {
spdk_json_write_named_string_fmt(g_json, "id", "%c%" PRIu64,
object_type,
stats->index[e->object_id]);
spdk_json_write_named_uint64(g_json, "time",
e->tsc - stats->start[e->object_id]);
}
}
spdk_json_write_named_uint64(g_json, "value", e->object_id);
spdk_json_write_object_end(g_json);
}
if (d->num_args > 0) {
struct argument_context argctx(e, lcore);
spdk_json_write_named_array_begin(g_json, "args");
for (i = 0; i < d->num_args; ++i) {
print_arg_json(&argctx, &d->args[i]);
}
spdk_json_write_array_end(g_json);
}
spdk_json_write_object_end(g_json);
}
static void
process_event(struct spdk_trace_entry *e, uint64_t tsc_rate,
uint64_t tsc_offset, uint16_t lcore)
{
if (g_verbose) {
struct spdk_trace_tpoint *d;
struct object_stats *stats;
d = &g_histories->flags.tpoint[e->tpoint_id];
stats = &g_stats[d->object_type];
if (d->new_object) {
stats->index[e->object_id] = stats->counter++;
stats->tpoint_id[e->object_id] = e->tpoint_id;
stats->start[e->object_id] = e->tsc;
stats->size[e->object_id] = e->size;
}
if (g_json == NULL) {
print_event(e, tsc_rate, tsc_offset, lcore);
} else {
print_event_json(e, tsc_rate, tsc_offset, lcore);
}
}
@ -263,7 +465,9 @@ populate_events(struct spdk_trace_history *history, int num_entries)
i = first;
while (1) {
g_entry_map[entry_key(lcore, e[i].tsc)] = &e[i];
if (e[i].tpoint_id != SPDK_TRACE_MAX_TPOINT_ID) {
g_entry_map[entry_key(lcore, e[i].tsc)] = &e[i];
}
if (i == last) {
break;
}
@ -276,11 +480,68 @@ populate_events(struct spdk_trace_history *history, int num_entries)
return (0);
}
static void
print_tpoint_definitions(void)
{
struct spdk_trace_tpoint *tpoint;
size_t i, j;
/* We only care about these when printing JSON */
if (!g_json) {
return;
}
spdk_json_write_named_uint64(g_json, "tsc_rate", g_tsc_rate);
spdk_json_write_named_array_begin(g_json, "tpoints");
for (i = 0; i < SPDK_COUNTOF(g_histories->flags.tpoint); ++i) {
tpoint = &g_histories->flags.tpoint[i];
if (tpoint->tpoint_id == 0) {
continue;
}
spdk_json_write_object_begin(g_json);
spdk_json_write_named_string(g_json, "name", tpoint->name);
spdk_json_write_named_uint32(g_json, "id", tpoint->tpoint_id);
spdk_json_write_named_bool(g_json, "new_object", tpoint->new_object);
spdk_json_write_named_array_begin(g_json, "args");
for (j = 0; j < tpoint->num_args; ++j) {
spdk_json_write_object_begin(g_json);
spdk_json_write_named_string(g_json, "name", tpoint->args[j].name);
spdk_json_write_named_uint32(g_json, "type", tpoint->args[j].type);
spdk_json_write_named_uint32(g_json, "size", tpoint->args[j].size);
spdk_json_write_object_end(g_json);
}
spdk_json_write_array_end(g_json);
spdk_json_write_object_end(g_json);
}
spdk_json_write_array_end(g_json);
}
static int
print_json(void *cb_ctx, const void *data, size_t size)
{
ssize_t rc;
while (size > 0) {
rc = write(STDOUT_FILENO, data, size);
if (rc < 0) {
fprintf(stderr, "%s: %s\n", g_exe_name, spdk_strerror(errno));
abort();
}
size -= rc;
}
return 0;
}
static void usage(void)
{
fprintf(stderr, "usage:\n");
fprintf(stderr, " %s <option> <lcore#>\n", g_exe_name);
fprintf(stderr, " option = '-q' to disable verbose mode\n");
fprintf(stderr, " '-c' to display single lcore history\n");
fprintf(stderr, " '-t' to display TSC offset for each event\n");
fprintf(stderr, " '-s' to specify spdk_trace shm name for a\n");
@ -291,6 +552,7 @@ static void usage(void)
fprintf(stderr, " -i or -p must be specified)\n");
fprintf(stderr, " '-f' to specify a tracepoint file name\n");
fprintf(stderr, " (-s and -f are mutually exclusive)\n");
fprintf(stderr, " '-j' to use JSON to format the output\n");
}
int main(int argc, char **argv)
@ -307,9 +569,10 @@ int main(int argc, char **argv)
int shm_id = -1, shm_pid = -1;
uint64_t trace_histories_size;
struct stat _stat;
bool json = false;
g_exe_name = argv[0];
while ((op = getopt(argc, argv, "c:f:i:p:qs:t")) != -1) {
while ((op = getopt(argc, argv, "c:f:i:jp:s:t")) != -1) {
switch (op) {
case 'c':
lcore = atoi(optarg);
@ -326,9 +589,6 @@ int main(int argc, char **argv)
case 'p':
shm_pid = atoi(optarg);
break;
case 'q':
g_verbose = 0;
break;
case 's':
app_name = optarg;
break;
@ -338,6 +598,9 @@ int main(int argc, char **argv)
case 't':
g_print_tsc = true;
break;
case 'j':
json = true;
break;
default:
usage();
exit(1);
@ -356,6 +619,14 @@ int main(int argc, char **argv)
exit(1);
}
if (json) {
g_json = spdk_json_write_begin(print_json, NULL, 0);
if (g_json == NULL) {
fprintf(stderr, "Failed to allocate JSON write context\n");
exit(1);
}
}
if (file_name) {
fd = open(file_name, O_RDONLY);
} else {
@ -402,7 +673,7 @@ int main(int argc, char **argv)
exit(-1);
}
if (g_verbose) {
if (!g_json) {
printf("TSC Rate: %ju\n", g_tsc_rate);
}
@ -430,7 +701,7 @@ int main(int argc, char **argv)
continue;
}
if (g_verbose && history->num_entries) {
if (!g_json && history->num_entries) {
printf("Trace Size of lcore (%d): %ju\n", i, history->num_entries);
}
@ -439,7 +710,7 @@ int main(int argc, char **argv)
} else {
history = spdk_get_per_lcore_history(g_histories, lcore);
if (history->num_entries > 0 && history->entries[0].tsc != 0) {
if (g_verbose && history->num_entries) {
if (!g_json && history->num_entries) {
printf("Trace Size of lcore (%d): %ju\n", lcore, history->num_entries);
}
@ -447,6 +718,12 @@ int main(int argc, char **argv)
}
}
if (g_json != NULL) {
spdk_json_write_object_begin(g_json);
print_tpoint_definitions();
spdk_json_write_named_array_begin(g_json, "entries");
}
tsc_offset = g_first_tsc;
for (entry_map::iterator it = g_entry_map.begin(); it != g_entry_map.end(); it++) {
if (it->first.tsc < g_first_tsc) {
@ -455,6 +732,12 @@ int main(int argc, char **argv)
process_event(it->second, g_tsc_rate, tsc_offset, it->first.lcore);
}
if (g_json != NULL) {
spdk_json_write_array_end(g_json);
spdk_json_write_object_end(g_json);
spdk_json_write_end(g_json);
}
munmap(history_ptr, trace_histories_size);
close(fd);

View File

@ -39,7 +39,7 @@ APP = vhost
C_SRCS := vhost.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event_vhost event_nbd
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event event_vhost event_nbd
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
SPDK_LIB_LIST += env_dpdk_rpc

View File

@ -14,6 +14,10 @@ source "$1"
source "$rootdir/test/common/autotest_common.sh"
source "$rootdir/scripts/common.sh"
if [[ -n $EXTERNAL_MAKE_HUGEMEM ]]; then
export EXTERNAL_MAKE_HUGEMEM
fi
out=$output_dir
if [ -n "$SPDK_TEST_NATIVE_DPDK" ]; then
scanbuild_exclude=" --exclude $(dirname $SPDK_RUN_EXTERNAL_DPDK)"
@ -51,7 +55,10 @@ function ocf_precompile() {
function build_native_dpdk() {
local external_dpdk_dir
local external_dpdk_base_dir
local gcc_version
gcc_version=$(gcc -dumpversion)
gcc_version=${gcc_version//./}
external_dpdk_dir="$SPDK_RUN_EXTERNAL_DPDK"
external_dpdk_base_dir="$(dirname $external_dpdk_dir)"
@ -65,9 +72,17 @@ function build_native_dpdk() {
git clone --branch $SPDK_TEST_NATIVE_DPDK --depth 1 http://dpdk.org/git/dpdk "$external_dpdk_base_dir"
git -C "$external_dpdk_base_dir" log --oneline -n 5
dpdk_cflags="-fPIC -g -Werror -fcommon"
dpdk_cflags="-fPIC -g -fcommon"
dpdk_ldflags=""
if [[ $gcc_version -ge 5 ]]; then
dpdk_cflags+=" -Werror"
fi
if [[ $gcc_version -ge 10 ]]; then
dpdk_cflags+=" -Wno-stringop-overflow"
fi
# the drivers we use
# net/i40e driver is not really needed by us, but it's built as a workaround
# for DPDK issue: https://bugs.dpdk.org/show_bug.cgi?id=576
@ -113,7 +128,6 @@ function build_native_dpdk() {
cd $external_dpdk_base_dir
if [ "$(uname -s)" = "Linux" ]; then
dpdk_cflags+=" -Wno-stringop-overflow"
# Fix for freeing device if not kernel driver configured.
# TODO: Remove once this is merged in upstream DPDK
if grep "20.08.0" $external_dpdk_base_dir/VERSION; then
@ -122,13 +136,17 @@ function build_native_dpdk() {
elif grep "20.11\|21.02" $external_dpdk_base_dir/VERSION; then
wget https://github.com/karlatec/dpdk/commit/3219c0cfc38803aec10c809dde16e013b370bda9.patch -O dpdk-pci.patch
wget https://github.com/karlatec/dpdk/commit/adf8f7638de29bc4bf9ba3faf12bbdae73acda0c.patch -O dpdk-qat.patch
elif grep "21.05" $external_dpdk_base_dir/VERSION; then
wget https://github.com/karlatec/dpdk/commit/f95e331be3a1f856b816948990dd2afc67ea4020.patch -O dpdk-pci.patch
wget https://github.com/karlatec/dpdk/commit/6fd2fa906ffdcee04e6ce5da40e61cb841be9827.patch -O dpdk-qat.patch
else
wget https://github.com/karlatec/dpdk/commit/eac05db0580091ef8e4d338aa5d2210695521894.patch -O dpdk-pci.patch
wget https://github.com/karlatec/dpdk/commit/d649d5efb7bb404ce59dea81768adeb994b284f7.patch -O dpdk-qat.patch
wget https://github.com/karlatec/dpdk/commit/6fd2fa906ffdcee04e6ce5da40e61cb841be9827.patch -O dpdk-qat.patch
fi
git config --local user.name "spdk"
git config --local user.email "nomail@all.com"
git am dpdk-pci.patch
if [[ -f dpdk-pci.patch ]]; then
git am dpdk-pci.patch
fi
git am dpdk-qat.patch
fi
@ -158,6 +176,7 @@ function make_fail_cleanup() {
function scanbuild_make() {
pass=true
"$rootdir/configure" $config_params --without-shared
$scanbuild $MAKE $MAKEFLAGS > $out/build_output.txt && rm -rf $out/scan-build-tmp || make_fail_cleanup
xtrace_disable
@ -255,12 +274,9 @@ function build_doc() {
function autobuild_test_suite() {
run_test "autobuild_check_format" ./scripts/check_format.sh
run_test "autobuild_external_code" sudo -E --preserve-env=PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH $rootdir/test/external_code/test_make.sh $rootdir
if [ "$SPDK_TEST_OCF" -eq 1 ]; then
run_test "autobuild_ocf_precompile" ocf_precompile
fi
run_test "autobuild_check_so_deps" $rootdir/test/make/check_so_deps.sh $1
./configure $config_params --without-shared
run_test "scanbuild_make" scanbuild_make
$MAKE $MAKEFLAGS
run_test "autobuild_generated_files_check" porcelain_check
run_test "autobuild_header_dependency_check" header_dependency_check
run_test "autobuild_make_install" $MAKE $MAKEFLAGS install DESTDIR="$SPDK_WORKSPACE" prefix=/usr
@ -268,6 +284,11 @@ function autobuild_test_suite() {
run_test "autobuild_build_doc" build_doc
}
function unittest_build() {
"$rootdir/configure" $config_params --without-shared
$MAKE $MAKEFLAGS
}
if [ $SPDK_RUN_VALGRIND -eq 1 ]; then
run_test "valgrind" echo "using valgrind"
fi
@ -291,12 +312,17 @@ $MAKE cc_version
$MAKE cxx_version
echo "** END ** Info for Hostname: $HOSTNAME"
if [ "$SPDK_TEST_AUTOBUILD" -eq 1 ]; then
if [[ $SPDK_TEST_OCF -eq 1 ]]; then
run_test "autobuild_ocf_precompile" ocf_precompile
fi
if [[ $SPDK_TEST_AUTOBUILD -eq 1 ]]; then
run_test "autobuild" autobuild_test_suite $1
elif [[ $SPDK_TEST_UNITTEST -eq 1 ]]; then
run_test "unittest_build" unittest_build
elif [[ $SPDK_TEST_SCANBUILD -eq 1 ]]; then
run_test "scanbuild_make" scanbuild_make
else
if [ "$SPDK_TEST_OCF" -eq 1 ]; then
run_test "autobuild_ocf_precompile" ocf_precompile
fi
# if we aren't testing the unittests, build with shared objects.
./configure $config_params --with-shared
run_test "make" $MAKE $MAKEFLAGS

View File

@ -11,6 +11,7 @@ fi
source "$1"
rootdir=$(readlink -f $(dirname $0))
testdir=$rootdir # to get the storage space for tests
source "$rootdir/test/common/autotest_common.sh"
function build_rpms() (
@ -20,7 +21,7 @@ function build_rpms() (
unset -v LD_LIBRARY_PATH
install_uninstall_rpms() {
rpms=("$HOME/rpmbuild/RPMS/x86_64/"spdk{,-devel,{,-dpdk}-libs}-$version-1.x86_64.rpm)
rpms=("$builddir/rpm/x86_64/"spdk{,-devel,{,-dpdk}-libs}-$version-1.x86_64.rpm)
sudo rpm -i "${rpms[@]}"
rpms=("${rpms[@]##*/}") rpms=("${rpms[@]%.rpm}")
@ -31,11 +32,12 @@ function build_rpms() (
}
build_rpm() {
MAKEFLAGS="$MAKEFLAGS" SPDK_VERSION="$version" DEPS=no "$rootdir/rpmbuild/rpm.sh" "$@"
BUILDDIR=$builddir MAKEFLAGS="$MAKEFLAGS" SPDK_VERSION="$version" DEPS=no "$rootdir/rpmbuild/rpm.sh" "$@"
install_uninstall_rpms
}
version="test_shared"
builddir=$SPDK_TEST_STORAGE/test-rpm
run_test "build_shared_rpm" build_rpm --with-shared
if [[ -n $SPDK_TEST_NATIVE_DPDK ]]; then

View File

@ -12,11 +12,14 @@ if [[ ! -f $conf ]]; then
echo "ERROR: $conf doesn't exist"
exit 1
fi
source "$conf"
echo "Test configuration:"
cat "$conf"
# Runs agent scripts
$rootdir/autobuild.sh "$conf"
sudo -E $rootdir/autotest.sh "$conf"
if ((SPDK_TEST_UNITTEST == 1 || SPDK_RUN_FUNCTIONAL_TEST == 1)); then
sudo -E $rootdir/autotest.sh "$conf"
fi
$rootdir/autopackage.sh "$conf"

View File

@ -35,11 +35,6 @@ if [ $(uname -s) = Linux ]; then
echo "|$rootdir/scripts/core-collector.sh %P %s %t $output_dir/coredumps" > /proc/sys/kernel/core_pattern
echo 2 > /proc/sys/kernel/core_pipe_limit
# Make sure that the hugepage state for our VM is fresh so we don't fail
# hugepage allocation. Allow time for this action to complete.
echo 1 > /proc/sys/vm/drop_caches
sleep 3
# make sure nbd (network block device) driver is loaded if it is available
# this ensures that when tests need to use nbd, it will be fully initialized
modprobe nbd || true
@ -50,7 +45,7 @@ if [ $(uname -s) = Linux ]; then
fi
fi
trap "process_core; autotest_cleanup; exit 1" SIGINT SIGTERM EXIT
trap "process_core || :; autotest_cleanup; exit 1" SIGINT SIGTERM EXIT
timing_enter autotest
@ -152,11 +147,6 @@ timing_enter afterboot
timing_exit afterboot
if [[ $SPDK_TEST_CRYPTO -eq 1 || $SPDK_TEST_REDUCE -eq 1 ]]; then
# Make sure that memory is distributed across all NUMA nodes - by default, all goes to
# node0, but if QAT devices are attached to a different node, all of their VFs will end
# up under that node too and memory needs to be available there for the tests.
CLEAR_HUGE=yes HUGE_EVEN_ALLOC=yes ./scripts/setup.sh
./scripts/setup.sh status
if [[ $SPDK_TEST_USE_IGB_UIO -eq 1 ]]; then
./scripts/qat_setup.sh igb_uio
else
@ -194,7 +184,20 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
run_test "bdev_raid" test/bdev/bdev_raid.sh
run_test "bdevperf_config" test/bdev/bdevperf/test_config.sh
if [[ $(uname -s) == Linux ]]; then
run_test "spdk_dd" test/dd/dd.sh
run_test "reactor_set_interrupt" test/interrupt/reactor_set_interrupt.sh
fi
fi
if [[ $(uname -s) == Linux ]]; then
if [[ $SPDK_TEST_BLOCKDEV -eq 1 || $SPDK_TEST_URING -eq 1 ]]; then
# The crypto job also includes the SPDK_TEST_BLOCKDEV in its configuration hence the
# dd tests are executed there as well. However, these tests can take a significant
# amount of time to complete (up to 4min) on a physical system leading to a potential
# job timeout. Avoid that by skipping these tests - this should not affect the coverage
# since dd tests are still run as part of the vg jobs.
if [[ $SPDK_TEST_CRYPTO -eq 0 ]]; then
run_test "spdk_dd" test/dd/dd.sh
fi
fi
fi
@ -209,9 +212,15 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
if [[ $SPDK_TEST_NVME_PMR -eq 1 ]]; then
run_test "nvme_pmr" test/nvme/nvme_pmr.sh
fi
if [[ $SPDK_TEST_NVME_SCC -eq 1 ]]; then
run_test "nvme_scc" test/nvme/nvme_scc.sh
fi
if [[ $SPDK_TEST_NVME_CUSE -eq 1 ]]; then
run_test "nvme_cuse" test/nvme/cuse/nvme_cuse.sh
fi
if [[ $SPDK_TEST_NVME_CMB -eq 1 ]]; then
run_test "nvme_cmb" test/nvme/cmb/cmb.sh
fi
run_test "nvme_rpc" test/nvme/nvme_rpc.sh
# Only test hotplug without ASAN enabled. Since if it is
# enabled, it catches SEGV earlier than our handler which

65
configure vendored
View File

@ -35,6 +35,7 @@ function usage() {
echo " --disable-tests Disable building of functional tests"
echo " --disable-unit-tests Disable building of unit tests"
echo " --disable-examples Disable building of examples"
echo " --disable-apps Disable building of apps"
echo ""
echo "Specifying Dependencies:"
echo "--with-DEPENDENCY[=path] Use the given dependency. Optionally, provide the"
@ -98,6 +99,8 @@ function usage() {
echo " No path required."
echo " wpdk Build using WPDK to provide support for Windows (experimental)."
echo " The argument must be a directory containing lib and include."
echo " usdt Build with userspace DTrace probes enabled."
echo " No path required."
echo ""
echo "Environment variables:"
echo ""
@ -163,7 +166,7 @@ fi
#check nasm only on x86
if [[ $arch == x86_64* ]]; then
ver=$(nasm -v 2> /dev/null | awk '{print $3}')
ver=$(nasm -v 2> /dev/null | awk '{print $3}' | awk -Fr '{print $1}')
if lt "$ver" 2.14; then
# ISA-L, compression & crypto require NASM version 2.14 or newer.
CONFIG[ISAL]=n
@ -263,6 +266,12 @@ for i in "$@"; do
--disable-examples)
CONFIG[EXAMPLES]=n
;;
--enable-apps)
CONFIG[APPS]=y
;;
--disable-apps)
CONFIG[APPS]=N
;;
--enable-werror)
CONFIG[WERROR]=y
;;
@ -275,6 +284,17 @@ for i in "$@"; do
--disable-cet)
CONFIG[CET]=n
;;
--with-dpdk)
if pkg-config --exists libdpdk; then
CONFIG[DPDK_LIB_DIR]=$(pkg-config --variable=libdir libdpdk)
CONFIG[DPDK_INC_DIR]=$(pkg-config --variable=includedir libdpdk)
CONFIG[DPDK_PKG_CONFIG]=y
CFLAGS="${CFLAGS:+$CFLAGS }$(pkg-config --cflags libdpdk)"
else
echo "libdpdk.pc not found, aborting"
exit 1
fi
;;
--with-dpdk=*)
check_dir "$i"
CONFIG[DPDK_DIR]=$(readlink -f ${i#*=})
@ -448,10 +468,17 @@ for i in "$@"; do
;;
--with-idxd)
CONFIG[IDXD]=y
CONFIG[IDXD_KERNEL]=n
;;
--without-idxd)
CONFIG[IDXD]=n
;;
--with-usdt)
CONFIG[USDT]=y
;;
--without-usdt)
CONFIG[USDT]=n
;;
--)
break
;;
@ -472,7 +499,7 @@ BUILD_CMD+=(-I/usr/local/include -L/usr/local/lib)
if [[ "${CONFIG[VFIO_USER]}" = "y" ]]; then
if ! hash cmake; then
if ! bash -c "command -v cmake3 cmake" > /dev/null; then
echo "ERROR: --with-vfio-user requires cmake"
echo "Please install then re-run this script"
exit 1
@ -502,6 +529,10 @@ if [[ "${CONFIG[IDXD]}" = "y" ]]; then
echo "ERROR: IDXD cannot be used due to CPU incompatiblity."
exit 1
fi
if [ -e /usr/include/accel-config/libaccel_config.h ]; then
CONFIG[IDXD_KERNEL]=y
fi
fi
# Detect architecture and force no ISA-L if non-x86 or non-aarch64 architecture
@ -520,7 +551,7 @@ fi
if [ -z "${CONFIG[ENV]}" ]; then
CONFIG[ENV]=$rootdir/lib/env_dpdk
echo "Using default SPDK env in ${CONFIG[ENV]}"
if [ -z "${CONFIG[DPDK_DIR]}" ]; then
if [[ -z "${CONFIG[DPDK_DIR]}" && "${CONFIG[DPDK_PKG_CONFIG]}" == n ]]; then
if [ ! -f "$rootdir"/dpdk/config/meson.build ]; then
echo "DPDK not found; please specify --with-dpdk=<path> or run:"
echo
@ -532,7 +563,7 @@ if [ -z "${CONFIG[ENV]}" ]; then
fi
fi
else
if [ -n "${CONFIG[DPDK_DIR]}" ]; then
if [[ -n "${CONFIG[DPDK_DIR]}" || "${CONFIG[DPDK_PKG_CONFIG]}" == y ]]; then
echo "--with-env and --with-dpdk are mutually exclusive."
exit 1
fi
@ -549,6 +580,14 @@ else
CONFIG[VIRTIO]="n"
fi
if [[ "${CONFIG[DPDK_PKG_CONFIG]}" == y ]]; then
if [[ "${CONFIG[SHARED]}" == n ]]; then
# dpdk-devel doesn't provide static libs
echo "Build against packaged DPDK requested, enabling shared libraries"
CONFIG[SHARED]=y
fi
fi
if [[ $sys_name == "Windows" ]]; then
if [ -z "${CONFIG[WPDK_DIR]}" ]; then
if [ ! -f "$rootdir"/wpdk/Makefile ]; then
@ -830,6 +869,20 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then
cd $rootdir
fi
# For ARM Neoverse-N1 platform, debug build needs gcc version newer than 8.4
if [[ "${CONFIG[DEBUG]}" = "y" && $arch = aarch64* && "$CC_TYPE" = "gcc" ]]; then
GCC_VERSION=$($CC -dumpfullversion)
PART_NUM=$(grep -i -m 1 "CPU part" /proc/cpuinfo | awk '{print $4}')
if [[ "$(printf '%s\n' "8.4.0" "$GCC_VERSION" | sort -V | head -n1)" != "8.4.0" ]]; then
if [[ $PART_NUM = 0xd0c ]]; then
echo "WARNING: For ARM Neoverse-N1 platform, debug build needs GCC version newer than 8.4."
echo " Will work around this by using armv8.2-a+crypto as target architecture for now."
CONFIG[ARCH]=armv8.2-a+crypto
fi
fi
fi
# We are now ready to generate final configuration. But first do sanity
# check to see if all keys in CONFIG array have its reflection in CONFIG file.
if (($(grep -cE "^\s*CONFIG_[[:alnum:]_]+=" "$rootdir/CONFIG") != ${#CONFIG[@]})); then
@ -837,7 +890,7 @@ if (($(grep -cE "^\s*CONFIG_[[:alnum:]_]+=" "$rootdir/CONFIG") != ${#CONFIG[@]})
echo "BUG: Some configuration options are not present in CONFIG file. Please update this file."
echo "Missing options in CONFIG (+) file and in current config (-): "
diff -u --label "CONFIG file" --label "CONFIG[@]" \
<(sed -r -e '/^\s*$/d; /^\s*#.*/d; s/(CONFIG_[[:alnum:]_]+)=.*/\1/g' CONFIG | sort) \
<(sed -r -e '/^[[:space:]]*$/d; /^[[:space:]]*#.*/d; s/(CONFIG_[[:alnum:]_]+)=.*/\1/g' CONFIG | sort) \
<(printf "CONFIG_%s\n" "${!CONFIG[@]}" | sort)
exit 1
fi
@ -845,7 +898,7 @@ fi
echo -n "Creating mk/config.mk..."
cp -f $rootdir/CONFIG $rootdir/mk/config.mk
for key in "${!CONFIG[@]}"; do
sed -i.bak -r "s#^\s*CONFIG_${key}=.*#CONFIG_${key}\?=${CONFIG[$key]}#g" $rootdir/mk/config.mk
sed -i.bak -r "s#[[:space:]]*CONFIG_${key}=.*#CONFIG_${key}\?=${CONFIG[$key]}#g" $rootdir/mk/config.mk
done
# On FreeBSD sed -i 'SUFFIX' - SUFFIX is mandatory. So no way but to delete the backed file.
rm -f $rootdir/mk/config.mk.bak

View File

@ -11,25 +11,3 @@ Specific future SPDK release for the removal must be provided.
ABI cannot be removed without providing deprecation notice for at least single SPDK release.
# Deprecation Notices {#deprecation-notices}
## net
The net library is deprecated and will be removed in the 21.07 release.
## nvmf
The following APIs have been deprecated and will be removed in SPDK 21.07:
- `spdk_nvmf_poll_group_get_stat` (function in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_get_stat` (function in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_free_stat`(function in `nvmf.h`),
- `spdk_nvmf_rdma_device_stat` (struct in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_stat` (struct in `nvmf.h`),
- `poll_group_get_stat` (transport op in `nvmf_transport.h`),
- `poll_group_free_stat` (transport op in `nvmf_transport.h`).
Please use `spdk_nvmf_poll_group_dump_stat` and `poll_group_dump_stat` instead.
## rpm
`pkg/spdk.spec` is considered to be deprecated and scheduled for removal in SPDK 21.07.
Please use `rpmbuild/spdk.spec` instead and see
[RPM documentation](https://spdk.io/doc/rpm.html) for more details.

View File

@ -843,6 +843,7 @@ INPUT += \
spdk_top.md \
ssd_internals.md \
system_configuration.md \
usdt.md \
userspace.md \
vagrant.md \
vhost.md \

View File

@ -73,3 +73,11 @@ spdk_app_start() is called, it will block the current thread until the applicati
terminates by calling spdk_app_stop() or an error condition occurs during the
initialization code within spdk_app_start(), itself, before invoking the caller's
supplied function.
## Custom shutdown callback {#event_component_shutdown}
When creating SPDK based application user may add custom shutdown callback which
will be called before the application framework starts the shutdown process.
To do that set shutdown_cb function callback in spdk_app_opts structure passed
to spdk_app_start(). Custom shutdown callback should call spdk_app_stop() before
returning to continue application shutdown process.

View File

@ -405,9 +405,6 @@ Example response:
"framework_start_init",
"rpc_get_methods",
"scsi_get_devices",
"net_get_interfaces",
"delete_ip_address",
"net_interface_add_ip_address",
"nbd_get_disks",
"nbd_stop_disk",
"nbd_start_disk",
@ -460,6 +457,7 @@ Example response:
"bdev_passthru_delete"
"bdev_nvme_apply_firmware",
"bdev_nvme_get_transport_statistics",
"bdev_nvme_get_controller_health_info",
"bdev_nvme_detach_controller",
"bdev_nvme_attach_controller",
"bdev_null_create",
@ -1410,6 +1408,7 @@ This feature is considered as experimental.
Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
config_number | Required | number | Pre-defined config # to use (ie 0, 1). See [docs.](https://spdk.io/doc/idxd.html)
config_kernel_mode | Optional | Boolean | If set, will use kernel idxd driver.
### Example
@ -1418,7 +1417,8 @@ Example request:
~~~
{
"params": {
"config_number": 0
"config_number": 0,
"config_kernel_mode": false
},
"jsonrpc": "2.0",
"method": "idxd_scan_accel_engine",
@ -2107,6 +2107,7 @@ Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
name | Required | string | Bdev name to use
mode | Required | string | OCF cache mode: wb, wt, pt, wa, wi, wo
cache_line_size | Optional | int | OCF cache line size in KiB: 4, 8, 16, 32, 64
cache_bdev_name | Required | string | Name of underlying cache bdev
core_bdev_name | Required | string | Name of underlying core bdev
@ -2123,7 +2124,8 @@ Example request:
"params": {
"name": "ocf0",
"mode": "wt",
"cache_bdev_name": "Nvme0n1"
"cache_line_size": 64,
"cache_bdev_name": "Nvme0n1",
"core_bdev_name": "aio0"
},
"jsonrpc": "2.0",
@ -2762,6 +2764,7 @@ Name | Optional | Type | Description
-------------------------- | -------- | ----------- | -----------
action_on_timeout | Optional | string | Action to take on command time out: none, reset or abort
timeout_us | Optional | number | Timeout for each command, in microseconds. If 0, don't track timeouts
timeout_admin_us | Optional | number | Timeout for each admin command, in microseconds. If 0, treat same as io timeouts ('timeout_us')
keep_alive_timeout_ms | Optional | number | Keep alive timeout period in milliseconds, default is 10s
retry_count | Optional | number | The number of attempts per I/O before an I/O fails
arbitration_burst | Optional | number | The value is expressed as a power of two, a value of 111b indicates no limit
@ -2788,6 +2791,7 @@ request:
"high_priority_weight": 8,
"nvme_adminq_poll_period_us": 2000,
"timeout_us": 10000000,
"timeout_admin_us": 20000000,
"keep_alive_timeout_ms": 600000,
"action_on_timeout": "reset",
"io_queue_requests" : 2048,
@ -3003,6 +3007,43 @@ Example response:
}
~~~
## bdev_nvme_reset_controller {#rpc_bdev_nvme_reset_controller}
Reset NVMe controller.
Returns true if the controller reset was successful, false otherwise.
### Parameters
Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
name | Required | string | NVMe controller name
### Example
Example request:
~~~
{
"jsonrpc": "2.0",
"id": 1,
"method": "bdev_nvme_reset_controller",
"params": {
"name": "Nvme0"
}
}
~~~
Example response:
~~~
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
~~~
## bdev_nvme_cuse_register {#rpc_bdev_nvme_cuse_register}
Register CUSE device on NVMe controller.
@ -3301,6 +3342,203 @@ Example response:
}
~~~
## bdev_nvme_get_controller_health_info {#rpc_bdev_nvme_get_controller_health_info}
Display health log of the required NVMe bdev device.
### Parameters
Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
name | Required | string | Name of the NVMe bdev controller
### Response
The response is the object containing information about health log of the NVMe controller.
### Example
Example request:
~~~
{
"jsonrpc": "2.0",
"method": "bdev_nvme_get_controller_health_info",
"id": 1,
"params": {
"name": "Nvme0"
}
}
~~~
Example response:
~~~
{
"model_number": "INTEL SSDPE2KX020T8",
"serial_number": "BTLJ72430ARH2P0BGN",
"firmware_revision": "VDV10110",
"traddr": "0000:08:00.0",
"temperature_celsius": 32,
"available_spare_percentage": 99,
"available_spare_threshold_percentage": 10,
"percentage_used": 2,
"data_units_read": 1013408619,
"data_units_written": 346792685,
"host_read_commands": 30457773282,
"host_write_commands": 18949677715,
"controller_busy_time": 4979,
"power_cycles": 49,
"power_on_hours": 31118,
"unsafe_shutdowns": 18,
"media_errors": 17,
"num_err_log_entries": 19,
"warning_temperature_time_minutes": 0,
"critical_composite_temperature_time_minutes": 0
}
~~~
## bdev_rbd_register_cluster {#rpc_bdev_rbd_register_cluster}
This method is available only if SPDK was build with Ceph RBD support.
### Parameters
Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
name | Required | string | Registerd Rados cluster object name
user_id | Optional | string | Ceph ID (i.e. admin, not client.admin)
config_param | Optional | string map | Explicit librados configuration
config_file | Optional | string | File path of libraodos configuration file
This RPC registers a Rados Cluster object handle which is only known
to rbd module, it uses user_id + config_param or user_id + config_file to
identify a Rados cluster object.
If no config_param is specified, Ceph configuration files must exist with
all relevant settings for accessing the Ceph cluster. If a config map is
passed, the configuration files are ignored and instead all key/value
pairs are passed to rados_conf_set to configure cluster access. In
practice, "mon_host" (= list of monitor address+port) and "key" (= the
secret key stored in Ceph keyrings) are enough.
When accessing the Ceph cluster as some user other than "admin" (the
default), the "user_id" has to be set.
### Result
Name of newly created Rados cluster object.
### Example
Example request with `key` from `/etc/ceph/ceph.client.admin.keyring`:
~~
{
"params": {
"name": "rbd_cluster",
"config_param": {
"mon_host": "192.168.7.1:6789,192.168.7.2:6789",
"key": "AQDwf8db7zR1GRAA5k7NKXjS5S5V4mntwUDnGQ==",
}
},
"jsonrpc": "2.0",
"method": "bdev_rbd_register_cluster",
"id": 1
}
~~
Example response:
~~
response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "rbd_cluster"
}
~~
## bdev_rbd_unregister_cluster {#rpc_bdev_rbd_unregister_cluster}
This method is available only if SPDK was build with Ceph RBD support.
If there is still rbd bdev using this cluster, the unregisteration operation
will fail.
### Result
`true` if Rados cluster object with provided name was deleted or `false` otherwise.
### Parameters
Name | Optional | Type | Description
----------------------- | -------- | ----------- | -------------------------
name | Required | string | Rados cluster object name
### Example
Example request:
~~
{
"params": {
"name": "rbd_cluster"
},
"jsonrpc": "2.0",
"method": "bdev_rbd_unregister_cluster",
"id": 1
}
~~
Example response:
~~
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
~~
## bdev_rbd_get_clusters_info {#rpc_bdev_rbd_get_clusters_info}
This method is available only if SPDK was build with Ceph RBD support.
### Result
Returns the cluster info of the Rados Cluster name if provided. Otherwise, it
returns the cluster info of every registered Raods Cluster name.
### Parameters
Name | Optional | Type | Description
----------------------- | -------- | ----------- | -------------------------
name | Optional | string | Rados cluster object name
### Example
Example request:
~~
{
"params": {
"name": "rbd_cluster"
},
"jsonrpc": "2.0",
"method": "bdev_rbd_get_clusters_info",
"id": 1
}
~~
Example response:
~~
{
"jsonrpc": "2.0",
"cluster_name": "rbd_cluster"
}
~~
## bdev_rbd_create {#rpc_bdev_rbd_create}
Create @ref bdev_config_rbd bdev
@ -3317,6 +3555,7 @@ pool_name | Required | string | Pool name
rbd_name | Required | string | Image name
block_size | Required | number | Block size
config | Optional | string map | Explicit librados configuration
cluster_name | Optional | string | Rados cluster object name created in this module.
If no config is specified, Ceph configuration files must exist with
all relevant settings for accessing the pool. If a config map is
@ -3328,6 +3567,10 @@ secret key stored in Ceph keyrings) are enough.
When accessing the image as some user other than "admin" (the
default), the "user_id" has to be set.
If provided with cluster_name option, it will use the Rados cluster object
referenced by the name (created by bdev_rbd_register_cluster RPC) and ignores
"user_id + config" combination to create its own Rados cluster.
### Result
Name of newly created bdev.
@ -3364,6 +3607,33 @@ response:
}
~~~
Example request with `cluster_name`:
~~
{
"params": {
"pool_name": "rbd",
"rbd_name": "foo",
"block_size": 4096,
"cluster_name": "rbd_cluster"
},
"jsonrpc": "2.0",
"method": "bdev_rbd_create",
"id": 1
}
~~
Example response:
~~
response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "Ceph0"
}
~~
## bdev_rbd_delete {#rpc_bdev_rbd_delete}
Delete @ref bdev_config_rbd bdev
@ -4443,6 +4713,9 @@ error_recovery_level | Optional | number | Session specific paramete
allow_duplicated_isid | Optional | boolean | Allow duplicated initiator session ID (default: `false`)
max_large_datain_per_connection | Optional | number | Max number of outstanding split read I/Os per connection (default: 64)
max_r2t_per_connection | Optional | number | Max number of outstanding R2Ts per connection (default: 4)
pdu_pool_size | Optional | number | Number of PDUs in the pool (default: approximately 2 * max_sessions * (max_queue_depth + max_connections_per_session))
immediate_data_pool_size | Optional | number | Number of immediate data buffers in the pool (default: 128 * max_sessions)
data_out_pool_size | Optional | number | Number of data out buffers in the pool (default: 16 * max_sessions)
To load CHAP shared secret file, its path is required to specify explicitly in the parameter `auth_file`.
@ -5909,6 +6182,8 @@ model_number | Optional | string | Model number of virtual contr
max_namespaces | Optional | number | Maximum number of namespaces that can be attached to the subsystem. Default: 0 (Unlimited)
allow_any_host | Optional | boolean | Allow any host (`true`) or enforce allowed host list (`false`). Default: `false`.
ana_reporting | Optional | boolean | Enable ANA reporting feature (default: `false`).
min_cntlid | Optional | number | Minimum controller ID. Default: 1
max_cntlid | Optional | number | Maximum controller ID. Default: 0xffef
### Example
@ -6593,6 +6868,7 @@ tgt_name | Optional | string | Parent NVMe-oF target nam
### Response
The response is an object containing NVMf subsystem statistics.
In the response, `admin_qpairs` and `io_qpairs` are reflecting cumulative queue pair counts while `current_admin_qpairs` and `current_io_qpairs` are showing the current number.
### Example
@ -6617,6 +6893,8 @@ Example response:
"name": "app_thread",
"admin_qpairs": 1,
"io_qpairs": 4,
"current_admin_qpairs": 1,
"current_io_qpairs": 2,
"pending_bdev_io": 1721,
"transports": [
{
@ -6660,6 +6938,22 @@ Example response:
}
~~~
## nvmf_set_crdt {#rpc_nvmf_set_crdt}
Set the 3 CRDT (Command Retry Delay Time) values. For details about
CRDT, please refer to the NVMe specification. Currently all the
SPDK nvmf subsystems share the same CRDT values. The default values
are 0. This rpc can only be invoked in STARTUP stage. All values are
in units of 100 milliseconds (same as the NVMe specification).
### Parameters
Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
crdt1 | Optional | number | Command Retry Delay Time 1
crdt2 | Optional | number | Command Retry Delay Time 2
crdt3 | Optional | number | Command Retry Delay Time 3
# Vhost Target {#jsonrpc_components_vhost_tgt}
The following common preconditions need to be met in all target types.
@ -7667,7 +7961,7 @@ Example request:
"Malloc2",
"Malloc3"
],
"strip_size": 4096
"strip_size_kb": 4
}
}
~~~
@ -8591,7 +8885,10 @@ Example response:
"recv_buf_size": 2097152,
"send_buf_size": 2097152,
"enable_recv_pipe": true,
"enable_zerocopy_send": true
"enable_quickack": true,
"enable_placement_id": 0,
"enable_zerocopy_send_server": true,
"enable_zerocopy_send_client": false
}
}
~~~
@ -8602,15 +8899,16 @@ Set parameters for the socket layer implementation.
### Parameters
Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
impl_name | Required | string | Name of socket implementation, e.g. posix
recv_buf_size | Optional | number | Size of socket receive buffer in bytes
send_buf_size | Optional | number | Size of socket send buffer in bytes
enable_recv_pipe | Optional | boolean | Enable or disable receive pipe
enable_zerocopy_send | Optional | boolean | Enable or disable zero copy on send
enable_quick_ack | Optional | boolean | Enable or disable quick ACK
enable_placement_id | Optional | number | Enable or disable placement_id. 0:disable,1:incoming_napi,2:incoming_cpu
Name | Optional | Type | Description
--------------------------- | -------- | ----------- | -----------
impl_name | Required | string | Name of socket implementation, e.g. posix
recv_buf_size | Optional | number | Size of socket receive buffer in bytes
send_buf_size | Optional | number | Size of socket send buffer in bytes
enable_recv_pipe | Optional | boolean | Enable or disable receive pipe
enable_quick_ack | Optional | boolean | Enable or disable quick ACK
enable_placement_id | Optional | number | Enable or disable placement_id. 0:disable,1:incoming_napi,2:incoming_cpu
enable_zerocopy_send_server | Optional | boolean | Enable or disable zero copy on send for server sockets
enable_zerocopy_send_client | Optional | boolean | Enable or disable zero copy on send for client sockets
### Response
@ -8630,9 +8928,10 @@ Example request:
"recv_buf_size": 2097152,
"send_buf_size": 2097152,
"enable_recv_pipe": false,
"enable_zerocopy_send": true,
"enable_quick_ack": false,
"enable_placement_id": 0
"enable_placement_id": 0,
"enable_zerocopy_send_server": true,
"enable_zerocopy_send_client": false
}
}
~~~

View File

@ -2,3 +2,4 @@
- @subpage peer_2_peer
- @subpage containers
- @subpage rpms

View File

@ -174,11 +174,13 @@ SPDK_TRACE_REGISTER_FN(nvmf_trace)
spdk_trace_register_object(OBJECT_NVMF_RDMA_IO, 'r');
spdk_trace_register_description("RDMA_REQ_NEW", "",
TRACE_RDMA_REQUEST_STATE_NEW,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 1, 1, "cmid: ");
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 1,
SPDK_TRACE_ARG_TYPE_PTR, "cmid: ");
...
spdk_trace_register_description("NEW_RDMA_REQ_NAME", "",
NEW_TRACE_POINT_NAME,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0, 1, "cmid: ");
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "cmid: ");
}
~~~

View File

@ -1,5 +1,12 @@
# Performance Reports {#performance_reports}
## Release 21.04
- [SPDK 21.04 NVMe Bdev Performance Report](https://ci.spdk.io/download/performance-reports/SPDK_nvme_bdev_perf_report_2104.pdf)
- [SPDK 21.04 NVMe-oF TCP Performance Report](https://ci.spdk.io/download/performance-reports/SPDK_tcp_perf_report_2104.pdf)
- [SPDK 21.04 NVMe-oF RDMA Performance Report](https://ci.spdk.io/download/performance-reports/SPDK_rdma_perf_report_2104.pdf)
- [SPDK 21.04 Vhost Performance Report](https://ci.spdk.io/download/performance-reports/SPDK_vhost_perf_report_2104.pdf)
## Release 21.01
- [SPDK 21.01 NVMe Bdev Performance Report](https://ci.spdk.io/download/performance-reports/SPDK_nvme_bdev_perf_report_2101.pdf)

View File

@ -17,13 +17,10 @@ Run the spdk_top application
Menu at the bottom of SPDK top window shows many options for changing displayed data. Each menu item has a key associated with it in square brackets.
* Quit - quits the SPDK top application.
* TAB selection - allows to select THREADS/POLLERS/CORES tabs.
* Switch tab - allows to select THREADS/POLLERS/CORES tabs.
* Previous page/Next page - scrolls up/down to the next set of rows displayed. Indicator in the bottom-left corner shows current page and number of all available pages.
* Columns - enables/disables chosen columns in a column pop-up window.
* Sorting - allows to sort displayed data by column in a sorting pop-up.
* Refresh rate - takes user input from 0 to 255 and changes refresh rate to that value in seconds.
* Item details - displays details pop-up window for highlighted data row. Selection is changed by pressing UP and DOWN arrow keys.
* Total/Interval - changes displayed values in all tabs to either Total time (measured since start of SPDK application) or Interval time (measured since last refresh).
* Help - displays help pop-up window.
# Threads Tab
The threads tab displays a line item for each spdk thread. The information displayed shows:
@ -63,3 +60,6 @@ The cores tab provides insights into how the application is using the CPU cores
\n
Pressing ENTER key makes a pop-up window appear, showing above information, along with a list of threads running on selected core. Cores details window allows to select a thread and display thread details pop-up on top of it. To close both pop-ups use ESC key.
# Help Window
Help window pop-up can be invoked by pressing H key inside any tab. It contains explanations for each key used inside the spdk_top application.

204
doc/usdt.md Normal file
View File

@ -0,0 +1,204 @@
# Userspace DTrace (USDT) {#usdt}
## Package Dependencies
These dependencies are needed for building bpftrace and
the sys/sdt.h header file that SPDK libraries will include
for DTRACE_PROBE macro definitions.
Fedora:
libbpf
gtest-devel
gmock-devel
bcc-devel
systemtap-sdt-devel
llvm-devel
bison
flex
Ubuntu:
systemtap-sdt-dev
libbpfcc-dev
libclang-7-dev
bison
flex
## Building bpftrace
We have found issues with the packaged bpftrace on both Ubuntu 20.04
and Fedora 33. So bpftrace should be built and installed from source.
```
git clone https://github.com/iovisor/bpftrace.git
mkdir bpftrace/build
cd bpftrace/build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
```
## bpftrace.sh
bpftrace.sh is a helper script that facilitates running bpftrace scripts
against a running SPDK application. Here is a typical usage:
```
scripts/bpftrace.sh `pidof spdk_tgt` scripts/bpf/nvmf.bt
```
Attaching to USDT probes requires the full path of the binary in the
probe description. SPDK bpftrace scripts can be written with an __EXE__
marker instead of a full path name, and bpftrace.sh will dynamically
replace that string with the full path name using information from procfs.
It is also useful to filter certain kernel events (such as system calls)
based on the PID of the SPDK application. SPDK bpftrace scripts can be
written with a __PID__ marker, and bpftrace.sh will dynamically replace
that string with the PID provided to the script.
## Configuring SPDK Build
```
./configure --with-usdt
```
## Start SPDK application and bpftrace script
From first terminal:
```
build/bin/spdk_tgt -m 0xC
```
From second terminal:
```
scripts/bpftrace.sh `pidof spdk_tgt` scripts/bpf/nvmf.bt
```
nvmf.bt will print information about nvmf subsystem and poll
group info state transitions.
From third terminal:
```
scripts/rpc.py <<EOF
nvmf_create_transport -t tcp
nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001 -m 10
nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t tcp -a 127.0.0.1 -s 4420
bdev_null_create null0 1000 512
nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 null0
EOF
```
This creates the nvmf tcp transport, a new nvmf subsystem that listens on a tcp
port, and a null bdev which is added as a namespace to the new nvmf subsystem.
You will see output from the second terminal that looks like this:
```
2110.935735: nvmf_tgt reached state NONE
2110.954316: nvmf_tgt reached state CREATE_TARGET
2110.967905: nvmf_tgt reached state CREATE_POLL_GROUPS
2111.235982: nvmf_tgt reached state START_SUBSYSTEMS
2111.253560: nqn.2014-08.org.nvmexpress.discovery change state from INACTIVE to ACTIVE start
2111.260278: nqn.2014-08.org.nvmexpress.discovery on thread 2 state to ACTIVE start
2111.264281: nqn.2014-08.org.nvmexpress.discovery on thread 2 state to ACTIVE done
2111.284083: nqn.2014-08.org.nvmexpress.discovery change state from INACTIVE to ACTIVE done
2111.289197: nvmf_tgt reached state RUNNING
2111.271573: nqn.2014-08.org.nvmexpress.discovery on thread 3 state to ACTIVE start
2111.279787: nqn.2014-08.org.nvmexpress.discovery on thread 3 state to ACTIVE done
2189.921492: nqn.2016-06.io.spdk:cnode1 change state from INACTIVE to ACTIVE start
2189.952508: nqn.2016-06.io.spdk:cnode1 on thread 2 state to ACTIVE start
2189.959125: nqn.2016-06.io.spdk:cnode1 on thread 2 state to ACTIVE done
2190.005832: nqn.2016-06.io.spdk:cnode1 change state from INACTIVE to ACTIVE done
2189.969058: nqn.2016-06.io.spdk:cnode1 on thread 3 state to ACTIVE start
2189.999889: nqn.2016-06.io.spdk:cnode1 on thread 3 state to ACTIVE done
2197.859104: nqn.2016-06.io.spdk:cnode1 change state from ACTIVE to PAUSED start
2197.879199: nqn.2016-06.io.spdk:cnode1 on thread 2 state to PAUSED start
2197.883416: nqn.2016-06.io.spdk:cnode1 on thread 2 state to PAUSED done
2197.902291: nqn.2016-06.io.spdk:cnode1 change state from ACTIVE to PAUSED done
2197.908939: nqn.2016-06.io.spdk:cnode1 change state from PAUSED to ACTIVE start
2197.912644: nqn.2016-06.io.spdk:cnode1 on thread 2 state to ACTIVE start
2197.927409: nqn.2016-06.io.spdk:cnode1 on thread 2 state to ACTIVE done
2197.949742: nqn.2016-06.io.spdk:cnode1 change state from PAUSED to ACTIVE done
2197.890812: nqn.2016-06.io.spdk:cnode1 on thread 3 state to PAUSED start
2197.897233: nqn.2016-06.io.spdk:cnode1 on thread 3 state to PAUSED done
2197.931278: nqn.2016-06.io.spdk:cnode1 on thread 3 state to ACTIVE start
2197.946124: nqn.2016-06.io.spdk:cnode1 on thread 3 state to ACTIVE done
2205.859904: nqn.2016-06.io.spdk:cnode1 change state from ACTIVE to PAUSED start
2205.891392: nqn.2016-06.io.spdk:cnode1 on thread 2 state to PAUSED start
2205.896588: nqn.2016-06.io.spdk:cnode1 on thread 2 state to PAUSED done
2205.920133: nqn.2016-06.io.spdk:cnode1 change state from ACTIVE to PAUSED done
2205.905900: nqn.2016-06.io.spdk:cnode1 on thread 3 state to PAUSED start
2205.914856: nqn.2016-06.io.spdk:cnode1 on thread 3 state to PAUSED done
2206.091084: nqn.2016-06.io.spdk:cnode1 change state from PAUSED to ACTIVE start
2206.099222: nqn.2016-06.io.spdk:cnode1 on thread 2 state to ACTIVE start
2206.105445: nqn.2016-06.io.spdk:cnode1 on thread 2 state to ACTIVE done
2206.119271: nqn.2016-06.io.spdk:cnode1 change state from PAUSED to ACTIVE done
2206.109144: nqn.2016-06.io.spdk:cnode1 on thread 3 state to ACTIVE start
2206.115636: nqn.2016-06.io.spdk:cnode1 on thread 3 state to ACTIVE done
```
Now stop the bpftrace.sh running in the second terminal, and start
it again with the send_msg.bt script. This script keeps a count of
functions executed as part of an spdk_for_each_channel or
spdk_thread_send_msg function call.
```
scripts/bpftrace.sh `pidof spdk_tgt` scripts/bpf/send_msg.bt
```
From the third terminal, create another null bdev and add it as a
namespace to the cnode1 subsystem.
```
scripts/rpc.py <<EOF
bdev_null_create null1 1000 512
nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 null1
EOF
```
Now Ctrl-C the bpftrace.sh in the second terminal, and it will
print the final results of the maps.
```
@for_each_channel[subsystem_state_change_on_pg]: 2
@send_msg[_finish_unregister]: 1
@send_msg[_call_completion]: 2
@send_msg[put_io_channel]: 4
@send_msg[_call_channel]: 4
```
## TODOs and known limitations
- add definitions for common nvmf data structures - then we can pass the subsystem pointer
itself as a probe parameter and let the script decide which fields it wants to access
(Note: these would need to be kept up-to-date with the C definitions of the struct - it is
not possible to include the header files in a bpftrace script)
- investigate using pahole to generate data structure definitions that can be included in
bpftrace scripts; this would allow us to pass the subsystem pointer itself as a probe
argument, and let the script decide which fields it wants to access; for example,
`pahole -E -C spdk_nvmf_subsystem build/bin/spdk_tgt` gets us close to what we need,
but there are some limiters:
- our structures have char arrays (not char pointers) for things like subnqn; large
arrays like these cannot currently be passed to bpftrace printf without generating
a stack space error (probe points are limited to 512 bytes of stack); we could
modify SPDK to have the char array for storage, and a char pointer that points to
that storage, the latter could easily then be used in bpftrace scripts
- our structures include fields with their enum types instead of int; bpftrace will
complain it does not know about the enum (pahole doesn't print out enum
descriptions); information on enums can be found in the applications .debug_info
section, but we would need something that can convert that into a file we can
include in a bpftrace script
- Note that bpftrace prints are not always printed in exact chronological order; this can
be seen especially with spdk_for_each_channel iterations, where we execute trace points
on multiple threads in a very short period of time, and those may not get printed to the
console in exact order; this is why the nvmf.bt script prints out a msec.nsec timestamp
so that the user can understand the ordering and even pipe through sort if desired
- flesh out more DTrace probes in the nvmf code

View File

@ -11,3 +11,4 @@
- @subpage blobfs
- @subpage jsonrpc
- @subpage jsonrpc_proxy
- @subpage usdt

View File

@ -280,9 +280,9 @@ host:~# taskset -c 2,3 qemu-system-x86_64 \
-drive file=guest_os_image.qcow2,if=none,id=disk \
-device ide-hd,drive=disk,bootindex=0 \
-chardev socket,id=spdk_vhost_scsi0,path=/var/tmp/vhost.0 \
-device vhost-user-scsi-pci,id=scsi0,chardev=spdk_vhost_scsi0,num_queues=4 \
-device vhost-user-scsi-pci,id=scsi0,chardev=spdk_vhost_scsi0,num_queues=2 \
-chardev socket,id=spdk_vhost_blk0,path=/var/tmp/vhost.1 \
-device vhost-user-blk-pci,chardev=spdk_vhost_blk0,num-queues=4
-device vhost-user-blk-pci,chardev=spdk_vhost_blk0,num-queues=2
~~~
Please note the following two commands are run on the guest VM.
@ -331,6 +331,10 @@ to set `num_queues=4` to saturate physical device. Adding too many queues might
vhost performance degradation if many vhost devices are used because each device will require
additional `num_queues` to be polled.
Some Linux distributions report a kernel panic when starting the VM if the number of I/O queues
specified via the `num-queues` parameter is greater than number of vCPUs. If you need to use
more I/O queues than vCPUs, check that your OS image supports that configuration.
## Hot-attach/hot-detach {#vhost_hotattach}
Hotplug/hotremove within a vhost controller is called hot-attach/detach. This is to

2
dpdk

@ -1 +1 @@
Subproject commit eb16786836e3a8380bb86fde67efa2ee0d9d3852
Subproject commit bad3c0e51d7a34e3188d75d94f15a36c8f5e8301

View File

@ -137,7 +137,7 @@ ifeq ($(MAKE_PID),)
MAKE_PID := $(shell echo $$PPID)
endif
MAKE_NUMJOBS := $(shell ps T | sed -nE 's/\s*$(MAKE_PID)\s.* (-j|--jobs=)( *[0-9]+).*/\1\2/p')
MAKE_NUMJOBS := $(shell ps T | sed -nE 's/[[:space:]]*$(MAKE_PID)[[:space:]].* (-j|--jobs=)( *[0-9]+).*/\1\2/p')
all: $(SPDK_ROOT_DIR)/dpdk/build-tmp
$(Q)# DPDK doesn't handle nested make calls, so unset MAKEFLAGS

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y += accel bdev blob ioat nvme sock vmd nvmf
DIRS-y += accel bdev blob ioat nvme sock vmd nvmf util
ifeq ($(OS),Linux)
DIRS-$(CONFIG_VHOST) += interrupt_tgt

View File

@ -39,6 +39,6 @@ APP = accel_perf
C_SRCS := accel_perf.c
SPDK_LIB_LIST = $(ACCEL_MODULES_LIST) event_accel
SPDK_LIB_LIST = $(ACCEL_MODULES_LIST) event event_accel
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -44,11 +44,16 @@
#define DATA_PATTERN 0x5a
#define ALIGN_4K 0x1000
static bool g_using_sw_engine = false;
static uint64_t g_tsc_rate;
static uint64_t g_tsc_end;
static int g_rc;
static int g_xfer_size_bytes = 4096;
static int g_queue_depth = 32;
/* g_allocate_depth indicates how many tasks we allocate per worker. It will
* be at least as much as the queue depth.
*/
static int g_allocate_depth = 0;
static int g_ops_per_batch = 0;
static int g_threads_per_core = 1;
static int g_time_in_sec = 5;
@ -62,7 +67,6 @@ static enum accel_capability g_workload_selection;
static struct worker_thread *g_workers = NULL;
static int g_num_workers = 0;
static pthread_mutex_t g_workers_lock = PTHREAD_MUTEX_INITIALIZER;
uint64_t g_capabilites;
struct worker_thread;
static void accel_done(void *ref, int status);
@ -78,6 +82,7 @@ struct ap_task {
uint32_t iov_cnt;
void *dst;
void *dst2;
uint32_t crc_dst;
struct worker_thread *worker;
int status;
int expected_status; /* used for the compare operation */
@ -120,16 +125,22 @@ dump_user_config(struct spdk_app_opts *opts)
printf("Core mask: %s\n\n", opts->reactor_mask);
printf("Accel Perf Configuration:\n");
printf("Workload Type: %s\n", g_workload_type);
if (g_workload_selection == ACCEL_CRC32C) {
if (g_workload_selection == ACCEL_CRC32C || g_workload_selection == ACCEL_COPY_CRC32C) {
printf("CRC-32C seed: %u\n", g_crc32c_seed);
printf("vector size: %u\n", g_crc32c_chained_count);
printf("vector count %u\n", g_crc32c_chained_count);
} else if (g_workload_selection == ACCEL_FILL) {
printf("Fill pattern: 0x%x\n", g_fill_pattern);
} else if ((g_workload_selection == ACCEL_COMPARE) && g_fail_percent_goal > 0) {
printf("Failure inject: %u percent\n", g_fail_percent_goal);
}
printf("Transfer size: %u bytes\n", g_xfer_size_bytes);
if (g_workload_selection == ACCEL_COPY_CRC32C) {
printf("Vector size: %u bytes\n", g_xfer_size_bytes);
printf("Transfer size: %u bytes\n", g_xfer_size_bytes * g_crc32c_chained_count);
} else {
printf("Transfer size: %u bytes\n", g_xfer_size_bytes);
}
printf("Queue depth: %u\n", g_queue_depth);
printf("Allocate depth: %u\n", g_allocate_depth);
printf("# threads/core: %u\n", g_threads_per_core);
printf("Run time: %u seconds\n", g_time_in_sec);
if (g_ops_per_batch > 0) {
@ -146,49 +157,78 @@ usage(void)
printf("accel_perf options:\n");
printf("\t[-h help message]\n");
printf("\t[-q queue depth per core]\n");
printf("\t[-C for crc32c workload, use this value to configre the io vector size to test (default 1)\n");
printf("\t[-C for crc32c workload, use this value to configure the io vector size to test (default 1)\n");
printf("\t[-T number of threads per core\n");
printf("\t[-n number of channels]\n");
printf("\t[-o transfer size in bytes]\n");
printf("\t[-t time in seconds]\n");
printf("\t[-w workload type must be one of these: copy, fill, crc32c, compare, dualcast\n");
printf("\t[-w workload type must be one of these: copy, fill, crc32c, copy_crc32c, compare, dualcast\n");
printf("\t[-s for crc32c workload, use this seed value (default 0)\n");
printf("\t[-P for compare workload, percentage of operations that should miscompare (percent, default 0)\n");
printf("\t[-f for fill workload, use this BYTE value (default 255)\n");
printf("\t[-y verify result if this switch is on]\n");
printf("\t[-b batch this number of operations at a time (default 0 = disabled)]\n");
printf("\t[-a tasks to allocate per core (default: same value as -q)]\n");
printf("\t\tCan be used to spread operations across a wider range of memory.\n");
}
static int
parse_args(int argc, char *argv)
{
int argval = 0;
switch (argc) {
case 'a':
case 'b':
g_ops_per_batch = spdk_strtol(optarg, 10);
case 'C':
case 'f':
case 'T':
case 'o':
case 'P':
case 'q':
case 's':
case 't':
argval = spdk_strtol(optarg, 10);
if (argval < 0) {
fprintf(stderr, "-%c option must be non-negative.\n", argc);
usage();
return 1;
}
break;
default:
break;
};
switch (argc) {
case 'a':
g_allocate_depth = argval;
break;
case 'b':
g_ops_per_batch = argval;
break;
case 'C':
g_crc32c_chained_count = spdk_strtol(optarg, 10);
g_crc32c_chained_count = argval;
break;
case 'f':
g_fill_pattern = (uint8_t)spdk_strtol(optarg, 10);
g_fill_pattern = (uint8_t)argval;
break;
case 'T':
g_threads_per_core = spdk_strtol(optarg, 10);
g_threads_per_core = argval;
break;
case 'o':
g_xfer_size_bytes = spdk_strtol(optarg, 10);
g_xfer_size_bytes = argval;
break;
case 'P':
g_fail_percent_goal = spdk_strtol(optarg, 10);
g_fail_percent_goal = argval;
break;
case 'q':
g_queue_depth = spdk_strtol(optarg, 10);
g_queue_depth = argval;
break;
case 's':
g_crc32c_seed = spdk_strtol(optarg, 10);
g_crc32c_seed = argval;
break;
case 't':
g_time_in_sec = spdk_strtol(optarg, 10);
g_time_in_sec = argval;
break;
case 'y':
g_verify = true;
@ -201,6 +241,8 @@ parse_args(int argc, char *argv)
g_workload_selection = ACCEL_FILL;
} else if (!strcmp(g_workload_type, "crc32c")) {
g_workload_selection = ACCEL_CRC32C;
} else if (!strcmp(g_workload_type, "copy_crc32c")) {
g_workload_selection = ACCEL_COPY_CRC32C;
} else if (!strcmp(g_workload_type, "compare")) {
g_workload_selection = ACCEL_COMPARE;
} else if (!strcmp(g_workload_type, "dualcast")) {
@ -239,6 +281,7 @@ _get_task_data_bufs(struct ap_task *task)
{
uint32_t align = 0;
uint32_t i = 0;
int dst_buff_len = g_xfer_size_bytes;
/* For dualcast, the DSA HW requires 4K alignment on destination addresses but
* we do this for all engines to keep it simple.
@ -247,7 +290,7 @@ _get_task_data_bufs(struct ap_task *task)
align = ALIGN_4K;
}
if (g_workload_selection == ACCEL_CRC32C) {
if (g_workload_selection == ACCEL_CRC32C || g_workload_selection == ACCEL_COPY_CRC32C) {
assert(g_crc32c_chained_count > 0);
task->iov_cnt = g_crc32c_chained_count;
task->iovs = calloc(task->iov_cnt, sizeof(struct iovec));
@ -256,6 +299,10 @@ _get_task_data_bufs(struct ap_task *task)
return -ENOMEM;
}
if (g_workload_selection == ACCEL_COPY_CRC32C) {
dst_buff_len = g_xfer_size_bytes * g_crc32c_chained_count;
}
for (i = 0; i < task->iov_cnt; i++) {
task->iovs[i].iov_base = spdk_dma_zmalloc(g_xfer_size_bytes, 0, NULL);
if (task->iovs[i].iov_base == NULL) {
@ -280,17 +327,19 @@ _get_task_data_bufs(struct ap_task *task)
}
}
task->dst = spdk_dma_zmalloc(g_xfer_size_bytes, align, NULL);
if (task->dst == NULL) {
fprintf(stderr, "Unable to alloc dst buffer\n");
return -ENOMEM;
}
if (g_workload_selection != ACCEL_COPY_CRC32C) {
task->dst = spdk_dma_zmalloc(dst_buff_len, align, NULL);
if (task->dst == NULL) {
fprintf(stderr, "Unable to alloc dst buffer\n");
return -ENOMEM;
}
/* For compare we want the buffers to match, otherwise not. */
if (g_workload_selection == ACCEL_COMPARE) {
memset(task->dst, DATA_PATTERN, g_xfer_size_bytes);
} else {
memset(task->dst, ~DATA_PATTERN, g_xfer_size_bytes);
/* For compare we want the buffers to match, otherwise not. */
if (g_workload_selection == ACCEL_COMPARE) {
memset(task->dst, DATA_PATTERN, dst_buff_len);
} else {
memset(task->dst, ~DATA_PATTERN, dst_buff_len);
}
}
if (g_workload_selection == ACCEL_DUALCAST) {
@ -318,8 +367,6 @@ _get_task(struct worker_thread *worker)
return NULL;
}
task->worker = worker;
task->worker->current_queue_depth++;
return task;
}
@ -343,10 +390,14 @@ _submit_single(struct worker_thread *worker, struct ap_task *task)
g_xfer_size_bytes, accel_done, task);
break;
case ACCEL_CRC32C:
rc = spdk_accel_submit_crc32cv(worker->ch, (uint32_t *)task->dst,
rc = spdk_accel_submit_crc32cv(worker->ch, &task->crc_dst,
task->iovs, task->iov_cnt, g_crc32c_seed,
accel_done, task);
break;
case ACCEL_COPY_CRC32C:
rc = spdk_accel_submit_copy_crc32cv(worker->ch, task->dst, task->iovs, task->iov_cnt,
&task->crc_dst, g_crc32c_seed, accel_done, task);
break;
case ACCEL_COMPARE:
random_num = rand() % 100;
if (random_num < g_fail_percent_goal) {
@ -402,8 +453,12 @@ _batch_prep_cmd(struct worker_thread *worker, struct ap_task *task,
*(uint8_t *)task->src,
g_xfer_size_bytes, accel_done, task);
break;
case ACCEL_COPY_CRC32C:
rc = spdk_accel_batch_prep_copy_crc32c(worker->ch, batch, task->dst, task->src, &task->crc_dst,
g_crc32c_seed, g_xfer_size_bytes, accel_done, task);
break;
case ACCEL_CRC32C:
rc = spdk_accel_batch_prep_crc32cv(worker->ch, batch, (uint32_t *)task->dst,
rc = spdk_accel_batch_prep_crc32cv(worker->ch, batch, &task->crc_dst,
task->iovs, task->iov_cnt, g_crc32c_seed, accel_done, task);
break;
default:
@ -559,18 +614,26 @@ batch_done(void *cb_arg, int status)
spdk_thread_send_msg(worker_batch->worker->thread, _batch_done, worker_batch);
}
static uint32_t
_update_crc32c_iov(struct iovec *iov, int iovcnt, uint32_t crc32c)
static int
_vector_memcmp(void *_dst, struct iovec *src_iovs, uint32_t iovcnt)
{
int i;
uint32_t i;
uint32_t ttl_len = 0;
uint8_t *dst = (uint8_t *)_dst;
for (i = 0; i < iovcnt; i++) {
assert(iov[i].iov_base != NULL);
assert(iov[i].iov_len != 0);
crc32c = spdk_crc32c_update(iov[i].iov_base, iov[i].iov_len, crc32c);
if (memcmp(dst, src_iovs[i].iov_base, src_iovs[i].iov_len)) {
return -1;
}
dst += src_iovs[i].iov_len;
ttl_len += src_iovs[i].iov_len;
}
return crc32c;
if (ttl_len != iovcnt * g_xfer_size_bytes) {
return -1;
}
return 0;
}
static void
@ -585,9 +648,20 @@ _accel_done(void *arg1)
if (g_verify && task->status == 0) {
switch (g_workload_selection) {
case ACCEL_COPY_CRC32C:
sw_crc32c = spdk_crc32c_iov_update(task->iovs, task->iov_cnt, ~g_crc32c_seed);
if (task->crc_dst != sw_crc32c) {
SPDK_NOTICELOG("CRC-32C miscompare\n");
worker->xfer_failed++;
}
if (_vector_memcmp(task->dst, task->iovs, task->iov_cnt)) {
SPDK_NOTICELOG("Data miscompare\n");
worker->xfer_failed++;
}
break;
case ACCEL_CRC32C:
sw_crc32c = _update_crc32c_iov(task->iovs, task->iov_cnt, ~g_crc32c_seed);
if (*(uint32_t *)task->dst != sw_crc32c) {
sw_crc32c = spdk_crc32c_iov_update(task->iovs, task->iov_cnt, ~g_crc32c_seed);
if (task->crc_dst != sw_crc32c) {
SPDK_NOTICELOG("CRC-32C miscompare\n");
worker->xfer_failed++;
}
@ -634,6 +708,8 @@ _accel_done(void *arg1)
worker->current_queue_depth--;
if (!worker->is_draining) {
TAILQ_INSERT_TAIL(&worker->tasks_pool, task, link);
task = _get_task(worker);
if (g_ops_per_batch == 0) {
_submit_single(worker, task);
worker->current_queue_depth++;
@ -740,10 +816,11 @@ _init_thread(void *arg1)
int i, rc, num_batches;
int max_per_batch;
int remaining = g_queue_depth;
int num_tasks = g_queue_depth;
int num_tasks = g_allocate_depth;
struct accel_batch *tmp;
struct accel_batch *worker_batch = NULL;
struct display_info *display = arg1;
uint64_t capabilities;
worker = calloc(1, sizeof(*worker));
if (worker == NULL) {
@ -764,6 +841,15 @@ _init_thread(void *arg1)
pthread_mutex_unlock(&g_workers_lock);
worker->ch = spdk_accel_engine_get_io_channel();
if (g_num_workers == 1) {
capabilities = spdk_accel_get_capabilities(worker->ch);
if ((capabilities & g_workload_selection) != g_workload_selection) {
g_using_sw_engine = true;
SPDK_WARNLOG("The selected workload is not natively supported by the current engine\n");
SPDK_WARNLOG("The software engine will be used instead.\n\n");
}
}
TAILQ_INIT(&worker->tasks_pool);
if (g_ops_per_batch > 0) {
@ -818,6 +904,7 @@ _init_thread(void *arg1)
task = worker->task_base;
for (i = 0; i < num_tasks; i++) {
TAILQ_INSERT_TAIL(&worker->tasks_pool, task, link);
task->worker = worker;
if (_get_task_data_bufs(task)) {
fprintf(stderr, "Unable to get data bufs\n");
goto error;
@ -848,6 +935,7 @@ _init_thread(void *arg1)
for (i = 0; i < g_ops_per_batch; i++) {
task = _get_task(worker);
worker->current_queue_depth++;
if (task == NULL) {
goto error;
}
@ -877,6 +965,7 @@ _init_thread(void *arg1)
/* Submit as singles when no batching is enabled or we ran out of batches. */
for (i = 0; i < remaining; i++) {
task = _get_task(worker);
worker->current_queue_depth++;
if (task == NULL) {
goto error;
}
@ -908,13 +997,16 @@ accel_done(void *cb_arg, int status)
assert(worker);
task->status = status;
spdk_thread_send_msg(worker->thread, _accel_done, task);
if (g_using_sw_engine == false) {
_accel_done(task);
} else {
spdk_thread_send_msg(worker->thread, _accel_done, task);
}
}
static void
accel_perf_start(void *arg1)
{
struct spdk_io_channel *accel_ch;
struct spdk_cpuset tmp_cpumask = {};
char thread_name[32];
uint32_t i;
@ -922,15 +1014,6 @@ accel_perf_start(void *arg1)
struct spdk_thread *thread;
struct display_info *display;
accel_ch = spdk_accel_engine_get_io_channel();
g_capabilites = spdk_accel_get_capabilities(accel_ch);
spdk_put_io_channel(accel_ch);
if ((g_capabilites & g_workload_selection) != g_workload_selection) {
SPDK_WARNLOG("The selected workload is not natively supported by the current engine\n");
SPDK_WARNLOG("The software engine will be used instead.\n\n");
}
g_tsc_rate = spdk_get_ticks_hz();
g_tsc_end = spdk_get_ticks() + g_time_in_sec * g_tsc_rate;
@ -966,7 +1049,7 @@ main(int argc, char **argv)
pthread_mutex_init(&g_workers_lock, NULL);
spdk_app_opts_init(&opts, sizeof(opts));
opts.reactor_mask = "0x1";
if (spdk_app_parse_args(argc, argv, &opts, "C:o:q:t:yw:P:f:b:T:", NULL, parse_args,
if (spdk_app_parse_args(argc, argv, &opts, "a:C:o:q:t:yw:P:f:b:T:", NULL, parse_args,
usage) != SPDK_APP_PARSE_ARGS_SUCCESS) {
g_rc = -1;
goto cleanup;
@ -975,6 +1058,7 @@ main(int argc, char **argv)
if ((g_workload_selection != ACCEL_COPY) &&
(g_workload_selection != ACCEL_FILL) &&
(g_workload_selection != ACCEL_CRC32C) &&
(g_workload_selection != ACCEL_COPY_CRC32C) &&
(g_workload_selection != ACCEL_COMPARE) &&
(g_workload_selection != ACCEL_DUALCAST)) {
usage();
@ -989,7 +1073,18 @@ main(int argc, char **argv)
goto cleanup;
}
if (g_workload_selection == ACCEL_CRC32C &&
if (g_allocate_depth > 0 && g_queue_depth > g_allocate_depth) {
fprintf(stdout, "allocate depth must be at least as big as queue depth\n");
usage();
g_rc = -1;
goto cleanup;
}
if (g_allocate_depth == 0) {
g_allocate_depth = g_queue_depth;
}
if ((g_workload_selection == ACCEL_CRC32C || g_workload_selection == ACCEL_COPY_CRC32C) &&
g_crc32c_chained_count == 0) {
usage();
g_rc = -1;

View File

@ -40,6 +40,6 @@ FIO_PLUGIN := spdk_bdev
C_SRCS = fio_plugin.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event_bdev
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event event_bdev
include $(SPDK_ROOT_DIR)/mk/spdk.fio.mk

View File

@ -71,3 +71,52 @@ engine's full path via the ioengine parameter - LD_PRELOAD is recommended to avo
When testing random workloads, it is recommended to set norandommap=1. fio's random map
processing consumes extra CPU cycles which will degrade performance over time with
the fio_plugin since all I/O are submitted and completed on a single CPU core.
# Zoned Block Devices
SPDK has a zoned block device API (bdev_zone.h) which currently supports Open-channel SSDs,
NVMe Zoned Namespaces (ZNS), and the virtual zoned block device SPDK module.
If you wish to run fio against a SPDK zoned block device, you can use the fio option:
zonemode=zbd
It is recommended to use a fio version newer than version 3.26, if using --numjobs > 1.
If using --numjobs=1, fio version >= 3.23 should suffice.
See zbd_example.fio in this directory for a zoned block device example config.
## Maximum Open Zones
Most zoned block devices have a resource constraint on the amount of zones which can be in an opened
state at any point in time. It is very important to not exceed this limit.
You can control how many zones fio will keep in an open state by using the
``--max_open_zones`` option.
If you use a fio version newer than 3.26, fio will automatically detect and set the proper value.
If you use an old version of fio, make sure to provide the proper --max_open_zones value yourself.
## Maximum Active Zones
Zoned block devices may also have a resource constraint on the number of zones that can be active at
any point in time. Unlike ``max_open_zones``, fio currently does not manage this constraint, and
there is thus no option to limit it either.
Since the max active zones limit (by definition) has to be greater than or equal to the max open
zones limit, the easiest way to work around that fio does not manage this constraint, is to start
with a clean state each run (except for read-only workloads), by resetting all zones before fio
starts running its jobs by using the engine option:
--initial_zone_reset=1
## Zone Append
When running fio against a zoned block device you need to specify --iodepth=1 to avoid
"Zone Invalid Write: The write to a zone was not at the write pointer." I/O errors.
However, if your zoned block device supports Zone Append, you can use the engine option:
--zone_append=1
To send zone append commands instead of write commands to the zoned block device.
When using zone append, you will be able to specify a --iodepth greater than 1.

View File

@ -0,0 +1,26 @@
{
"subsystems": [
{
"subsystem": "bdev",
"config": [
{
"method": "bdev_malloc_create",
"params": {
"name": "Malloc0",
"num_blocks": 2097152,
"block_size": 512
}
},
{
"method": "bdev_zone_block_create",
"params": {
"base_bdev": "Malloc0",
"name": "Zone0",
"zone_capacity": 262144,
"optimal_open_zones": 8
}
}
]
}
]
}

View File

@ -34,8 +34,10 @@
#include "spdk/stdinc.h"
#include "spdk/bdev.h"
#include "spdk/bdev_zone.h"
#include "spdk/accel_engine.h"
#include "spdk/env.h"
#include "spdk/init.h"
#include "spdk/thread.h"
#include "spdk/log.h"
#include "spdk/string.h"
@ -48,6 +50,12 @@
#include "fio.h"
#include "optgroup.h"
#ifdef for_each_rw_ddir
#define FIO_HAS_ZBD (FIO_IOOPS_VERSION >= 26)
#else
#define FIO_HAS_ZBD (0)
#endif
/* FreeBSD is missing CLOCK_MONOTONIC_RAW,
* so alternative is provided. */
#ifndef CLOCK_MONOTONIC_RAW /* Defined in glibc bits/time.h */
@ -60,6 +68,8 @@ struct spdk_fio_options {
char *json_conf;
unsigned mem_mb;
int mem_single_seg;
int initial_zone_reset;
int zone_append;
};
struct spdk_fio_request {
@ -71,6 +81,7 @@ struct spdk_fio_target {
struct spdk_bdev *bdev;
struct spdk_bdev_desc *desc;
struct spdk_io_channel *ch;
bool zone_append_enabled;
TAILQ_ENTRY(spdk_fio_target) link;
};
@ -89,12 +100,24 @@ struct spdk_fio_thread {
TAILQ_ENTRY(spdk_fio_thread) link;
};
struct spdk_fio_zone_cb_arg {
struct spdk_fio_target *target;
struct spdk_bdev_zone_info *spdk_zones;
int completed;
uint64_t offset_blocks;
struct zbd_zone *fio_zones;
unsigned int nr_zones;
};
static bool g_spdk_env_initialized = false;
static const char *g_json_config_file = NULL;
static int spdk_fio_init(struct thread_data *td);
static void spdk_fio_cleanup(struct thread_data *td);
static size_t spdk_fio_poll_thread(struct spdk_fio_thread *fio_thread);
static int spdk_fio_handle_options(struct thread_data *td, struct fio_file *f,
struct spdk_bdev *bdev);
static int spdk_fio_handle_options_per_target(struct thread_data *td, struct fio_file *f);
static pthread_t g_init_thread_id = 0;
static pthread_mutex_t g_init_mtx = PTHREAD_MUTEX_INITIALIZER;
@ -196,8 +219,8 @@ spdk_fio_bdev_init_start(void *arg)
{
bool *done = arg;
spdk_app_json_config_load(g_json_config_file, SPDK_DEFAULT_RPC_ADDR,
spdk_fio_bdev_init_done, done, true);
spdk_subsystem_init_from_json_config(g_json_config_file, SPDK_DEFAULT_RPC_ADDR,
spdk_fio_bdev_init_done, done, true);
}
static void
@ -455,6 +478,7 @@ spdk_fio_setup(struct thread_data *td)
for_each_file(td, f, i) {
struct spdk_bdev *bdev;
int rc;
if (strcmp(f->file_name, "*") == 0) {
continue;
@ -468,7 +492,13 @@ spdk_fio_setup(struct thread_data *td)
f->real_file_size = spdk_bdev_get_num_blocks(bdev) *
spdk_bdev_get_block_size(bdev);
f->filetype = FIO_TYPE_BLOCK;
fio_file_set_size_known(f);
rc = spdk_fio_handle_options(td, f, bdev);
if (rc) {
return rc;
}
}
return 0;
@ -528,21 +558,48 @@ spdk_fio_bdev_open(void *arg)
f->engine_data = target;
rc = spdk_fio_handle_options_per_target(td, f);
if (rc) {
SPDK_ERRLOG("Failed to handle options for: %s\n", f->file_name);
f->engine_data = NULL;
spdk_put_io_channel(target->ch);
spdk_bdev_close(target->desc);
free(target);
fio_thread->failed = true;
return;
}
TAILQ_INSERT_TAIL(&fio_thread->targets, target, link);
}
}
/* Called for each thread, on that thread, shortly after the thread
* starts.
*
* Also called by spdk_fio_report_zones(), since we need an I/O channel
* in order to get the zone report. (fio calls the .report_zones callback
* before it calls the .init callback.)
* Therefore, if fio was run with --zonemode=zbd, the thread will already
* be initialized by the time that fio calls the .init callback.
*/
static int
spdk_fio_init(struct thread_data *td)
{
struct spdk_fio_thread *fio_thread;
int rc;
spdk_fio_init_thread(td);
/* If thread has already been initialized, do nothing. */
if (td->io_ops_data) {
return 0;
}
rc = spdk_fio_init_thread(td);
if (rc) {
return rc;
}
fio_thread = td->io_ops_data;
assert(fio_thread);
fio_thread->failed = false;
spdk_thread_send_msg(fio_thread->thread, spdk_fio_bdev_open, td);
@ -644,6 +701,17 @@ typedef enum fio_q_status fio_q_status_t;
typedef int fio_q_status_t;
#endif
static uint64_t
spdk_fio_zone_bytes_to_blocks(struct spdk_bdev *bdev, uint64_t offset_bytes, uint64_t *zone_start,
uint64_t num_bytes, uint64_t *num_blocks)
{
uint32_t block_size = spdk_bdev_get_block_size(bdev);
*zone_start = (offset_bytes / (spdk_bdev_get_zone_size(bdev) * block_size)) *
spdk_bdev_get_zone_size(bdev);
*num_blocks = num_bytes / block_size;
return (offset_bytes % block_size) | (num_bytes % block_size);
}
static fio_q_status_t
spdk_fio_queue(struct thread_data *td, struct io_u *io_u)
{
@ -666,9 +734,21 @@ spdk_fio_queue(struct thread_data *td, struct io_u *io_u)
spdk_fio_completion_cb, fio_req);
break;
case DDIR_WRITE:
rc = spdk_bdev_write(target->desc, target->ch,
io_u->buf, io_u->offset, io_u->xfer_buflen,
spdk_fio_completion_cb, fio_req);
if (!target->zone_append_enabled) {
rc = spdk_bdev_write(target->desc, target->ch,
io_u->buf, io_u->offset, io_u->xfer_buflen,
spdk_fio_completion_cb, fio_req);
} else {
uint64_t zone_start, num_blocks;
if (spdk_fio_zone_bytes_to_blocks(target->bdev, io_u->offset, &zone_start,
io_u->xfer_buflen, &num_blocks) != 0) {
rc = -EINVAL;
break;
}
rc = spdk_bdev_zone_append(target->desc, target->ch, io_u->buf,
zone_start, num_blocks, spdk_fio_completion_cb,
fio_req);
}
break;
case DDIR_TRIM:
rc = spdk_bdev_unmap(target->desc, target->ch,
@ -755,6 +835,308 @@ spdk_fio_invalidate(struct thread_data *td, struct fio_file *f)
return 0;
}
#if FIO_HAS_ZBD
static int
spdk_fio_get_zoned_model(struct thread_data *td, struct fio_file *f, enum zbd_zoned_model *model)
{
struct spdk_bdev *bdev;
if (f->filetype != FIO_TYPE_BLOCK) {
SPDK_ERRLOG("Unsupported filetype: %d\n", f->filetype);
return -EINVAL;
}
bdev = spdk_bdev_get_by_name(f->file_name);
if (!bdev) {
SPDK_ERRLOG("Cannot get zoned model, no bdev with name: %s\n", f->file_name);
return -ENODEV;
}
if (spdk_bdev_is_zoned(bdev)) {
*model = ZBD_HOST_MANAGED;
} else {
*model = ZBD_NONE;
}
return 0;
}
static void
spdk_fio_bdev_get_zone_info_done(struct spdk_bdev_io *bdev_io, bool success, void *arg)
{
struct spdk_fio_zone_cb_arg *cb_arg = arg;
unsigned int i;
int handled_zones = 0;
if (!success) {
spdk_bdev_free_io(bdev_io);
cb_arg->completed = -EIO;
return;
}
for (i = 0; i < cb_arg->nr_zones; i++) {
struct spdk_bdev_zone_info *zone_src = &cb_arg->spdk_zones[handled_zones];
struct zbd_zone *zone_dest = &cb_arg->fio_zones[handled_zones];
uint32_t block_size = spdk_bdev_get_block_size(cb_arg->target->bdev);
zone_dest->type = ZBD_ZONE_TYPE_SWR;
zone_dest->len = spdk_bdev_get_zone_size(cb_arg->target->bdev) * block_size;
zone_dest->capacity = zone_src->capacity * block_size;
zone_dest->start = zone_src->zone_id * block_size;
zone_dest->wp = zone_src->write_pointer * block_size;
switch (zone_src->state) {
case SPDK_BDEV_ZONE_STATE_EMPTY:
zone_dest->cond = ZBD_ZONE_COND_EMPTY;
break;
case SPDK_BDEV_ZONE_STATE_IMP_OPEN:
zone_dest->cond = ZBD_ZONE_COND_IMP_OPEN;
break;
case SPDK_BDEV_ZONE_STATE_EXP_OPEN:
zone_dest->cond = ZBD_ZONE_COND_EXP_OPEN;
break;
case SPDK_BDEV_ZONE_STATE_FULL:
zone_dest->cond = ZBD_ZONE_COND_FULL;
break;
case SPDK_BDEV_ZONE_STATE_CLOSED:
zone_dest->cond = ZBD_ZONE_COND_CLOSED;
break;
case SPDK_BDEV_ZONE_STATE_READ_ONLY:
zone_dest->cond = ZBD_ZONE_COND_READONLY;
break;
case SPDK_BDEV_ZONE_STATE_OFFLINE:
zone_dest->cond = ZBD_ZONE_COND_OFFLINE;
break;
default:
spdk_bdev_free_io(bdev_io);
cb_arg->completed = -EIO;
return;
}
handled_zones++;
}
spdk_bdev_free_io(bdev_io);
cb_arg->completed = handled_zones;
}
static void
spdk_fio_bdev_get_zone_info(void *arg)
{
struct spdk_fio_zone_cb_arg *cb_arg = arg;
struct spdk_fio_target *target = cb_arg->target;
int rc;
rc = spdk_bdev_get_zone_info(target->desc, target->ch, cb_arg->offset_blocks,
cb_arg->nr_zones, cb_arg->spdk_zones,
spdk_fio_bdev_get_zone_info_done, cb_arg);
if (rc < 0) {
cb_arg->completed = rc;
}
}
static int
spdk_fio_report_zones(struct thread_data *td, struct fio_file *f, uint64_t offset,
struct zbd_zone *zones, unsigned int nr_zones)
{
struct spdk_fio_target *target;
struct spdk_fio_thread *fio_thread;
struct spdk_fio_zone_cb_arg cb_arg;
uint32_t block_size;
int rc;
if (nr_zones == 0) {
return 0;
}
/* spdk_fio_report_zones() is only called before the bdev I/O channels have been created.
* Since we need an I/O channel for report_zones(), call spdk_fio_init() to initialize
* the thread early.
* spdk_fio_report_zones() might be called several times by fio, if e.g. the zone report
* for all zones does not fit in the buffer that fio has allocated for the zone report.
* It is safe to call spdk_fio_init(), even if the thread has already been initialized.
*/
rc = spdk_fio_init(td);
if (rc) {
return rc;
}
fio_thread = td->io_ops_data;
target = f->engine_data;
assert(fio_thread);
assert(target);
block_size = spdk_bdev_get_block_size(target->bdev);
cb_arg.target = target;
cb_arg.completed = 0;
cb_arg.offset_blocks = offset / block_size;
cb_arg.fio_zones = zones;
cb_arg.nr_zones = spdk_min(nr_zones, spdk_bdev_get_num_zones(target->bdev));
cb_arg.spdk_zones = calloc(1, sizeof(*cb_arg.spdk_zones) * cb_arg.nr_zones);
if (!cb_arg.spdk_zones) {
SPDK_ERRLOG("Could not allocate memory for zone report!\n");
rc = -ENOMEM;
goto cleanup_thread;
}
spdk_thread_send_msg(fio_thread->thread, spdk_fio_bdev_get_zone_info, &cb_arg);
do {
spdk_fio_poll_thread(fio_thread);
} while (!cb_arg.completed);
/* Free cb_arg.spdk_zones. The report in fio format is stored in cb_arg.fio_zones/zones. */
free(cb_arg.spdk_zones);
rc = cb_arg.completed;
if (rc < 0) {
SPDK_ERRLOG("Failed to get zone info: %d\n", rc);
goto cleanup_thread;
}
/* Return the amount of zones successfully copied. */
return rc;
cleanup_thread:
spdk_fio_cleanup(td);
return rc;
}
static void
spdk_fio_bdev_zone_reset_done(struct spdk_bdev_io *bdev_io, bool success, void *arg)
{
struct spdk_fio_zone_cb_arg *cb_arg = arg;
spdk_bdev_free_io(bdev_io);
if (!success) {
cb_arg->completed = -EIO;
} else {
cb_arg->completed = 1;
}
}
static void
spdk_fio_bdev_zone_reset(void *arg)
{
struct spdk_fio_zone_cb_arg *cb_arg = arg;
struct spdk_fio_target *target = cb_arg->target;
int rc;
rc = spdk_bdev_zone_management(target->desc, target->ch, cb_arg->offset_blocks,
SPDK_BDEV_ZONE_RESET,
spdk_fio_bdev_zone_reset_done, cb_arg);
if (rc < 0) {
cb_arg->completed = rc;
}
}
static int
spdk_fio_reset_zones(struct spdk_fio_thread *fio_thread, struct spdk_fio_target *target,
uint64_t offset, uint64_t length)
{
uint64_t zone_size_bytes;
uint32_t block_size;
int rc;
assert(fio_thread);
assert(target);
block_size = spdk_bdev_get_block_size(target->bdev);
zone_size_bytes = spdk_bdev_get_zone_size(target->bdev) * block_size;
for (uint64_t cur = offset; cur < offset + length; cur += zone_size_bytes) {
struct spdk_fio_zone_cb_arg cb_arg = {
.target = target,
.completed = 0,
.offset_blocks = cur / block_size,
};
spdk_thread_send_msg(fio_thread->thread, spdk_fio_bdev_zone_reset, &cb_arg);
do {
spdk_fio_poll_thread(fio_thread);
} while (!cb_arg.completed);
rc = cb_arg.completed;
if (rc < 0) {
SPDK_ERRLOG("Failed to reset zone: %d\n", rc);
return rc;
}
}
return 0;
}
static int
spdk_fio_reset_wp(struct thread_data *td, struct fio_file *f, uint64_t offset, uint64_t length)
{
return spdk_fio_reset_zones(td->io_ops_data, f->engine_data, offset, length);
}
#endif
#if FIO_IOOPS_VERSION >= 30
static int spdk_fio_get_max_open_zones(struct thread_data *td, struct fio_file *f,
unsigned int *max_open_zones)
{
struct spdk_bdev *bdev;
bdev = spdk_bdev_get_by_name(f->file_name);
if (!bdev) {
SPDK_ERRLOG("Cannot get max open zones, no bdev with name: %s\n", f->file_name);
return -ENODEV;
}
*max_open_zones = spdk_bdev_get_max_open_zones(bdev);
return 0;
}
#endif
static int
spdk_fio_handle_options(struct thread_data *td, struct fio_file *f, struct spdk_bdev *bdev)
{
struct spdk_fio_options *fio_options = td->eo;
if (fio_options->initial_zone_reset && spdk_bdev_is_zoned(bdev)) {
#if FIO_HAS_ZBD
int rc = spdk_fio_init(td);
if (rc) {
return rc;
}
rc = spdk_fio_reset_zones(td->io_ops_data, f->engine_data, 0, f->real_file_size);
if (rc) {
spdk_fio_cleanup(td);
return rc;
}
#else
SPDK_ERRLOG("fio version is too old to support zoned block devices\n");
#endif
}
return 0;
}
static int
spdk_fio_handle_options_per_target(struct thread_data *td, struct fio_file *f)
{
struct spdk_fio_target *target = f->engine_data;
struct spdk_fio_options *fio_options = td->eo;
if (fio_options->zone_append && spdk_bdev_is_zoned(target->bdev)) {
if (spdk_bdev_io_type_supported(target->bdev, SPDK_BDEV_IO_TYPE_ZONE_APPEND)) {
SPDK_DEBUGLOG(fio_bdev, "Using zone appends instead of writes on: '%s'\n",
f->file_name);
target->zone_append_enabled = true;
} else {
SPDK_WARNLOG("Falling back to writes on: '%s' - bdev lacks zone append cmd\n",
f->file_name);
}
}
return 0;
}
static struct fio_option options[] = {
{
.name = "spdk_conf",
@ -793,6 +1175,26 @@ static struct fio_option options[] = {
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.name = "initial_zone_reset",
.lname = "Reset Zones on initialization",
.type = FIO_OPT_INT,
.off1 = offsetof(struct spdk_fio_options, initial_zone_reset),
.def = "0",
.help = "Reset Zones on initialization (0=disable, 1=Reset All Zones)",
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.name = "zone_append",
.lname = "Use zone append instead of write",
.type = FIO_OPT_INT,
.off1 = offsetof(struct spdk_fio_options, zone_append),
.def = "0",
.help = "Use zone append instead of write (1=zone append, 0=write)",
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.name = NULL,
},
@ -823,6 +1225,14 @@ struct ioengine_ops ioengine = {
.iomem_free = spdk_fio_iomem_free,
.io_u_init = spdk_fio_io_u_init,
.io_u_free = spdk_fio_io_u_free,
#if FIO_HAS_ZBD
.get_zoned_model = spdk_fio_get_zoned_model,
.report_zones = spdk_fio_report_zones,
.reset_wp = spdk_fio_reset_wp,
#endif
#if FIO_IOOPS_VERSION >= 30
.get_max_open_zones = spdk_fio_get_max_open_zones,
#endif
.option_struct_size = sizeof(struct spdk_fio_options),
.options = options,
};
@ -852,3 +1262,5 @@ static void fio_exit spdk_fio_unregister(void)
}
unregister_ioengine(&ioengine);
}
SPDK_LOG_REGISTER_COMPONENT(fio_bdev)

View File

@ -0,0 +1,18 @@
[global]
ioengine=spdk_bdev
spdk_json_conf=./examples/bdev/fio_plugin/bdev_zoned.json
thread=1
direct=1
time_based
runtime=10
rw=randwrite
bs=16K
zonemode=zbd
max_open_zones=8
initial_zone_reset=1
zone_append=1
iodepth=64
[test]
filename=Zone0
numjobs=1

View File

@ -37,6 +37,6 @@ APP = hello_bdev
C_SRCS := hello_bdev.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event_bdev
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event event_bdev
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -38,6 +38,6 @@ APP = blobcli
C_SRCS := blobcli.c
# Don't link bdev_lvol in blobcli - otherwise this utility cannot operate on an lvolstore
SPDK_LIB_LIST = $(filter-out bdev_lvol,$(ALL_MODULES_LIST)) event_bdev
SPDK_LIB_LIST = $(filter-out bdev_lvol,$(ALL_MODULES_LIST)) event event_bdev
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -37,6 +37,6 @@ APP = hello_blob
C_SRCS := hello_blob.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event_bdev
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event event_bdev
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -415,7 +415,7 @@ hello_start(void *arg1)
/*
* In this example, use our malloc (RAM) disk configured via
* hello_blob.conf that was passed in when we started the
* hello_blob.json that was passed in when we started the
* SPDK app framework.
*
* spdk_bs_init() requires us to fill out the structure

View File

@ -39,7 +39,7 @@ APP = interrupt_tgt
C_SRCS := interrupt_tgt.c
SPDK_LIB_LIST = $(INTR_BLOCKDEV_MODULES_LIST) event_bdev conf
SPDK_LIB_LIST = $(INTR_BLOCKDEV_MODULES_LIST) event event_bdev conf
SPDK_LIB_LIST += event_nbd
SPDK_LIB_LIST += event_vhost

View File

@ -78,6 +78,14 @@ rpc_reactor_set_interrupt_mode(struct spdk_jsonrpc_request *request,
return;
}
if (!spdk_interrupt_mode_is_enabled()) {
SPDK_ERRLOG("Interrupt mode is not set when staring the application\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"spdk_json_decode_object failed");
return;
}
SPDK_NOTICELOG("RPC Start to %s interrupt mode on reactor %d.\n",
req.disable_interrupt ? "disable" : "enable", req.lcore);
if (req.lcore >= (int64_t)spdk_env_get_first_core() &&

View File

@ -912,8 +912,8 @@ unregister_controllers(void)
free(entry);
}
while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
;
if (detach_ctx) {
spdk_nvme_detach_poll(detach_ctx);
}
}

View File

@ -125,7 +125,8 @@ Zoned Namespaces has a resource constraint on the amount of zones which can be i
any point in time. You can control how many zones fio will keep in an open state by using the
``--max_open_zones`` option.
The SPDK/NVMe fio io-engine will set a default value if you do not provide one.
If you use a fio version newer than 3.26, fio will automatically detect and set the proper value.
If you use an old version of fio, make sure to provide the proper --max_open_zones value yourself.
## Maximum Active Zones

View File

@ -241,7 +241,6 @@ get_fio_ctrlr(const struct spdk_nvme_transport_id *trid)
return NULL;
}
#if FIO_HAS_ZBD
/**
* Returns the fio_qpair matching the given fio_file and has an associated ns
*/
@ -259,6 +258,7 @@ get_fio_qpair(struct spdk_fio_thread *fio_thread, struct fio_file *f)
return NULL;
}
#if FIO_HAS_ZBD
/**
* Callback function to use while processing completions until completion-indicator turns non-zero
*/
@ -426,12 +426,12 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
if (fio_options->zone_append && spdk_nvme_ns_get_csi(ns) == SPDK_NVME_CSI_ZNS) {
if (spdk_nvme_ctrlr_get_flags(ctrlr) & SPDK_NVME_CTRLR_ZONE_APPEND_SUPPORTED) {
fprintf(stdout, "Using zone appends instead of writes on: '%s'\n",
fio_qpair->f->file_name);
SPDK_DEBUGLOG(fio_nvme, "Using zone appends instead of writes on: '%s'\n",
f->file_name);
fio_qpair->zone_append_enabled = true;
} else {
SPDK_WARNLOG("Falling back to writes on: '%s' - ns lacks zone append cmd\n",
fio_qpair->f->file_name);
f->file_name);
}
}
@ -988,16 +988,12 @@ spdk_fio_queue(struct thread_data *td, struct io_u *io_u)
uint64_t lba;
uint32_t lba_count;
/* Find the namespace that corresponds to the file in the io_u */
TAILQ_FOREACH(fio_qpair, &fio_thread->fio_qpair, link) {
if (fio_qpair->f == io_u->file) {
ns = fio_qpair->ns;
break;
}
}
if (fio_qpair == NULL || ns == NULL) {
fio_qpair = get_fio_qpair(fio_thread, io_u->file);
if (fio_qpair == NULL) {
return -ENXIO;
}
ns = fio_qpair->ns;
if (fio_qpair->nvme_pi_enabled && !fio_qpair->extended_lba) {
md_buf = fio_req->md_buf;
}
@ -1041,7 +1037,7 @@ spdk_fio_queue(struct thread_data *td, struct io_u *io_u)
spdk_fio_completion_cb, fio_req,
fio_qpair->io_flags, dif_ctx->apptag_mask, dif_ctx->app_tag);
} else {
uint64_t zslba = fio_offset_to_zslba(io_u->offset, fio_qpair->ns);
uint64_t zslba = fio_offset_to_zslba(io_u->offset, ns);
rc = spdk_nvme_zns_zone_append_with_md(ns, fio_qpair->qpair, io_u->buf, md_buf, zslba,
lba_count,
spdk_fio_completion_cb, fio_req,
@ -1054,7 +1050,7 @@ spdk_fio_queue(struct thread_data *td, struct io_u *io_u)
spdk_nvme_io_reset_sgl, spdk_nvme_io_next_sge, md_buf,
dif_ctx->apptag_mask, dif_ctx->app_tag);
} else {
uint64_t zslba = fio_offset_to_zslba(io_u->offset, fio_qpair->ns);
uint64_t zslba = fio_offset_to_zslba(io_u->offset, ns);
rc = spdk_nvme_zns_zone_appendv_with_md(ns, fio_qpair->qpair, zslba,
lba_count, spdk_fio_completion_cb, fio_req, fio_qpair->io_flags,
spdk_nvme_io_reset_sgl, spdk_nvme_io_next_sge, md_buf,
@ -1157,13 +1153,9 @@ spdk_fio_get_zoned_model(struct thread_data *td, struct fio_file *f, enum zbd_zo
struct spdk_fio_qpair *fio_qpair = NULL;
const struct spdk_nvme_zns_ns_data *zns_data = NULL;
*model = ZBD_IGNORE;
if (f->filetype != FIO_TYPE_FILE && \
f->filetype != FIO_TYPE_BLOCK && \
f->filetype != FIO_TYPE_CHAR) {
log_info("spdk/nvme: ignoring filetype: %d\n", f->filetype);
return 0;
if (f->filetype != FIO_TYPE_BLOCK) {
log_info("spdk/nvme: unsupported filetype: %d\n", f->filetype);
return -EINVAL;
}
fio_qpair = get_fio_qpair(fio_thread, f);
@ -1190,29 +1182,6 @@ spdk_fio_get_zoned_model(struct thread_data *td, struct fio_file *f, enum zbd_zo
*model = ZBD_HOST_MANAGED;
/** Unlimited open resources, skip checking 'max_open_zones' */
if (0xFFFFFFFF == zns_data->mor) {
return 0;
}
if (!td->o.max_open_zones) {
td->o.max_open_zones = spdk_min(ZBD_MAX_OPEN_ZONES, zns_data->mor + 1);
log_info("spdk/nvme: parameter 'max_open_zones' was unset; assigned: %d.\n",
td->o.max_open_zones);
} else if (td->o.max_open_zones < 0) {
log_err("spdk/nvme: invalid parameter 'max_open_zones': %d\n",
td->o.max_open_zones);
return -EINVAL;
} else if (td->o.max_open_zones > ZBD_MAX_OPEN_ZONES) {
log_err("spdk/nvme: parameter 'max_open_zones': %d exceeds fio-limit: %d\n",
td->o.max_open_zones, ZBD_MAX_OPEN_ZONES);
return -EINVAL;
} else if ((uint32_t)td->o.max_open_zones > (zns_data->mor + 1)) {
log_err("spdk/nvme: parameter 'max_open_zones': %d exceeds dev-limit: %u\n",
td->o.max_open_zones, zns_data->mor + 1);
return -EINVAL;
}
return 0;
}
@ -1382,6 +1351,25 @@ spdk_fio_reset_wp(struct thread_data *td, struct fio_file *f, uint64_t offset, u
}
#endif
#if FIO_IOOPS_VERSION >= 30
static int spdk_fio_get_max_open_zones(struct thread_data *td, struct fio_file *f,
unsigned int *max_open_zones)
{
struct spdk_fio_thread *fio_thread = td->io_ops_data;
struct spdk_fio_qpair *fio_qpair = NULL;
fio_qpair = get_fio_qpair(fio_thread, f);
if (!fio_qpair) {
log_err("spdk/nvme: no ns/qpair or file_name: '%s'\n", f->file_name);
return -ENODEV;
}
*max_open_zones = spdk_nvme_zns_ns_get_max_open_zones(fio_qpair->ns);
return 0;
}
#endif
static void spdk_fio_cleanup(struct thread_data *td)
{
struct spdk_fio_thread *fio_thread = td->io_ops_data;
@ -1409,8 +1397,8 @@ static void spdk_fio_cleanup(struct thread_data *td)
free(fio_ctrlr);
}
while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
;
if (detach_ctx) {
spdk_nvme_detach_poll(detach_ctx);
}
if (fio_options->enable_vmd) {
@ -1634,7 +1622,7 @@ static struct fio_option options[] = {
.type = FIO_OPT_INT,
.off1 = offsetof(struct spdk_fio_options, zone_append),
.def = "0",
.help = "Use zone append instead of write (zone_append=1 or zone_append=0)",
.help = "Use zone append instead of write (1=zone append, 0=write)",
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
@ -1673,6 +1661,9 @@ struct ioengine_ops ioengine = {
.get_zoned_model = spdk_fio_get_zoned_model,
.report_zones = spdk_fio_report_zones,
.reset_wp = spdk_fio_reset_wp,
#endif
#if FIO_IOOPS_VERSION >= 30
.get_max_open_zones = spdk_fio_get_max_open_zones,
#endif
.flags = FIO_RAWIO | FIO_NOEXTEND | FIO_NODISKUTIL | FIO_MEMALIGN,
.options = options,
@ -1688,3 +1679,5 @@ static void fio_exit fio_spdk_unregister(void)
{
unregister_ioengine(&ioengine);
}
SPDK_LOG_REGISTER_COMPONENT(fio_nvme)

View File

@ -386,8 +386,8 @@ cleanup(void)
free(ctrlr_entry);
}
while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
;
if (detach_ctx) {
spdk_nvme_detach_poll(detach_ctx);
}
}

View File

@ -73,6 +73,7 @@ static int g_insert_times;
static int g_removal_times;
static int g_shm_id = -1;
static uint64_t g_timeout_in_us = SPDK_SEC_TO_USEC;
static struct spdk_nvme_detach_ctx *g_detach_ctx;
static void
task_complete(struct perf_task *task);
@ -100,7 +101,8 @@ register_dev(struct spdk_nvme_ctrlr *ctrlr)
dev->is_removed = false;
dev->is_draining = false;
spdk_nvme_ctrlr_register_timeout_callback(ctrlr, g_timeout_in_us, timeout_cb, NULL);
spdk_nvme_ctrlr_register_timeout_callback(ctrlr, g_timeout_in_us, g_timeout_in_us, timeout_cb,
NULL);
dev->ns = spdk_nvme_ctrlr_get_ns(ctrlr, 1);
@ -142,7 +144,7 @@ unregister_dev(struct dev_ctx *dev)
fprintf(stderr, "unregister_dev: %s\n", dev->name);
spdk_nvme_ctrlr_free_io_qpair(dev->qpair);
spdk_nvme_detach(dev->ctrlr);
spdk_nvme_detach_async(dev->ctrlr, &g_detach_ctx);
TAILQ_REMOVE(&g_devs, dev, tailq);
free(dev);
@ -319,7 +321,7 @@ remove_cb(void *cb_ctx, struct spdk_nvme_ctrlr *ctrlr)
* in g_devs (for example, because we skipped it during register_dev),
* so immediately detach it.
*/
spdk_nvme_detach(ctrlr);
spdk_nvme_detach_async(ctrlr, &g_detach_ctx);
}
static void
@ -338,6 +340,7 @@ io_loop(void)
struct dev_ctx *dev, *dev_tmp;
uint64_t tsc_end;
uint64_t next_stats_tsc;
int rc;
tsc_end = spdk_get_ticks() + g_time_in_sec * g_tsc_rate;
next_stats_tsc = spdk_get_ticks();
@ -382,6 +385,13 @@ io_loop(void)
}
}
if (g_detach_ctx) {
rc = spdk_nvme_detach_poll_async(g_detach_ctx);
if (rc == 0) {
g_detach_ctx = NULL;
}
}
now = spdk_get_ticks();
if (now > tsc_end) {
break;
@ -400,6 +410,10 @@ io_loop(void)
drain_io(dev);
unregister_dev(dev);
}
if (g_detach_ctx) {
spdk_nvme_detach_poll(g_detach_ctx);
}
}
static void usage(char *program_name)

View File

@ -70,6 +70,8 @@ static struct spdk_nvme_firmware_page firmware_page;
static struct spdk_nvme_ana_page *g_ana_log_page;
static struct spdk_nvme_ana_group_descriptor *g_copied_ana_desc;
static size_t g_ana_log_page_size;
static struct spdk_nvme_cmds_and_effect_log_page cmd_effects_log_page;
@ -100,7 +102,7 @@ static bool g_dpdk_mem_single_seg = false;
static int g_main_core = 0;
static char g_core_mask[16] = "0x1";
static char g_core_mask[20] = "0x1";
static struct spdk_nvme_transport_id g_trid;
static char g_hostnqn[SPDK_NVMF_NQN_MAX_LEN + 1];
@ -111,6 +113,8 @@ static bool g_vmd = false;
static bool g_ocssd_verbose = false;
static struct spdk_nvme_detach_ctx *g_detach_ctx = NULL;
static void
hex_dump(const void *data, size_t size)
{
@ -201,7 +205,7 @@ get_zns_zone_report_completion(void *cb_arg, const struct spdk_nvme_cpl *cpl)
}
static int
get_feature(struct spdk_nvme_ctrlr *ctrlr, uint8_t fid)
get_feature(struct spdk_nvme_ctrlr *ctrlr, uint8_t fid, uint32_t nsid)
{
struct spdk_nvme_cmd cmd = {};
struct feature *feature = &features[fid];
@ -210,35 +214,28 @@ get_feature(struct spdk_nvme_ctrlr *ctrlr, uint8_t fid)
cmd.opc = SPDK_NVME_OPC_GET_FEATURES;
cmd.cdw10_bits.get_features.fid = fid;
cmd.nsid = nsid;
return spdk_nvme_ctrlr_cmd_admin_raw(ctrlr, &cmd, NULL, 0, get_feature_completion, feature);
}
static void
get_features(struct spdk_nvme_ctrlr *ctrlr)
get_features(struct spdk_nvme_ctrlr *ctrlr, uint8_t *features_to_get, size_t num_features,
uint32_t nsid)
{
size_t i;
uint8_t features_to_get[] = {
SPDK_NVME_FEAT_ARBITRATION,
SPDK_NVME_FEAT_POWER_MANAGEMENT,
SPDK_NVME_FEAT_TEMPERATURE_THRESHOLD,
SPDK_NVME_FEAT_ERROR_RECOVERY,
SPDK_NVME_FEAT_NUMBER_OF_QUEUES,
SPDK_OCSSD_FEAT_MEDIA_FEEDBACK,
};
/* Submit only one GET FEATURES at a time. There is a known issue #1799
* with Google Cloud Platform NVMe SSDs that do not handle overlapped
* GET FEATURES commands correctly.
*/
outstanding_commands = 0;
for (i = 0; i < SPDK_COUNTOF(features_to_get); i++) {
for (i = 0; i < num_features; i++) {
if (!spdk_nvme_ctrlr_is_ocssd_supported(ctrlr) &&
features_to_get[i] == SPDK_OCSSD_FEAT_MEDIA_FEEDBACK) {
continue;
}
if (get_feature(ctrlr, features_to_get[i]) == 0) {
if (get_feature(ctrlr, features_to_get[i], nsid) == 0) {
outstanding_commands++;
} else {
printf("get_feature(0x%02X) failed to submit command\n", features_to_get[i]);
@ -251,6 +248,30 @@ get_features(struct spdk_nvme_ctrlr *ctrlr)
}
static void
get_ctrlr_features(struct spdk_nvme_ctrlr *ctrlr)
{
uint8_t features_to_get[] = {
SPDK_NVME_FEAT_ARBITRATION,
SPDK_NVME_FEAT_POWER_MANAGEMENT,
SPDK_NVME_FEAT_TEMPERATURE_THRESHOLD,
SPDK_NVME_FEAT_NUMBER_OF_QUEUES,
SPDK_OCSSD_FEAT_MEDIA_FEEDBACK,
};
get_features(ctrlr, features_to_get, SPDK_COUNTOF(features_to_get), 0);
}
static void
get_ns_features(struct spdk_nvme_ctrlr *ctrlr, uint32_t nsid)
{
uint8_t features_to_get[] = {
SPDK_NVME_FEAT_ERROR_RECOVERY,
};
get_features(ctrlr, features_to_get, SPDK_COUNTOF(features_to_get), nsid);
}
static int
get_error_log_page(struct spdk_nvme_ctrlr *ctrlr)
{
@ -496,6 +517,10 @@ get_log_pages(struct spdk_nvme_ctrlr *ctrlr)
if (g_ana_log_page == NULL) {
exit(1);
}
g_copied_ana_desc = calloc(1, g_ana_log_page_size);
if (g_copied_ana_desc == NULL) {
exit(1);
}
if (get_ana_log_page(ctrlr) == 0) {
outstanding_commands++;
} else {
@ -942,6 +967,16 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
/* This function is only called for active namespaces. */
assert(spdk_nvme_ns_is_active(ns));
if (features[SPDK_NVME_FEAT_ERROR_RECOVERY].valid) {
unsigned tler = features[SPDK_NVME_FEAT_ERROR_RECOVERY].result & 0xFFFF;
printf("Error Recovery Timeout: ");
if (tler == 0) {
printf("Unlimited\n");
} else {
printf("%u milliseconds\n", tler * 100);
}
}
printf("Command Set Identifier: %s (%02Xh)\n",
csi_name(spdk_nvme_ns_get_csi(ns)), spdk_nvme_ns_get_csi(ns));
printf("Deallocate: %s\n",
@ -1014,6 +1049,10 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
printf(" Atomic Write Unit (PFail): %d\n", nsdata->nawupf + 1);
}
if (nsdata->npwg) {
printf(" Preferred Write Granularity: %d\n", nsdata->npwg + 1);
}
if (nsdata->nacwu) {
printf(" Atomic Compare & Write Unit: %d\n", nsdata->nacwu + 1);
}
@ -1023,6 +1062,12 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
printf(" Atomic Boundary Offset: %d\n", nsdata->nabo);
}
if (cdata->oncs.copy) {
printf("Maximum Single Source Range Length: %d\n", nsdata->mssrl);
printf("Maximum Copy Length: %d\n", nsdata->mcl);
printf("Maximum Source Range Count: %d\n", nsdata->msrc + 1);
}
printf("NGUID/EUI64 Never Reused: %s\n",
nsdata->nsfeat.guid_never_reused ? "Yes" : "No");
@ -1179,7 +1224,10 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
struct spdk_pci_id pci_id;
uint32_t nsid;
uint64_t pmrsz;
struct spdk_nvme_ana_group_descriptor *desc;
uint8_t *orig_desc;
struct spdk_nvme_ana_group_descriptor *copied_desc;
uint32_t desc_size, copy_len;
cap = spdk_nvme_ctrlr_get_regs_cap(ctrlr);
vs = spdk_nvme_ctrlr_get_regs_vs(ctrlr);
@ -1194,7 +1242,7 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
* attempt GET_FEATURES when NOT targeting a
* Discovery Controller.
*/
get_features(ctrlr);
get_ctrlr_features(ctrlr);
}
get_log_pages(ctrlr);
@ -1246,7 +1294,7 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
cdata->ieee[0], cdata->ieee[1], cdata->ieee[2]);
printf("Multi-path I/O\n");
printf(" May have multiple subsystem ports: %s\n", cdata->cmic.multi_port ? "Yes" : "No");
printf(" May be connected to multiple hosts: %s\n", cdata->cmic.multi_host ? "Yes" : "No");
printf(" May have multiple controllers: %s\n", cdata->cmic.multi_ctrlr ? "Yes" : "No");
printf(" Associated with SR-IOV VF: %s\n", cdata->cmic.sr_iov ? "Yes" : "No");
printf("Max Data Transfer Size: ");
if (cdata->mdts == 0) {
@ -1255,15 +1303,6 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
printf("%" PRIu64 "\n", (uint64_t)1 << (12 + cap.bits.mpsmin + cdata->mdts));
}
printf("Max Number of Namespaces: %d\n", cdata->nn);
if (features[SPDK_NVME_FEAT_ERROR_RECOVERY].valid) {
unsigned tler = features[SPDK_NVME_FEAT_ERROR_RECOVERY].result & 0xFFFF;
printf("Error Recovery Timeout: ");
if (tler == 0) {
printf("Unlimited\n");
} else {
printf("%u milliseconds\n", tler * 100);
}
}
printf("NVMe Specification Version (VS): %u.%u", vs.bits.mjr, vs.bits.mnr);
if (vs.bits.ter) {
printf(".%u", vs.bits.ter);
@ -1459,6 +1498,8 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
cdata->oncs.reservations ? "Supported" : "Not Supported");
printf("Timestamp: %s\n",
cdata->oncs.timestamp ? "Supported" : "Not Supported");
printf("Copy: %s\n",
cdata->oncs.copy ? "Supported" : "Not Supported");
printf("Volatile Write Cache: %s\n",
cdata->vwc.present ? "Present" : "Not Present");
printf("Atomic Write Unit (Normal): %d\n", cdata->awun + 1);
@ -1527,21 +1568,29 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
printf("Change Count : %" PRIx64 "\n", g_ana_log_page->change_count);
printf("Number of ANA Group Descriptors : %u\n", g_ana_log_page->num_ana_group_desc);
desc = (void *)((uint8_t *)g_ana_log_page + sizeof(struct spdk_nvme_ana_page));
copied_desc = g_copied_ana_desc;
orig_desc = (uint8_t *)g_ana_log_page + sizeof(struct spdk_nvme_ana_page);
copy_len = g_ana_log_page_size - sizeof(struct spdk_nvme_ana_page);
for (i = 0; i < g_ana_log_page->num_ana_group_desc; i++) {
memcpy(copied_desc, orig_desc, copy_len);
printf("ANA Group Descriptor : %u\n", i);
printf(" ANA Group ID : %u\n", desc->ana_group_id);
printf(" Number of NSID Values : %u\n", desc->num_of_nsid);
printf(" Change Count : %" PRIx64 "\n", desc->change_count);
printf(" ANA State : %u\n", desc->ana_state);
for (j = 0; j < desc->num_of_nsid; j++) {
printf(" Namespace Identifier : %u\n", desc->nsid[j]);
printf(" ANA Group ID : %u\n", copied_desc->ana_group_id);
printf(" Number of NSID Values : %u\n", copied_desc->num_of_nsid);
printf(" Change Count : %" PRIx64 "\n", copied_desc->change_count);
printf(" ANA State : %u\n", copied_desc->ana_state);
for (j = 0; j < copied_desc->num_of_nsid; j++) {
printf(" Namespace Identifier : %u\n", copied_desc->nsid[j]);
}
desc = (void *)((uint8_t *)desc + sizeof(struct spdk_nvme_ana_group_descriptor) +
desc->num_of_nsid * sizeof(uint32_t));
desc_size = sizeof(struct spdk_nvme_ana_group_descriptor) +
copied_desc->num_of_nsid * sizeof(uint32_t);
orig_desc += desc_size;
copy_len -= desc_size;
}
free(g_ana_log_page);
free(g_copied_ana_desc);
}
printf("\n");
@ -1647,18 +1696,18 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
printf("Number of Power States: %u\n", cdata->npss + 1);
printf("Current Power State: Power State #%u\n", ps);
for (i = 0; i <= cdata->npss; i++) {
const struct spdk_nvme_power_state *psd = &cdata->psd[i];
const struct spdk_nvme_power_state psd = cdata->psd[i];
printf("Power State #%u: ", i);
if (psd->mps) {
if (psd.mps) {
/* MP scale is 0.0001 W */
printf("Max Power: %u.%04u W\n",
psd->mp / 10000,
psd->mp % 10000);
psd.mp / 10000,
psd.mp % 10000);
} else {
/* MP scale is 0.01 W */
printf("Max Power: %3u.%02u W\n",
psd->mp / 100,
psd->mp % 100);
psd.mp / 100,
psd.mp % 100);
}
/* TODO: print other power state descriptor fields */
}
@ -1943,6 +1992,7 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
printf("=================\n");
for (nsid = spdk_nvme_ctrlr_get_first_active_ns(ctrlr);
nsid != 0; nsid = spdk_nvme_ctrlr_get_next_active_ns(ctrlr, nsid)) {
get_ns_features(ctrlr, nsid);
print_namespace(ctrlr, spdk_nvme_ctrlr_get_ns(ctrlr, nsid));
}
@ -2174,7 +2224,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
{
g_controllers_found++;
print_controller(ctrlr, trid);
spdk_nvme_detach(ctrlr);
spdk_nvme_detach_async(ctrlr, &g_detach_ctx);
}
int main(int argc, char **argv)
@ -2223,12 +2273,16 @@ int main(int argc, char **argv)
g_controllers_found++;
print_controller(ctrlr, &g_trid);
spdk_nvme_detach(ctrlr);
spdk_nvme_detach_async(ctrlr, &g_detach_ctx);
} else if (spdk_nvme_probe(&g_trid, NULL, probe_cb, attach_cb, NULL) != 0) {
fprintf(stderr, "spdk_nvme_probe() failed\n");
return 1;
}
if (g_detach_ctx) {
spdk_nvme_detach_poll(g_detach_ctx);
}
if (g_controllers_found == 0) {
fprintf(stderr, "No NVMe controllers found.\n");
}

View File

@ -1700,8 +1700,8 @@ int main(int argc, char **argv)
spdk_nvme_detach_async(dev->ctrlr, &detach_ctx);
}
while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
;
if (detach_ctx) {
spdk_nvme_detach_poll(detach_ctx);
}
return 0;

View File

@ -5,6 +5,7 @@
* All rights reserved.
*
* Copyright (c) 2019-2021 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -49,6 +50,7 @@
#include "spdk/log.h"
#include "spdk/likely.h"
#include "spdk/sock.h"
#include "spdk/zipf.h"
#ifdef SPDK_CONFIG_URING
#include <liburing.h>
@ -105,6 +107,8 @@ struct ns_entry {
uint32_t block_size;
uint32_t md_size;
bool md_interleave;
unsigned int seed;
struct spdk_zipf *zipf;
bool pi_loc;
enum spdk_nvme_pi_type pi_type;
uint32_t io_flags;
@ -267,6 +271,7 @@ static bool g_exit;
/* Default to 10 seconds for the keep alive value. This value is arbitrary. */
static uint32_t g_keep_alive_timeout_in_ms = 10000;
static uint32_t g_quiet_count = 1;
static double g_zipf_theta;
/* When user specifies -Q, some error messages are rate limited. When rate
* limited, we only print the error message every g_quiet_count times the
@ -334,7 +339,7 @@ perf_set_sock_zcopy(const char *impl_name, bool enable)
opts_size = sizeof(sock_opts);
}
sock_opts.enable_zerocopy_send = enable;
sock_opts.enable_zerocopy_send_client = enable;
if (spdk_sock_impl_set_opts(impl_name, &sock_opts, opts_size)) {
fprintf(stderr, "Failed to %s zcopy send for sock impl %s: error %d (%s)\n",
@ -725,6 +730,10 @@ register_file(const char *path)
entry->size_in_ios = size / g_io_size_bytes;
entry->io_size_blocks = g_io_size_bytes / blklen;
if (g_is_random && g_zipf_theta > 0) {
entry->zipf = spdk_zipf_create(entry->size_in_ios, g_zipf_theta, 0);
}
snprintf(entry->name, sizeof(entry->name), "%s", path);
g_num_namespaces++;
@ -1212,6 +1221,10 @@ register_ns(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
entry->size_in_ios = ns_size / g_io_size_bytes;
entry->io_size_blocks = g_io_size_bytes / sector_size;
if (g_is_random && g_zipf_theta > 0) {
entry->zipf = spdk_zipf_create(entry->size_in_ios, g_zipf_theta, 0);
}
entry->block_size = spdk_nvme_ns_get_extended_sector_size(ns);
entry->md_size = spdk_nvme_ns_get_md_size(ns);
entry->md_interleave = spdk_nvme_ns_supports_extended_lba(ns);
@ -1252,6 +1265,7 @@ unregister_namespaces(void)
TAILQ_FOREACH_SAFE(entry, &g_namespaces, link, tmp) {
TAILQ_REMOVE(&g_namespaces, entry, link);
spdk_zipf_free(&entry->zipf);
free(entry);
}
}
@ -1340,8 +1354,6 @@ register_ctrlr(struct spdk_nvme_ctrlr *ctrlr, struct trid_entry *trid_entry)
}
}
static __thread unsigned int seed = 0;
static inline void
submit_single_io(struct perf_task *task)
{
@ -1350,8 +1362,10 @@ submit_single_io(struct perf_task *task)
struct ns_worker_ctx *ns_ctx = task->ns_ctx;
struct ns_entry *entry = ns_ctx->entry;
if (g_is_random) {
offset_in_ios = rand_r(&seed) % entry->size_in_ios;
if (entry->zipf) {
offset_in_ios = spdk_zipf_generate(entry->zipf);
} else if (g_is_random) {
offset_in_ios = rand_r(&entry->seed) % entry->size_in_ios;
} else {
offset_in_ios = ns_ctx->offset_in_ios++;
if (ns_ctx->offset_in_ios == entry->size_in_ios) {
@ -1362,7 +1376,7 @@ submit_single_io(struct perf_task *task)
task->submit_tsc = spdk_get_ticks();
if ((g_rw_percentage == 100) ||
(g_rw_percentage != 0 && ((rand_r(&seed) % 100) < g_rw_percentage))) {
(g_rw_percentage != 0 && ((rand_r(&entry->seed) % 100) < g_rw_percentage))) {
task->is_read = true;
} else {
task->is_read = false;
@ -1526,13 +1540,13 @@ print_periodic_performance(bool warmup)
if (g_monitor_perf_cores) {
core_busy_tsc += busy_tsc;
core_idle_tsc += idle_tsc;
core_busy_perc += (double)core_busy_tsc / (core_idle_tsc + core_busy_tsc) * 100;
}
}
mb_this_second = (double)io_this_second * g_io_size_bytes / (1024 * 1024);
printf("%s%9ju IOPS, %8.2f MiB/s", warmup ? "[warmup] " : "", io_this_second, mb_this_second);
if (g_monitor_perf_cores) {
core_busy_perc = (double)core_busy_tsc / (core_idle_tsc + core_busy_tsc) * 100;
printf("%3d Core(s): %6.2f%% Busy", g_num_workers, core_busy_perc);
}
printf("\r");
@ -1698,6 +1712,7 @@ static void usage(char *program_name)
printf("\t[-w, --io-pattern <pattern> io pattern type, must be one of\n");
printf("\t\t(read, write, randread, randwrite, rw, randrw)]\n");
printf("\t[-M, --rwmixread <0-100> rwmixread (100 for reads, 0 for writes)]\n");
printf("\t[-F, --zipf <theta> use zipf distribution for random I/O\n");
printf("\t[-L, --enable-sw-latency-tracking enable latency tracking via sw, default: disabled]\n");
printf("\t\t-L for latency summary, -LL for detailed histogram\n");
printf("\t[-l, --enable-ssd-latency-tracking enable latency tracking via ssd (if supported), default: disabled]\n");
@ -1751,9 +1766,9 @@ static void usage(char *program_name)
printf("\t[-G, --enable-debug enable debug logging]\n");
#else
printf("\t[-G, --enable-debug enable debug logging (flag disabled, must reconfigure with --enable-debug)\n");
#endif
printf("\t[--transport-stats dump transport statistics]\n");
printf("\t[--iova-mode <mode> specify DPDK IOVA mode: va|pa]\n");
#endif
}
static void
@ -2170,7 +2185,7 @@ parse_metadata(const char *metacfg_str)
return 0;
}
#define PERF_GETOPT_SHORT "a:b:c:e:gi:lmo:q:r:k:s:t:w:z:A:C:DGHILM:NO:P:Q:RS:T:U:VZ:"
#define PERF_GETOPT_SHORT "a:b:c:e:gi:lmo:q:r:k:s:t:w:z:A:C:DF:GHILM:NO:P:Q:RS:T:U:VZ:"
static const struct option g_perf_cmdline_opts[] = {
#define PERF_WARMUP_TIME 'a'
@ -2211,6 +2226,8 @@ static const struct option g_perf_cmdline_opts[] = {
{"max-completion-per-poll", required_argument, NULL, PERF_MAX_COMPLETIONS_PER_POLL},
#define PERF_DISABLE_SQ_CMB 'D'
{"disable-sq-cmb", no_argument, NULL, PERF_DISABLE_SQ_CMB},
#define PERF_ZIPF 'F'
{"zipf", required_argument, NULL, PERF_ZIPF},
#define PERF_ENABLE_DEBUG 'G'
{"enable-debug", no_argument, NULL, PERF_ENABLE_DEBUG},
#define PERF_ENABLE_TCP_HDGST 'H'
@ -2255,6 +2272,7 @@ parse_args(int argc, char **argv, struct spdk_env_opts *env_opts)
int op, long_idx;
long int val;
int rc;
char *endptr;
while ((op = getopt_long(argc, argv, PERF_GETOPT_SHORT, g_perf_cmdline_opts, &long_idx)) != -1) {
switch (op) {
@ -2330,6 +2348,14 @@ parse_args(int argc, char **argv, struct spdk_env_opts *env_opts)
break;
}
break;
case PERF_ZIPF:
errno = 0;
g_zipf_theta = strtod(optarg, &endptr);
if (errno || optarg == endptr || g_zipf_theta < 0) {
fprintf(stderr, "Illegal zipf theta value %s\n", optarg);
return 1;
}
break;
case PERF_ALLOWED_PCI_ADDR:
if (add_allowed_pci_device(optarg, env_opts)) {
usage(argv[0]);
@ -2575,6 +2601,11 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
}
}
if (trid->trtype != trid_entry->trid.trtype &&
strcasecmp(trid->trstring, trid_entry->trid.trstring)) {
return false;
}
/* Set io_queue_size to UINT16_MAX, NVMe driver
* will then reduce this to MQES to maximize
* the io_queue_size as much as possible.
@ -2675,8 +2706,8 @@ unregister_controllers(void)
free(entry);
}
while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
;
if (detach_ctx) {
spdk_nvme_detach_poll(detach_ctx);
}
if (g_vmd) {

View File

@ -351,8 +351,8 @@ cleanup(void)
spdk_nvme_detach_async(g_config.pmr_dev.ctrlr, &detach_ctx);
while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
;
if (detach_ctx) {
spdk_nvme_detach_poll(detach_ctx);
}
}

View File

@ -970,8 +970,8 @@ unregister_controllers(void)
free(entry);
}
while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
;
if (detach_ctx) {
spdk_nvme_detach_poll(detach_ctx);
}
}

View File

@ -38,6 +38,6 @@ include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
APP := nvmf
C_SRCS := nvmf.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event_bdev nvmf
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event event_bdev nvmf
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -32,8 +32,10 @@
*/
#include "spdk/stdinc.h"
#include "spdk/env.h"
#include "spdk/event.h"
#include "spdk/init.h"
#include "spdk/string.h"
#include "spdk/thread.h"
#include "spdk/bdev.h"

View File

@ -38,6 +38,6 @@ APP = hello_sock
C_SRCS := hello_sock.c
SPDK_LIB_LIST = $(SOCK_MODULES_LIST)
SPDK_LIB_LIST += event_net sock
SPDK_LIB_LIST += event sock
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -39,7 +39,6 @@
#include "spdk/string.h"
#include "spdk/sock.h"
#include "spdk/net.h"
#define ACCEPT_TIMEOUT_US 1000
#define CLOSE_TIMEOUT_US 1000000

47
examples/util/Makefile Normal file
View File

@ -0,0 +1,47 @@
#
# BSD LICENSE
#
# Copyright (c) Intel Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y += zipf
.PHONY: all clean $(DIRS-y)
all: $(DIRS-y)
@:
clean: $(DIRS-y)
@:
include $(SPDK_ROOT_DIR)/mk/spdk.subdirs.mk

View File

@ -0,0 +1,42 @@
#
# Copyright (c) Intel Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
APP = zipf
C_SRCS := zipf.c
SPDK_LIB_LIST = util
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

102
examples/util/zipf/zipf.c Normal file
View File

@ -0,0 +1,102 @@
/*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "spdk/stdinc.h"
#include "spdk/zipf.h"
#include "spdk/histogram_data.h"
#include "spdk/string.h"
static void
usage(const char *prog)
{
printf("usage: %s <theta> <range> <count>\n", prog);
}
static void
print_bucket(void *ctx, uint64_t start, uint64_t end, uint64_t count,
uint64_t total, uint64_t so_far)
{
double so_far_pct;
char range[64];
if (count == 0) {
return;
}
so_far_pct = (double)so_far * 100 / total;
snprintf(range, sizeof(range), "[%ju, %ju)", start, end);
printf("%24s: %9.4f%% (%9ju)\n", range, so_far_pct, count);
}
int
main(int argc, char **argv)
{
struct spdk_zipf *zipf;
struct spdk_histogram_data *h;
float theta;
int range, count, i;
if (argc < 4) {
usage(argv[0]);
return 1;
}
theta = atof(argv[1]);
range = spdk_strtol(argv[2], 10);
count = spdk_strtol(argv[3], 10);
if (range <= 0 || count <= 0) {
printf("range and count must be positive integers\n");
usage(argv[0]);
return 1;
}
zipf = spdk_zipf_create(range, theta, time(NULL));
h = spdk_histogram_data_alloc();
if (zipf == NULL || h == NULL) {
spdk_zipf_free(&zipf);
spdk_histogram_data_free(h);
printf("out of resource\n");
return 1;
}
for (i = 0; i < count; i++) {
spdk_histogram_data_tally(h, spdk_zipf_generate(zipf));
}
spdk_histogram_data_iterate(h, print_bucket, NULL);
spdk_histogram_data_free(h);
spdk_zipf_free(&zipf);
return 0;
}

View File

@ -51,6 +51,7 @@ enum accel_capability {
ACCEL_COMPARE = 1 << 3,
ACCEL_CRC32C = 1 << 4,
ACCEL_DIF = 1 << 5,
ACCEL_COPY_CRC32C = 1 << 6,
};
/**
@ -302,7 +303,7 @@ int spdk_accel_submit_fill(struct spdk_io_channel *ch, void *dst, uint8_t fill,
*
* \param ch I/O channel associated with this call.
* \param batch Handle provided when the batch was started with spdk_accel_batch_create().
* \param dst Destination to write the CRC-32C to.
* \param crc_dst Destination to write the CRC-32C to.
* \param src The source address for the data.
* \param seed Four byte seed value.
* \param nbytes Length in bytes.
@ -312,7 +313,7 @@ int spdk_accel_submit_fill(struct spdk_io_channel *ch, void *dst, uint8_t fill,
* \return 0 on success, negative errno on failure.
*/
int spdk_accel_batch_prep_crc32c(struct spdk_io_channel *ch, struct spdk_accel_batch *batch,
uint32_t *dst, void *src, uint32_t seed, uint64_t nbytes,
uint32_t *crc_dst, void *src, uint32_t seed, uint64_t nbytes,
spdk_accel_completion_cb cb_fn, void *cb_arg);
/**
@ -323,7 +324,7 @@ int spdk_accel_batch_prep_crc32c(struct spdk_io_channel *ch, struct spdk_accel_b
*
* \param ch I/O channel associated with this call.
* \param batch Handle provided when the batch was started with spdk_accel_batch_create().
* \param dst Destination to write the CRC-32C to.
* \param crc_dst Destination to write the CRC-32C to.
* \param iovs The io vector array which stores the src data and len.
* \param iovcnt The size of the iov.
* \param seed Four byte seed value.
@ -333,16 +334,38 @@ int spdk_accel_batch_prep_crc32c(struct spdk_io_channel *ch, struct spdk_accel_b
* \return 0 on success, negative errno on failure.
*/
int spdk_accel_batch_prep_crc32cv(struct spdk_io_channel *ch, struct spdk_accel_batch *batch,
uint32_t *dst, struct iovec *iovs, uint32_t iovcnt, uint32_t seed,
uint32_t *crc_dst, struct iovec *iovs, uint32_t iovcnt, uint32_t seed,
spdk_accel_completion_cb cb_fn, void *cb_arg);
/**
* Synchronous call to prepare a copy + crc32c request into a previously initialized batch
* created with spdk_accel_batch_create(). The callback will be called when the operation
* completes after the batch has been submitted by an asynchronous call to
* spdk_accel_batch_submit().
*
* \param ch I/O channel associated with this call.
* \param batch Handle provided when the batch was started with spdk_accel_batch_create().
* \param dst Destination to write the data to.
* \param src The source address for the data.
* \param crc_dst Destination to write the CRC-32C to.
* \param seed Four byte seed value.
* \param nbytes Length in bytes.
* \param cb_fn Called when this operation completes.
* \param cb_arg Callback argument.
*
* \return 0 on success, negative errno on failure.
*/
int spdk_accel_batch_prep_copy_crc32c(struct spdk_io_channel *ch, struct spdk_accel_batch *batch,
void *dst, void *src, uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
spdk_accel_completion_cb cb_fn, void *cb_arg);
/**
* Submit a CRC-32C calculation request.
*
* This operation will calculate the 4 byte CRC32-C for the given data.
*
* \param ch I/O channel associated with this call.
* \param dst Destination to write the CRC-32C to.
* \param crc_dst Destination to write the CRC-32C to.
* \param src The source address for the data.
* \param seed Four byte seed value.
* \param nbytes Length in bytes.
@ -351,7 +374,8 @@ int spdk_accel_batch_prep_crc32cv(struct spdk_io_channel *ch, struct spdk_accel_
*
* \return 0 on success, negative errno on failure.
*/
int spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *dst, void *src, uint32_t seed,
int spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *crc_dst, void *src,
uint32_t seed,
uint64_t nbytes, spdk_accel_completion_cb cb_fn, void *cb_arg);
/**
@ -360,7 +384,7 @@ int spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *dst, void *sr
* This operation will calculate the 4 byte CRC32-C for the given data.
*
* \param ch I/O channel associated with this call.
* \param dst Destination to write the CRC-32C to.
* \param crc_dst Destination to write the CRC-32C to.
* \param iovs The io vector array which stores the src data and len.
* \param iovcnt The size of the iov.
* \param seed Four byte seed value.
@ -369,9 +393,49 @@ int spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *dst, void *sr
*
* \return 0 on success, negative errno on failure.
*/
int spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *dst, struct iovec *iovs,
int spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *crc_dst, struct iovec *iovs,
uint32_t iovcnt, uint32_t seed, spdk_accel_completion_cb cb_fn, void *cb_arg);
/**
* Submit a copy with CRC-32C calculation request.
*
* This operation will copy data and calculate the 4 byte CRC32-C for the given data.
*
* \param ch I/O channel associated with this call.
* \param dst Destination to write the data to.
* \param src The source address for the data.
* \param crc_dst Destination to write the CRC-32C to.
* \param seed Four byte seed value.
* \param nbytes Length in bytes.
* \param cb_fn Called when this CRC-32C operation completes.
* \param cb_arg Callback argument.
*
* \return 0 on success, negative errno on failure.
*/
int spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *src,
uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
spdk_accel_completion_cb cb_fn, void *cb_arg);
/**
* Submit a chained copy + CRC-32C calculation request.
*
* This operation will calculate the 4 byte CRC32-C for the given data.
*
* \param ch I/O channel associated with this call.
* \param dst Destination to write the data to.
* \param src_iovs The io vector array which stores the src data and len.
* \param iovcnt The size of the io vectors.
* \param crc_dst Destination to write the CRC-32C to.
* \param seed Four byte seed value.
* \param cb_fn Called when this CRC-32C operation completes.
* \param cb_arg Callback argument.
*
* \return 0 on success, negative errno on failure.
*/
int spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst, struct iovec *src_iovs,
uint32_t iovcnt, uint32_t *crc_dst, uint32_t seed, spdk_accel_completion_cb cb_fn, void *cb_arg);
struct spdk_json_write_ctx;
/**

View File

@ -590,6 +590,14 @@ bool spdk_bdev_is_zoned(const struct spdk_bdev *bdev);
*/
uint32_t spdk_bdev_get_data_block_size(const struct spdk_bdev *bdev);
/**
* Get block device physical block size.
*
* \param bdev Block device to query.
* \return Size of physical block size for this bdev in bytes.
*/
uint32_t spdk_bdev_get_physical_block_size(const struct spdk_bdev *bdev);
/**
* Get DIF type of the block device.
*
@ -795,7 +803,7 @@ int spdk_bdev_read_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *c
* * -ENOMEM - spdk_bdev_io buffer cannot be allocated
*/
int spdk_bdev_read_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
void *buf, void *md, int64_t offset_blocks, uint64_t num_blocks,
void *buf, void *md, uint64_t offset_blocks, uint64_t num_blocks,
spdk_bdev_io_completion_cb cb, void *cb_arg);
/**
@ -1218,6 +1226,8 @@ int spdk_bdev_comparev_and_writev_blocks(struct spdk_bdev_desc *desc, struct spd
*
* \param desc Block device descriptor
* \param ch I/O channel. Obtained by calling spdk_bdev_get_io_channel().
* \param iov A scatter gather list to be populated with the buffers
* \param iovcnt The maximum number of elements in iov.
* \param offset_blocks The offset, in blocks, from the start of the block device.
* \param num_blocks The number of blocks.
* \param populate Whether the data buffer should be populated with the
@ -1231,11 +1241,11 @@ int spdk_bdev_comparev_and_writev_blocks(struct spdk_bdev_desc *desc, struct spd
* negated errno on failure, in which case the callback will not be called.
*/
int spdk_bdev_zcopy_start(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
struct iovec *iov, int iovcnt,
uint64_t offset_blocks, uint64_t num_blocks,
bool populate,
spdk_bdev_io_completion_cb cb, void *cb_arg);
/**
* Submit a request to release a data buffer representing a range of blocks.
*

View File

@ -47,6 +47,7 @@
#include "spdk/queue.h"
#include "spdk/scsi_spec.h"
#include "spdk/thread.h"
#include "spdk/tree.h"
#include "spdk/util.h"
#include "spdk/uuid.h"
@ -161,6 +162,36 @@ struct spdk_bdev_module {
} internal;
};
/**
* Called by a bdev module to lay exclusive write claim to a bdev.
*
* Also upgrades that bdev's descriptor to have write access.
*
* \param bdev Block device to be claimed.
* \param desc Descriptor for the above block device.
* \param module Bdev module attempting to claim bdev.
*
* \return 0 on success
* \return -EPERM if the bdev is already claimed by another module.
*/
int spdk_bdev_module_claim_bdev(struct spdk_bdev *bdev, struct spdk_bdev_desc *desc,
struct spdk_bdev_module *module);
/**
* Called to release a write claim on a block device.
*
* \param bdev Block device to be released.
*/
void spdk_bdev_module_release_bdev(struct spdk_bdev *bdev);
/* Libraries may define __SPDK_BDEV_MODULE_ONLY so that they include
* only the struct spdk_bdev_module definition, and the relevant APIs
* to claim/release a bdev. This may be useful in some cases to avoid
* abidiff errors related to including the struct spdk_bdev structure
* unnecessarily.
*/
#ifndef __SPDK_BDEV_MODULE_ONLY
typedef void (*spdk_bdev_unregister_cb)(void *cb_arg, int rc);
/**
@ -237,8 +268,14 @@ enum spdk_bdev_io_status {
SPDK_BDEV_IO_STATUS_SUCCESS = 1,
};
struct spdk_bdev_name {
char *name;
struct spdk_bdev *bdev;
RB_ENTRY(spdk_bdev_name) node;
};
struct spdk_bdev_alias {
char *alias;
struct spdk_bdev_name alias;
TAILQ_ENTRY(spdk_bdev_alias) tailq;
};
@ -265,6 +302,9 @@ struct spdk_bdev {
/** Size in bytes of a logical block for the backend */
uint32_t blocklen;
/** Size in bytes of a physical block for the backend */
uint32_t phys_blocklen;
/** Number of blocks */
uint64_t blockcnt;
@ -310,6 +350,15 @@ struct spdk_bdev {
/* Maximum number of segments in a I/O */
uint32_t max_num_segments;
/* Maximum unmap in unit of logical block */
uint32_t max_unmap;
/* Maximum unmap block segments */
uint32_t max_unmap_segments;
/* Maximum write zeroes in unit of logical block */
uint32_t max_write_zeroes;
/**
* UUID for this bdev.
*
@ -462,6 +511,9 @@ struct spdk_bdev {
* locked due to overlapping with another locked range.
*/
lba_range_tailq_t pending_locked_ranges;
/** Bdev name used for quick lookup */
struct spdk_bdev_name bdev_name;
} internal;
};
@ -766,28 +818,6 @@ void spdk_bdev_module_init_done(struct spdk_bdev_module *module);
*/
void spdk_bdev_module_finish_done(void);
/**
* Called by a bdev module to lay exclusive write claim to a bdev.
*
* Also upgrades that bdev's descriptor to have write access.
*
* \param bdev Block device to be claimed.
* \param desc Descriptor for the above block device.
* \param module Bdev module attempting to claim bdev.
*
* \return 0 on success
* \return -EPERM if the bdev is already claimed by another module.
*/
int spdk_bdev_module_claim_bdev(struct spdk_bdev *bdev, struct spdk_bdev_desc *desc,
struct spdk_bdev_module *module);
/**
* Called to release a write claim on a block device.
*
* \param bdev Block device to be released.
*/
void spdk_bdev_module_release_bdev(struct spdk_bdev *bdev);
/**
* Add alias to block device names list.
* Aliases can be add only to registered bdev.
@ -1227,4 +1257,6 @@ static void __attribute__((constructor)) _spdk_bdev_module_register_##name(void)
spdk_bdev_module_list_add(module); \
} \
#endif /* __SPDK_BDEV_MODULE_ONLY */
#endif /* SPDK_BDEV_MODULE_H */

View File

@ -66,6 +66,16 @@ uint32_t spdk_crc32_ieee_update(const void *buf, size_t len, uint32_t crc);
*/
uint32_t spdk_crc32c_update(const void *buf, size_t len, uint32_t crc);
/**
* Calculate a partial CRC-32C checksum.
*
* \param iov Data buffer vectors to checksum.
* \param iovcnt size of iov parameter.
* \param crc32c Previous CRC-32C value.
* \return Updated CRC-32C value.
*/
uint32_t spdk_crc32c_iov_update(struct iovec *iov, int iovcnt, uint32_t crc32c);
#ifdef __cplusplus
}
#endif

View File

@ -1343,7 +1343,7 @@ struct spdk_pci_event {
struct spdk_pci_addr traddr;
};
typedef void (*spdk_pci_error_handler)(siginfo_t *info, void *ctx);
typedef void (*spdk_pci_error_handler)(const void *failure_addr, void *ctx);
/**
* Begin listening for PCI bus events. This is used to detect hot-insert and

View File

@ -44,6 +44,7 @@
#include "spdk/stdinc.h"
#include "spdk/cpuset.h"
#include "spdk/init.h"
#include "spdk/queue.h"
#include "spdk/log.h"
#include "spdk/thread.h"
@ -82,8 +83,6 @@ typedef void (*spdk_app_shutdown_cb)(void);
*/
typedef void (*spdk_sighandler_t)(int signal);
#define SPDK_DEFAULT_RPC_ADDR "/var/tmp/spdk.sock"
/**
* \brief Event framework initialization options
*/

View File

@ -123,9 +123,7 @@ __spdk_histogram_data_get_bucket_range(struct spdk_histogram_data *h, uint64_t d
{
uint32_t clz, range;
assert(datapoint != 0);
clz = __builtin_clzll(datapoint);
clz = datapoint > 0 ? __builtin_clzll(datapoint) : 64;
if (clz <= SPDK_HISTOGRAM_BUCKET_LSB(h)) {
range = SPDK_HISTOGRAM_BUCKET_LSB(h) - clz;

View File

@ -69,14 +69,6 @@ struct idxd_batch;
*/
int spdk_idxd_configure_chan(struct spdk_idxd_io_channel *chan);
/**
* Reconfigures this channel based on how many current channels there are.
*
* \param chan IDXD channel to be set.
* \return 0 on success, negative errno on failure.
*/
int spdk_idxd_reconfigure_chan(struct spdk_idxd_io_channel *chan);
/**
* Signature for callback function invoked when a request is completed.
*
@ -86,26 +78,14 @@ int spdk_idxd_reconfigure_chan(struct spdk_idxd_io_channel *chan);
*/
typedef void (*spdk_idxd_req_cb)(void *arg, int status);
/**
* Callback for spdk_idxd_probe() enumeration.
*
* \param cb_ctx User-specified opaque value corresponding to cb_ctx from spdk_idxd_probe().
* \param pci_dev PCI device that is being probed.
*
* \return true to attach to this device.
*/
typedef bool (*spdk_idxd_probe_cb)(void *cb_ctx, struct spdk_pci_device *pci_dev);
/**
* Callback for spdk_idxd_probe() to report a device that has been attached to
* the userspace IDXD driver.
*
* \param cb_ctx User-specified opaque value corresponding to cb_ctx from spdk_idxd_probe().
* \param pci_dev PCI device that was attached to the driver.
* \param idxd IDXD device that was attached to the driver.
*/
typedef void (*spdk_idxd_attach_cb)(void *cb_ctx, struct spdk_pci_device *pci_dev,
struct spdk_idxd_device *idxd);
typedef void (*spdk_idxd_attach_cb)(void *cb_ctx, struct spdk_idxd_device *idxd);
/**
* Enumerate the IDXD devices attached to the system and attach the userspace
@ -119,13 +99,12 @@ typedef void (*spdk_idxd_attach_cb)(void *cb_ctx, struct spdk_pci_device *pci_de
*
* \param cb_ctx Opaque value which will be passed back in cb_ctx parameter of
* the callbacks.
* \param probe_cb will be called once per IDXD device found in the system.
* \param attach_cb will be called for devices for which probe_cb returned true
* once the IDXD controller has been attached to the userspace driver.
*
* \return 0 on success, -1 on failure.
*/
int spdk_idxd_probe(void *cb_ctx, spdk_idxd_probe_cb probe_cb, spdk_idxd_attach_cb attach_cb);
int spdk_idxd_probe(void *cb_ctx, spdk_idxd_attach_cb attach_cb);
/**
* Detach specified device returned by spdk_idxd_probe() from the IDXD driver.
@ -138,8 +117,9 @@ void spdk_idxd_detach(struct spdk_idxd_device *idxd);
* Sets the IDXD configuration.
*
* \param config_number the configuration number for a valid IDXD config.
* \param kernel_mode true if using kernel driver.
*/
void spdk_idxd_set_config(uint32_t config_number);
void spdk_idxd_set_config(uint32_t config_number, bool kernel_mode);
/**
* Return the max number of descriptors per batch for IDXD.
@ -352,7 +332,7 @@ int spdk_idxd_submit_fill(struct spdk_idxd_io_channel *chan,
*
* \param chan IDXD channel to submit request.
* \param batch Handle provided when the batch was started with spdk_idxd_batch_create().
* \param dst Resulting calculation.
* \param crc_dst Resulting calculation.
* \param src Source virtual address.
* \param seed Four byte CRC-32C seed value.
* \param nbytes Number of bytes to calculate on.
@ -363,7 +343,7 @@ int spdk_idxd_submit_fill(struct spdk_idxd_io_channel *chan,
* \return 0 on success, negative errno on failure.
*/
int spdk_idxd_batch_prep_crc32c(struct spdk_idxd_io_channel *chan, struct idxd_batch *batch,
uint32_t *dst, void *src, uint32_t seed, uint64_t nbytes,
uint32_t *crc_dst, void *src, uint32_t seed, uint64_t nbytes,
spdk_idxd_req_cb cb_fn, void *cb_arg);
/**
@ -373,7 +353,7 @@ int spdk_idxd_batch_prep_crc32c(struct spdk_idxd_io_channel *chan, struct idxd_b
* by writing to the proper device portal.
*
* \param chan IDXD channel to submit request.
* \param dst Resulting calculation.
* \param crc_dst Resulting calculation.
* \param src Source virtual address.
* \param seed Four byte CRC-32C seed value.
* \param nbytes Number of bytes to calculate on.
@ -383,10 +363,55 @@ int spdk_idxd_batch_prep_crc32c(struct spdk_idxd_io_channel *chan, struct idxd_b
*
* \return 0 on success, negative errno on failure.
*/
int spdk_idxd_submit_crc32c(struct spdk_idxd_io_channel *chan, uint32_t *dst, void *src,
int spdk_idxd_submit_crc32c(struct spdk_idxd_io_channel *chan, uint32_t *crc_dst, void *src,
uint32_t seed, uint64_t nbytes,
spdk_idxd_req_cb cb_fn, void *cb_arg);
/**
* Synchronous call to prepare a copy combined with crc32c request into a previously
* initialized batch created with spdk_idxd_batch_create(). The callback will be called
* when the copy + crc32c completes after the batch has been submitted by an asynchronous
* call to spdk_idxd_batch_submit().
*
* \param chan IDXD channel to submit request.
* \param batch Handle provided when the batch was started with spdk_idxd_batch_create().
* \param dst Destination virtual address.
* \param src Source virtual address.
* \param crc_dst Resulting calculation.
* \param seed Four byte CRC-32C seed value.
* \param nbytes Number of bytes to calculate on.
* \param cb_fn Callback function which will be called when the request is complete.
* \param cb_arg Opaque value which will be passed back as the arg parameter in
* the completion callback.
*
* \return 0 on success, negative errno on failure.
*/
int spdk_idxd_batch_prep_copy_crc32c(struct spdk_idxd_io_channel *chan, struct idxd_batch *batch,
void *dst, void *src, uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
spdk_idxd_req_cb cb_fn, void *cb_arg);
/**
* Build and submit a copy combined with CRC32-C request.
*
* This function will build the descriptor for copy plus CRC32-C and then immediately
* submit by writing to the proper device portal.
*
* \param chan IDXD channel to submit request.
* \param dst Destination virtual address.
* \param src Source virtual address.
* \param crc_dst Resulting calculation.
* \param seed Four byte CRC-32C seed value.
* \param nbytes Number of bytes to calculate on.
* \param cb_fn Callback function which will be called when the request is complete.
* \param cb_arg Opaque value which will be passed back as the cb_arg parameter
* in the completion callback.
*
* \return 0 on success, negative errno on failure.
*/
int spdk_idxd_submit_copy_crc32c(struct spdk_idxd_io_channel *chan, void *dst, void *src,
uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
spdk_idxd_req_cb cb_fn, void *cb_arg);
/**
* Check for completed requests on an IDXD channel.
*
@ -399,7 +424,6 @@ int spdk_idxd_process_events(struct spdk_idxd_io_channel *chan);
* Returns an IDXD channel for a given IDXD device.
*
* \param idxd IDXD device to get a channel for.
*
* \return pointer to an IDXD channel.
*/
struct spdk_idxd_io_channel *spdk_idxd_get_channel(struct spdk_idxd_device *idxd);
@ -408,17 +432,16 @@ struct spdk_idxd_io_channel *spdk_idxd_get_channel(struct spdk_idxd_device *idxd
* Free an IDXD channel.
*
* \param chan IDXD channel to free.
* \return true if the underlying device needs a rebalance
*/
bool spdk_idxd_put_channel(struct spdk_idxd_io_channel *chan);
void spdk_idxd_put_channel(struct spdk_idxd_io_channel *chan);
/**
* Determine if the idxd device needs rebalancing.
* Get the max number of outstanding operations supported by this channel.
*
* \param idxd IDXD device.
* \return true if rebalance is needed, false if not.
* \param chan IDXD channel to communicate on.
* \return max number of operations supported.
*/
bool spdk_idxd_device_needs_rebalance(struct spdk_idxd_device *idxd);
int spdk_idxd_chan_get_max_operations(struct spdk_idxd_io_channel *chan);
#ifdef __cplusplus
}

107
include/spdk/init.h Normal file
View File

@ -0,0 +1,107 @@
/*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \file
* SPDK Initialization Helper
*/
#ifndef SPDK_INIT_H
#define SPDK_INIT_H
#include "spdk/stdinc.h"
#include "spdk/queue.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SPDK_DEFAULT_RPC_ADDR "/var/tmp/spdk.sock"
/**
* Create the SPDK JSON-RPC server and listen at the provided address. The RPC server is optional and is
* independent of subsystem initialization. The RPC server can be started and stopped at any time.
*
* \param listen_addr Path to a unix domain socket to listen on
*
* \return Negated errno on failure. 0 on success.
*/
int spdk_rpc_initialize(const char *listen_addr);
/**
* Shut down the SPDK JSON-RPC target
*/
void spdk_rpc_finish(void);
typedef void (*spdk_subsystem_init_fn)(int rc, void *ctx);
/**
* Begin the initialization process for all SPDK subsystems. SPDK is divided into subsystems at a macro-level
* and each subsystem automatically registers itself with this library at start up using a C
* constructor. Further, each subsystem can declare other subsystems that it depends on.
* Calling this function will correctly initialize all subsystems that are present, in the
* required order.
*
* \param cb_fn Function called when the process is complete.
* \param cb_arg User context passed to cb_fn.
*/
void spdk_subsystem_init(spdk_subsystem_init_fn cb_fn, void *cb_arg);
/**
* Like spdk_subsystem_init, but additionally configure each subsystem using the provided JSON config
* file. This will automatically start a JSON RPC server and then stop it.
*
* \param json_config_file Path to a JSON config file.
* \param rpc_addr Path to a unix domain socket to send configuration RPCs to.
* \param cb_fn Function called when the process is complete.
* \param cb_arg User context passed to cb_fn.
* \param stop_on_error Whether to stop initialization if one of the JSON RPCs fails.
*/
void spdk_subsystem_init_from_json_config(const char *json_config_file, const char *rpc_addr,
spdk_subsystem_init_fn cb_fn, void *cb_arg,
bool stop_on_error);
typedef void (*spdk_subsystem_fini_fn)(void *ctx);
/**
* Tear down all of the subsystems in the correct order.
*
* \param cb_fn Function called when the process is complete.
* \param cb_arg User context passed to cb_fn
*/
void spdk_subsystem_fini(spdk_subsystem_fini_fn cb_fn, void *cb_arg);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -208,6 +208,7 @@ int spdk_json_write_int32(struct spdk_json_write_ctx *w, int32_t val);
int spdk_json_write_uint32(struct spdk_json_write_ctx *w, uint32_t val);
int spdk_json_write_int64(struct spdk_json_write_ctx *w, int64_t val);
int spdk_json_write_uint64(struct spdk_json_write_ctx *w, uint64_t val);
int spdk_json_write_uint128(struct spdk_json_write_ctx *w, uint64_t low_val, uint64_t high_val);
int spdk_json_write_string(struct spdk_json_write_ctx *w, const char *val);
int spdk_json_write_string_raw(struct spdk_json_write_ctx *w, const char *val, size_t len);
@ -257,6 +258,8 @@ int spdk_json_write_named_bool(struct spdk_json_write_ctx *w, const char *name,
int spdk_json_write_named_int32(struct spdk_json_write_ctx *w, const char *name, int32_t val);
int spdk_json_write_named_uint32(struct spdk_json_write_ctx *w, const char *name, uint32_t val);
int spdk_json_write_named_uint64(struct spdk_json_write_ctx *w, const char *name, uint64_t val);
int spdk_json_write_named_uint128(struct spdk_json_write_ctx *w, const char *name,
uint64_t low_val, uint64_t high_val);
int spdk_json_write_named_int64(struct spdk_json_write_ctx *w, const char *name, int64_t val);
int spdk_json_write_named_string(struct spdk_json_write_ctx *w, const char *name, const char *val);
int spdk_json_write_named_string_fmt(struct spdk_json_write_ctx *w, const char *name,

View File

@ -256,6 +256,14 @@ struct spdk_nvme_ctrlr_opts {
* this controller in microseconds.
*/
uint64_t fabrics_connect_timeout_us;
/**
* Disable reading ANA log page. The upper layer should reading ANA log page instead
* if set to true.
*
* Default is `false` (ANA log page is read).
*/
bool disable_read_ana_log_page;
};
/**
@ -297,6 +305,15 @@ struct spdk_nvme_accel_fn_table {
*/
bool spdk_nvme_ctrlr_is_discovery(struct spdk_nvme_ctrlr *ctrlr);
/**
* Indicate whether a ctrlr handle is associated with a fabrics controller.
*
* \param ctrlr Opaque handle to NVMe controller.
*
* \return true if a fabrics controller, else false.
*/
bool spdk_nvme_ctrlr_is_fabrics(struct spdk_nvme_ctrlr *ctrlr);
/**
* Get the default options for the creation of a specific NVMe controller.
*
@ -941,6 +958,13 @@ int spdk_nvme_detach_async(struct spdk_nvme_ctrlr *ctrlr,
*/
int spdk_nvme_detach_poll_async(struct spdk_nvme_detach_ctx *detach_ctx);
/**
* Continue calling spdk_nvme_detach_poll_async() internally until it returns 0.
*
* \param detach_ctx Context to track the detachment.
*/
void spdk_nvme_detach_poll(struct spdk_nvme_detach_ctx *detach_ctx);
/**
* Update the transport ID for a given controller.
*
@ -993,6 +1017,41 @@ void spdk_nvme_ctrlr_set_remove_cb(struct spdk_nvme_ctrlr *ctrlr,
*/
int spdk_nvme_ctrlr_reset(struct spdk_nvme_ctrlr *ctrlr);
struct spdk_nvme_ctrlr_reset_ctx;
/**
* Create a context object that can be polled to perform a full hardware reset of the NVMe controller.
*
* The function will set the controller reset context on success, user must call
* spdk_nvme_ctrlr_reset_poll_async() until it returns a value other than -EAGAIN.
*
* \param ctrlr Opaque handle to NVMe controller.
* \param reset_ctx Double pointer to reset context.
*
* \return 0 on success.
* \return -ENOMEM if context could not be allocated.
* \return -ENXIO if controller has been removed.
*
*/
int spdk_nvme_ctrlr_reset_async(struct spdk_nvme_ctrlr *ctrlr,
struct spdk_nvme_ctrlr_reset_ctx **reset_ctx);
/**
* Proceed with resetting contoller associated with the controller reset context.
*
* The controller reset context is one returned from a previous call to
* spdk_nvme_ctrlr_reset_async(). Users must call this function on the
* controller reset context until it returns a value other than -EAGAIN.
*
* \param ctrlr_reset_ctx Context used to track controller reset actions.
*
* \return 0 if all controller reset operations are complete; the ctrlr_reset_ctx
* is also freed and no longer valid.
* \return -EAGAIN if there are still pending controller reset operations; user must call
* spdk_nvme_ctrlr_reset_poll_async again to continue progress.
*/
int spdk_nvme_ctrlr_reset_poll_async(struct spdk_nvme_ctrlr_reset_ctx *ctrlr_reset_ctx);
/**
* Perform a NVMe subsystem reset.
*
@ -1278,12 +1337,14 @@ typedef void (*spdk_nvme_timeout_cb)(void *cb_arg,
* for timeout callback.
*
* \param ctrlr NVMe controller on which to monitor for timeout.
* \param timeout_us Timeout value in microseconds.
* \param timeout_io_us Timeout value in microseconds for io commands.
* \param timeout_admin_us Timeout value in microseconds for admin commands.
* \param cb_fn A function pointer that points to the callback function.
* \param cb_arg Argument to the callback function.
*/
void spdk_nvme_ctrlr_register_timeout_callback(struct spdk_nvme_ctrlr *ctrlr,
uint64_t timeout_us, spdk_nvme_timeout_cb cb_fn, void *cb_arg);
uint64_t timeout_io_us, uint64_t timeout_admin_us,
spdk_nvme_timeout_cb cb_fn, void *cb_arg);
/**
* NVMe I/O queue pair initialization options.
@ -1485,10 +1546,11 @@ spdk_nvme_qp_failure_reason spdk_nvme_ctrlr_get_admin_qp_failure_reason(
/**
* Free an I/O queue pair that was allocated by spdk_nvme_ctrlr_alloc_io_qpair().
*
* The qpair must not be accessed after calling this function.
*
* \param qpair I/O queue pair to free.
*
* \return 0 on success, -1 on failure. On failure, the caller should reset
* the controller and try to free the io qpair again after the reset.
* \return 0 on success. This function will never return any value other than 0.
*/
int spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair *qpair);
@ -2622,6 +2684,15 @@ enum spdk_nvme_dealloc_logical_block_read_value spdk_nvme_ns_get_dealloc_logical
*/
uint32_t spdk_nvme_ns_get_optimal_io_boundary(struct spdk_nvme_ns *ns);
/**
* Get the NGUID for the given namespace.
*
* \param ns Namespace to query.
*
* \return a pointer to namespace NGUID, or NULL if ns does not have a NGUID.
*/
const uint8_t *spdk_nvme_ns_get_nguid(const struct spdk_nvme_ns *ns);
/**
* Get the UUID for the given namespace.
*
@ -3062,6 +3133,40 @@ int spdk_nvme_ns_cmd_dataset_management(struct spdk_nvme_ns *ns, struct spdk_nvm
spdk_nvme_cmd_cb cb_fn,
void *cb_arg);
/**
* Submit a simple copy command request to the specified NVMe namespace.
*
* The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
* The user must ensure that only one thread submits I/O on a given qpair at any
* given time.
*
* This is a convenience wrapper that will automatically allocate and construct
* the correct data buffers. Therefore, ranges does not need to be allocated from
* pinned memory and can be placed on the stack. If a higher performance, zero-copy
* version of SCC is required, simply build and submit a raw command using
* spdk_nvme_ctrlr_cmd_io_raw().
*
* \param ns NVMe namespace to submit the SCC request
* \param qpair I/O queue pair to submit the request
* \param ranges An array of \ref spdk_nvme_scc_source_range elements describing the LBAs
* to operate on.
* \param num_ranges The number of elements in the ranges array.
* \param dest_lba Destination LBA to copy the data.
* \param cb_fn Callback function to invoke when the I/O is completed
* \param cb_arg Argument to pass to the callback function
*
* \return 0 if successfully submitted, negated errnos on the following error conditions:
* -ENOMEM: The request cannot be allocated.
* -EINVAL: Invalid ranges.
* -ENXIO: The qpair is failed at the transport level.
*/
int spdk_nvme_ns_cmd_copy(struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *qpair,
const struct spdk_nvme_scc_source_range *ranges,
uint16_t num_ranges,
uint64_t dest_lba,
spdk_nvme_cmd_cb cb_fn,
void *cb_arg);
/**
* Submit a flush request to the specified NVMe namespace.
*
@ -3527,25 +3632,6 @@ int spdk_nvme_cuse_register(struct spdk_nvme_ctrlr *ctrlr);
*/
int spdk_nvme_cuse_unregister(struct spdk_nvme_ctrlr *ctrlr);
int spdk_nvme_map_prps(void *prv, struct spdk_nvme_cmd *cmd, struct iovec *iovs,
uint32_t len, size_t mps,
void *(*gpa_to_vva)(void *prv, uint64_t addr, uint64_t len));
/**
* Map NVMe command data buffers sent from Virtual Machine to virtual addresses
*
*\param prv Opaque handle to gpa_to_vva callback
*\param cmd NVMe command
*\param iovs IO vectors used to point the data buffers in NVMe command
*\param max_iovcnt Maximum IO vectors that can be used
*\param len Total buffer length for the NVMe command
*\param mps Memory page size
*\param gpa_to_vva Callback to map memory from Guest Physical address to Virtual address
*/
int spdk_nvme_map_cmd(void *prv, struct spdk_nvme_cmd *cmd, struct iovec *iovs, uint32_t max_iovcnt,
uint32_t len, size_t mps,
void *(*gpa_to_vva)(void *prv, uint64_t addr, uint64_t len));
/**
* Opaque handle for a transport poll group. Used by the transport function table.
*/

View File

@ -72,6 +72,11 @@ extern "C" {
*/
#define SPDK_NVME_DATASET_MANAGEMENT_RANGE_MAX_BLOCKS 0xFFFFFFFFu
/**
* Maximum number of entries in the log page of Changed Namespace List.
*/
#define SPDK_NVME_MAX_CHANGED_NAMESPACES 1024
union spdk_nvme_cap_register {
uint64_t raw;
struct {
@ -461,6 +466,14 @@ union spdk_nvme_bpinfo_register {
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_bpinfo_register) == 4, "Incorrect size");
/** Boot read status values */
enum spdk_nvme_brs_value {
SPDK_NVME_BRS_NO_READ = 0x0,
SPDK_NVME_BRS_READ_IN_PROGRESS = 0x1,
SPDK_NVME_BRS_READ_SUCCESS = 0x2,
SPDK_NVME_BRS_READ_ERROR = 0x3,
};
/** Boot partition read select */
union spdk_nvme_bprsel_register {
uint32_t raw;
@ -1338,6 +1351,21 @@ struct spdk_nvme_dsm_range {
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_dsm_range) == 16, "Incorrect size");
/**
* Simple Copy Command source range
*/
struct spdk_nvme_scc_source_range {
uint64_t reserved0;
uint64_t slba;
uint16_t nlb;
uint16_t reserved18;
uint32_t reserved20;
uint32_t eilbrt;
uint16_t elbat;
uint16_t elbatm;
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_scc_source_range) == 32, "Incorrect size");
/**
* Status code types
*/
@ -1386,6 +1414,9 @@ enum spdk_nvme_generic_command_status_code {
SPDK_NVME_SC_SANITIZE_IN_PROGRESS = 0x1d,
SPDK_NVME_SC_SGL_DATA_BLOCK_GRANULARITY_INVALID = 0x1e,
SPDK_NVME_SC_COMMAND_INVALID_IN_CMB = 0x1f,
SPDK_NVME_SC_COMMAND_NAMESPACE_IS_PROTECTED = 0x20,
SPDK_NVME_SC_COMMAND_INTERRUPTED = 0x21,
SPDK_NVME_SC_COMMAND_TRANSIENT_TRANSPORT_ERROR = 0x22,
SPDK_NVME_SC_LBA_OUT_OF_RANGE = 0x80,
SPDK_NVME_SC_CAPACITY_EXCEEDED = 0x81,
@ -1443,6 +1474,7 @@ enum spdk_nvme_command_specific_status_code {
SPDK_NVME_SC_CONFLICTING_ATTRIBUTES = 0x80,
SPDK_NVME_SC_INVALID_PROTECTION_INFO = 0x81,
SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_RANGE = 0x82,
SPDK_NVME_SC_CMD_SIZE_LIMIT_SIZE_EXCEEDED = 0x83,
};
/**
@ -1539,6 +1571,8 @@ enum spdk_nvme_nvm_opcode {
SPDK_NVME_OPC_RESERVATION_ACQUIRE = 0x11,
SPDK_NVME_OPC_RESERVATION_RELEASE = 0x15,
SPDK_NVME_OPC_COPY = 0x19,
};
/**
@ -1822,7 +1856,7 @@ struct spdk_nvme_cdata_sgls {
uint32_t reserved2 : 10;
};
struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_ctrlr_data {
struct __attribute__((packed)) spdk_nvme_ctrlr_data {
/* bytes 0-255: controller capabilities and features */
/** pci vendor id */
@ -1849,7 +1883,7 @@ struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_ctrlr_data {
/** controller multi-path I/O and namespace sharing capabilities */
struct {
uint8_t multi_port : 1;
uint8_t multi_host : 1;
uint8_t multi_ctrlr : 1;
uint8_t sr_iov : 1;
uint8_t ana_reporting : 1;
uint8_t reserved : 4;
@ -2149,7 +2183,9 @@ struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_ctrlr_data {
uint16_t set_features_save: 1;
uint16_t reservations: 1;
uint16_t timestamp: 1;
uint16_t reserved: 9;
uint16_t verify: 1;
uint16_t copy: 1;
uint16_t reserved9: 7;
} oncs;
/** fused operation support */
@ -2187,7 +2223,12 @@ struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_ctrlr_data {
/** atomic compare & write unit */
uint16_t acwu;
uint16_t reserved534;
/** optional copy formats supported */
struct {
uint16_t copy_format0 : 1;
uint16_t reserved1: 15;
} ocfs;
struct spdk_nvme_cdata_sgls sgls;
@ -2479,7 +2520,16 @@ struct spdk_nvme_ns_data {
/** Namespace Optimal Write Size */
uint16_t nows;
uint8_t reserved64[18];
/** Maximum Single Source Range Length */
uint16_t mssrl;
/** Maximum Copy Length */
uint32_t mcl;
/** Maximum Source Range Count */
uint8_t msrc;
uint8_t reserved64[11];
/** ANA group identifier */
uint32_t anagrpid;
@ -2794,8 +2844,12 @@ enum spdk_nvme_log_page {
/* 0x81-0xBF - I/O command set specific */
/* 0xC0-0xFF - vendor specific */
SPDK_NVME_LOG_VENDOR_SPECIFIC_START = 0xc0,
SPDK_NVME_LOG_VENDOR_SPECIFIC_END = 0xff,
};
#define spdk_nvme_log_page_is_vendor_specific(lid) ((lid) >= SPDK_NVME_LOG_VENDOR_SPECIFIC_START)
/**
* Error information log page (\ref SPDK_NVME_LOG_ERROR)
*/
@ -3284,6 +3338,16 @@ enum spdk_nvme_fw_commit_action {
* requested to be activated immediately without reset.
*/
SPDK_NVME_FW_COMMIT_RUN_IMG = 0x3,
/**
* Downloaded image replaces the Boot Partition specified by
* the Boot Partition ID field.
*/
SPDK_NVME_FW_COMMIT_REPLACE_BOOT_PARTITION = 0x6,
/**
* Mark the Boot Partition specified in the BPID field as Active
* and update BPINFO.ABPID.
*/
SPDK_NVME_FW_COMMIT_ACTIVATE_BOOT_PARTITION = 0x7,
};
/** Parameters for SPDK_NVME_OPC_FIRMWARE_COMMIT cdw10 */
@ -3300,7 +3364,12 @@ struct spdk_nvme_fw_commit {
* placed image.
*/
uint32_t ca : 3;
uint32_t reserved : 26;
uint32_t reserved : 25;
/**
* Boot Partition ID. Specifies the boot partition that shall be used for the
* Commit Action.
*/
uint32_t bpid : 1;
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_fw_commit) == 4, "Incorrect size");

View File

@ -70,6 +70,7 @@ struct spdk_nvmf_target_opts {
char name[NVMF_TGT_NAME_MAX_LENGTH];
uint32_t max_subsystems;
uint32_t acceptor_poll_rate;
uint16_t crdt[3];
};
struct spdk_nvmf_transport_opts {
@ -120,46 +121,17 @@ struct spdk_nvmf_listen_opts {
void spdk_nvmf_listen_opts_init(struct spdk_nvmf_listen_opts *opts, size_t opts_size);
struct spdk_nvmf_poll_group_stat {
/* cumulative admin qpair count */
uint32_t admin_qpairs;
/* cumulative io qpair count */
uint32_t io_qpairs;
/* current admin qpair count */
uint32_t current_admin_qpairs;
/* current io qpair count */
uint32_t current_io_qpairs;
uint64_t pending_bdev_io;
};
/* Deprecated.
* Please use the flow with spdk_nvmf_poll_group_dump_stat,
* which hides statistics structures within the transport.
*/
struct spdk_nvmf_rdma_device_stat {
const char *name;
uint64_t polls;
uint64_t idle_polls;
uint64_t completions;
uint64_t requests;
uint64_t request_latency;
uint64_t pending_free_request;
uint64_t pending_rdma_read;
uint64_t pending_rdma_write;
uint64_t total_send_wrs;
uint64_t send_doorbell_updates;
uint64_t total_recv_wrs;
uint64_t recv_doorbell_updates;
};
/* Deprecated.
* Please use the flow with spdk_nvmf_poll_group_dump_stat,
* which hides statistics structures within the transport.
*/
struct spdk_nvmf_transport_poll_group_stat {
spdk_nvme_transport_type_t trtype;
union {
struct {
uint64_t pending_data_buffer;
uint64_t num_devices;
struct spdk_nvmf_rdma_device_stat *devices;
} rdma;
};
};
/**
* Function to be called once asynchronous listen add and remove
* operations are completed. See spdk_nvmf_subsystem_add_listener()
@ -313,18 +285,6 @@ void spdk_nvmf_poll_group_destroy(struct spdk_nvmf_poll_group *group,
int spdk_nvmf_poll_group_add(struct spdk_nvmf_poll_group *group,
struct spdk_nvmf_qpair *qpair);
/**
* Get current poll group statistics. (deprecated)
*
* \param tgt The NVMf target.
* \param stat Pointer to allocated statistics structure to fill with values.
*
* \return 0 upon success.
* \return -EINVAL if either group or stat is NULL.
*/
int spdk_nvmf_poll_group_get_stat(struct spdk_nvmf_tgt *tgt,
struct spdk_nvmf_poll_group_stat *stat);
typedef void (*nvmf_qpair_disconnect_cb)(void *ctx);
/**
@ -844,6 +804,24 @@ struct spdk_nvmf_ns *spdk_nvmf_subsystem_get_ns(struct spdk_nvmf_subsystem *subs
*/
uint32_t spdk_nvmf_subsystem_get_max_namespaces(const struct spdk_nvmf_subsystem *subsystem);
/**
* Get the minimum controller ID allowed in a subsystem.
*
* \param subsystem Subsystem to query.
*
* \return Minimum controller ID allowed in the subsystem.
*/
uint16_t spdk_nvmf_subsystem_get_min_cntlid(const struct spdk_nvmf_subsystem *subsystem);
/**
* Get the maximum controller ID allowed in a subsystem.
*
* \param subsystem Subsystem to query.
*
* \return Maximum controller ID allowed in the subsystem.
*/
uint16_t spdk_nvmf_subsystem_get_max_cntlid(const struct spdk_nvmf_subsystem *subsystem);
/**
* Get a namespace's NSID.
*
@ -1105,44 +1083,6 @@ int spdk_nvmf_transport_stop_listen_async(struct spdk_nvmf_transport *transport,
spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn,
void *cb_arg);
/**
* \brief Get current transport poll group statistics. (deprecated)
*
* Please use the flow with spdk_nvmf_poll_group_dump_stat.
*
* This function allocates memory for statistics and returns it
* in \p stat parameter. Caller must free this memory with
* spdk_nvmf_transport_poll_group_free_stat() when it is not needed
* anymore.
*
* \param tgt The NVMf target.
* \param transport The NVMf transport.
* \param stat Output parameter that will contain pointer to allocated statistics structure.
*
* \return 0 upon success.
* \return -ENOTSUP if transport does not support statistics.
* \return -EINVAL if any of parameters is NULL.
* \return -ENOENT if transport poll group is not found.
* \return -ENOMEM if memory allocation failed.
*/
int
spdk_nvmf_transport_poll_group_get_stat(struct spdk_nvmf_tgt *tgt,
struct spdk_nvmf_transport *transport,
struct spdk_nvmf_transport_poll_group_stat **stat);
/**
* Free statistics memory previously allocated with spdk_nvmf_transport_poll_group_get_stat(). (deprecated)
*
* Please use the flow with spdk_nvmf_poll_group_dump_stat.
*
* \param transport The NVMf transport.
* \param stat Pointer to transport poll group statistics structure.
*/
void
spdk_nvmf_transport_poll_group_free_stat(struct spdk_nvmf_transport *transport,
struct spdk_nvmf_transport_poll_group_stat *stat);
/**
* Dump poll group statistics into JSON.
*

View File

@ -2,7 +2,7 @@
* BSD LICENSE
*
* Copyright (c) Intel Corporation. All rights reserved.
* Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 2019, 2021 Mellanox Technologies LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -74,31 +74,51 @@ SPDK_STATIC_ASSERT(sizeof(union nvmf_c2h_msg) == 16, "Incorrect size");
struct spdk_nvmf_dif_info {
struct spdk_dif_ctx dif_ctx;
bool dif_insert_or_strip;
uint32_t elba_length;
uint32_t orig_length;
};
enum spdk_nvmf_zcopy_phase {
NVMF_ZCOPY_PHASE_NONE, /* Request is not using ZCOPY */
NVMF_ZCOPY_PHASE_INIT, /* Requesting Buffers */
NVMF_ZCOPY_PHASE_EXECUTE, /* Got buffers processing commands */
NVMF_ZCOPY_PHASE_END_PENDING, /* Releasing buffers */
NVMF_ZCOPY_PHASE_COMPLETE, /* Buffers Released */
NVMF_ZCOPY_PHASE_INIT_FAILED /* Failed to get the buffers */
};
static inline bool
spdk_nvmf_using_zcopy(enum spdk_nvmf_zcopy_phase phase)
{
return (phase != NVMF_ZCOPY_PHASE_NONE);
}
struct spdk_nvmf_request {
struct spdk_nvmf_qpair *qpair;
uint32_t length;
enum spdk_nvme_data_transfer xfer;
uint8_t xfer; /* type enum spdk_nvme_data_transfer */
bool data_from_pool;
bool dif_enabled;
void *data;
union nvmf_h2c_msg *cmd;
union nvmf_c2h_msg *rsp;
void *buffers[NVMF_REQ_MAX_BUFFERS];
struct iovec iov[NVMF_REQ_MAX_BUFFERS];
STAILQ_ENTRY(spdk_nvmf_request) buf_link;
uint64_t timeout_tsc;
uint32_t iovcnt;
bool data_from_pool;
struct spdk_bdev_io_wait_entry bdev_io_wait;
struct iovec iov[NVMF_REQ_MAX_BUFFERS];
void *buffers[NVMF_REQ_MAX_BUFFERS];
struct spdk_nvmf_dif_info dif;
struct spdk_bdev_io_wait_entry bdev_io_wait;
spdk_nvmf_nvme_passthru_cmd_cb cmd_cb_fn;
struct spdk_nvmf_request *first_fused_req;
struct spdk_nvmf_request *req_to_abort;
struct spdk_poller *poller;
uint64_t timeout_tsc;
struct spdk_bdev_io *zcopy_bdev_io; /* Contains the bdev_io when using ZCOPY */
enum spdk_nvmf_zcopy_phase zcopy_phase;
STAILQ_ENTRY(spdk_nvmf_request) buf_link;
TAILQ_ENTRY(spdk_nvmf_request) link;
};
@ -367,19 +387,6 @@ struct spdk_nvmf_transport_ops {
void (*qpair_abort_request)(struct spdk_nvmf_qpair *qpair,
struct spdk_nvmf_request *req);
/*
* Get transport poll group statistics. (deprecated)
* Please use the flow with spdk_nvmf_poll_group_dump_stat.
*/
int (*poll_group_get_stat)(struct spdk_nvmf_tgt *tgt,
struct spdk_nvmf_transport_poll_group_stat **stat);
/*
* Free transport poll group statistics previously allocated with poll_group_get_stat(). (deprecated)
* Please use the flow with spdk_nvmf_poll_group_dump_stat.
*/
void (*poll_group_free_stat)(struct spdk_nvmf_transport_poll_group_stat *stat);
/*
* Dump transport poll group statistics into JSON.
*/
@ -429,10 +436,6 @@ int spdk_nvmf_request_get_buffers(struct spdk_nvmf_request *req,
struct spdk_nvmf_transport_poll_group *group,
struct spdk_nvmf_transport *transport,
uint32_t length);
int spdk_nvmf_request_get_buffers_multi(struct spdk_nvmf_request *req,
struct spdk_nvmf_transport_poll_group *group,
struct spdk_nvmf_transport *transport,
uint32_t *lengths, uint32_t num_lengths);
bool spdk_nvmf_request_get_dif_ctx(struct spdk_nvmf_request *req, struct spdk_dif_ctx *dif_ctx);
@ -440,6 +443,8 @@ void spdk_nvmf_request_exec(struct spdk_nvmf_request *req);
void spdk_nvmf_request_exec_fabrics(struct spdk_nvmf_request *req);
int spdk_nvmf_request_free(struct spdk_nvmf_request *req);
int spdk_nvmf_request_complete(struct spdk_nvmf_request *req);
int spdk_nvmf_request_zcopy_start(struct spdk_nvmf_request *req);
int spdk_nvmf_request_zcopy_end(struct spdk_nvmf_request *req, bool commit);
/**
* Remove the given qpair from the poll group.

View File

@ -52,6 +52,7 @@ extern "C" {
#define SPDK_PCI_VID_VIRTIO 0x1af4
#define SPDK_PCI_VID_CNEXLABS 0x1d1d
#define SPDK_PCI_VID_VMWARE 0x15ad
#define SPDK_PCI_VID_REDHAT 0x1b36
#define SPDK_PCI_CLASS_ANY_ID 0xffffff
/**

View File

@ -111,6 +111,7 @@ struct spdk_sock_impl_opts {
bool enable_recv_pipe;
/**
* **Deprecated, please use enable_zerocopy_send_server or enable_zerocopy_send_client instead**
* Enable or disable use of zero copy flow on send. Used by posix socket module.
*/
bool enable_zerocopy_send;
@ -126,6 +127,15 @@ struct spdk_sock_impl_opts {
*/
uint32_t enable_placement_id;
/**
* Enable or disable use of zero copy flow on send for server sockets. Used by posix socket module.
*/
bool enable_zerocopy_send_server;
/**
* Enable or disable use of zero copy flow on send for client sockets. Used by posix socket module.
*/
bool enable_zerocopy_send_client;
};
/**

View File

@ -50,6 +50,7 @@ extern "C" {
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>

View File

@ -39,9 +39,7 @@
#define SPDK_THREAD_H_
#include "spdk/stdinc.h"
#include "spdk/cpuset.h"
#include "spdk/queue.h"
#ifdef __cplusplus
extern "C" {
@ -210,30 +208,7 @@ typedef void (*spdk_channel_msg)(struct spdk_io_channel_iter *i);
*/
typedef void (*spdk_channel_for_each_cpl)(struct spdk_io_channel_iter *i, int status);
/**
* \brief Represents a per-thread channel for accessing an I/O device.
*
* An I/O device may be a physical entity (i.e. NVMe controller) or a software
* entity (i.e. a blobstore).
*
* This structure is not part of the API - all accesses should be done through
* spdk_io_channel function calls.
*/
struct spdk_io_channel {
struct spdk_thread *thread;
struct io_device *dev;
uint32_t ref;
uint32_t destroy_ref;
TAILQ_ENTRY(spdk_io_channel) tailq;
spdk_io_channel_destroy_cb destroy_cb;
/*
* Modules will allocate extra memory off the end of this structure
* to store references to hardware-specific references (i.e. NVMe queue
* pairs, or references to child device spdk_io_channels (i.e.
* virtual bdevs).
*/
};
#define SPDK_IO_CHANNEL_STRUCT_SIZE 96
/**
* Initialize the threading library. Must be called once prior to allocating any threads.
@ -688,7 +663,7 @@ void spdk_put_io_channel(struct spdk_io_channel *ch);
static inline void *
spdk_io_channel_get_ctx(struct spdk_io_channel *ch)
{
return (uint8_t *)ch + sizeof(*ch);
return (uint8_t *)ch + SPDK_IO_CHANNEL_STRUCT_SIZE;
}
/**

View File

@ -40,6 +40,7 @@
#define _SPDK_TRACE_H_
#include "spdk/stdinc.h"
#include "spdk/assert.h"
#ifdef __cplusplus
extern "C" {
@ -53,9 +54,18 @@ struct spdk_trace_entry {
uint16_t poller_id;
uint32_t size;
uint64_t object_id;
uint64_t arg1;
uint8_t args[8];
};
struct spdk_trace_entry_buffer {
uint64_t tsc;
uint16_t tpoint_id;
uint8_t data[22];
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_trace_entry_buffer) == sizeof(struct spdk_trace_entry),
"Invalid size of trace entry buffer");
/* If type changes from a uint8_t, change this value. */
#define SPDK_TRACE_MAX_OWNER (UCHAR_MAX + 1)
@ -80,15 +90,22 @@ struct spdk_trace_object {
#define SPDK_TRACE_ARG_TYPE_PTR 1
#define SPDK_TRACE_ARG_TYPE_STR 2
#define SPDK_TRACE_MAX_ARGS_COUNT 5
struct spdk_trace_argument {
char name[14];
uint8_t type;
uint8_t size;
};
struct spdk_trace_tpoint {
char name[24];
uint16_t tpoint_id;
uint8_t owner_type;
uint8_t object_type;
uint8_t new_object;
uint8_t arg1_type;
uint8_t reserved;
char arg1_name[8];
char name[24];
uint16_t tpoint_id;
uint8_t owner_type;
uint8_t object_type;
uint8_t new_object;
uint8_t num_args;
struct spdk_trace_argument args[SPDK_TRACE_MAX_ARGS_COUNT];
};
struct spdk_trace_history {
@ -175,37 +192,24 @@ spdk_get_per_lcore_history(struct spdk_trace_histories *trace_histories, unsigne
}
void _spdk_trace_record(uint64_t tsc, uint16_t tpoint_id, uint16_t poller_id,
uint32_t size, uint64_t object_id, uint64_t arg1);
uint32_t size, uint64_t object_id, int num_args, ...);
/**
* Record the current trace state for tracing tpoints. Debug tool can read the
* information from shared memory to post-process the tpoint entries and display
* in a human-readable format. This function will call spdk_get_ticks() to get
* the current tsc to save in the tracepoint.
*
* \param tpoint_id Tracepoint id to record.
* \param poller_id Poller id to record.
* \param size Size to record.
* \param object_id Object id to record.
* \param arg1 Argument to record.
*/
static inline
void spdk_trace_record(uint16_t tpoint_id, uint16_t poller_id, uint32_t size,
uint64_t object_id, uint64_t arg1)
{
/*
* Tracepoint group ID is encoded in the tpoint_id. Lower 6 bits determine the tracepoint
* within the group, the remaining upper bits determine the tracepoint group. Each
* tracepoint group has its own tracepoint mask.
*/
assert(tpoint_id < SPDK_TRACE_MAX_TPOINT_ID);
if (g_trace_histories == NULL ||
!((1ULL << (tpoint_id & 0x3F)) & g_trace_histories->flags.tpoint_mask[tpoint_id >> 6])) {
return;
}
#define _spdk_trace_record_tsc(tsc, tpoint_id, poller_id, size, object_id, num_args, ...) \
do { \
assert(tpoint_id < SPDK_TRACE_MAX_TPOINT_ID); \
if (g_trace_histories == NULL || \
!((1ULL << (tpoint_id & 0x3F)) & \
g_trace_histories->flags.tpoint_mask[tpoint_id >> 6])) { \
break; \
} \
_spdk_trace_record(tsc, tpoint_id, poller_id, size, object_id, \
num_args, ## __VA_ARGS__); \
} while (0)
_spdk_trace_record(0, tpoint_id, poller_id, size, object_id, arg1);
}
/* Return the number of variable arguments. */
#define spdk_trace_num_args(...) _spdk_trace_num_args(, ## __VA_ARGS__)
#define _spdk_trace_num_args(...) __spdk_trace_num_args(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define __spdk_trace_num_args(v, a1, a2, a3, a4, a5, a6, a7, a8, count, ...) count
/**
* Record the current trace state for tracing tpoints. Debug tool can read the
@ -217,25 +221,28 @@ void spdk_trace_record(uint16_t tpoint_id, uint16_t poller_id, uint32_t size,
* \param poller_id Poller id to record.
* \param size Size to record.
* \param object_id Object id to record.
* \param arg1 Argument to record.
* \param ... Extra tracepoint arguments. The number, types, and order of the arguments
* must match the definition of the tracepoint.
*/
static inline
void spdk_trace_record_tsc(uint64_t tsc, uint16_t tpoint_id, uint16_t poller_id,
uint32_t size, uint64_t object_id, uint64_t arg1)
{
/*
* Tracepoint group ID is encoded in the tpoint_id. Lower 6 bits determine the tracepoint
* within the group, the remaining upper bits determine the tracepoint group. Each
* tracepoint group has its own tracepoint mask.
*/
assert(tpoint_id < SPDK_TRACE_MAX_TPOINT_ID);
if (g_trace_histories == NULL ||
!((1ULL << (tpoint_id & 0x3F)) & g_trace_histories->flags.tpoint_mask[tpoint_id >> 6])) {
return;
}
#define spdk_trace_record_tsc(tsc, tpoint_id, poller_id, size, object_id, ...) \
_spdk_trace_record_tsc(tsc, tpoint_id, poller_id, size, object_id, \
spdk_trace_num_args(__VA_ARGS__), ## __VA_ARGS__)
_spdk_trace_record(tsc, tpoint_id, poller_id, size, object_id, arg1);
}
/**
* Record the current trace state for tracing tpoints. Debug tool can read the
* information from shared memory to post-process the tpoint entries and display
* in a human-readable format. This macro will call spdk_get_ticks() to get
* the current tsc to save in the tracepoint.
*
* \param tpoint_id Tracepoint id to record.
* \param poller_id Poller id to record.
* \param size Size to record.
* \param object_id Object id to record.
* \param ... Extra tracepoint arguments. The number, types, and order of the arguments
* must match the definition of the tracepoint.
*/
#define spdk_trace_record(tpoint_id, poller_id, size, object_id, ...) \
spdk_trace_record_tsc(0, tpoint_id, poller_id, size, object_id, ## __VA_ARGS__)
/**
* Get the current tpoint mask of the given tpoint group.
@ -326,7 +333,7 @@ void spdk_trace_register_owner(uint8_t type, char id_prefix);
void spdk_trace_register_object(uint8_t type, char id_prefix);
/**
* Register the description for the tpoint.
* Register the description for a tpoint with a single argument.
*
* \param name Name for the tpoint.
* \param tpoint_id Id for the tpoint.
@ -340,6 +347,29 @@ void spdk_trace_register_description(const char *name, uint16_t tpoint_id, uint8
uint8_t object_type, uint8_t new_object,
uint8_t arg1_type, const char *arg1_name);
struct spdk_trace_tpoint_opts {
const char *name;
uint16_t tpoint_id;
uint8_t owner_type;
uint8_t object_type;
uint8_t new_object;
struct {
const char *name;
uint8_t type;
uint8_t size;
} args[SPDK_TRACE_MAX_ARGS_COUNT];
};
/**
* Register the description for a number of tpoints. This function allows the user to register
* tracepoints with multiple arguments (up to 5).
*
* \param opts Array of structures describing tpoints and their arguments.
* \param num_opts Number of tpoints to register (size of the opts array).
*/
void spdk_trace_register_description_ext(const struct spdk_trace_tpoint_opts *opts,
size_t num_opts);
struct spdk_trace_register_fn *spdk_trace_get_first_register_fn(void);
struct spdk_trace_register_fn *spdk_trace_get_next_register_fn(struct spdk_trace_register_fn

834
include/spdk/tree.h Normal file
View File

@ -0,0 +1,834 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SPDK_TREE_H
#define SPDK_TREE_H
#include <sys/cdefs.h>
/*
* This file defines data structures for different types of trees:
* splay trees and rank-balanced trees.
*
* A splay tree is a self-organizing data structure. Every operation
* on the tree causes a splay to happen. The splay moves the requested
* node to the root of the tree and partly rebalances it.
*
* This has the benefit that request locality causes faster lookups as
* the requested nodes move to the top of the tree. On the other hand,
* every lookup causes memory writes.
*
* The Balance Theorem bounds the total access time for m operations
* and n inserts on an initially empty tree as O((m + n)lg n). The
* amortized cost for a sequence of m accesses to a splay tree is O(lg n);
*
* A rank-balanced tree is a binary search tree with an integer
* rank-difference as an attribute of each pointer from parent to child.
* The sum of the rank-differences on any path from a node down to null is
* the same, and defines the rank of that node. The rank of the null node
* is -1.
*
* Different additional conditions define different sorts of balanced
* trees, including "red-black" and "AVL" trees. The set of conditions
* applied here are the "weak-AVL" conditions of Haeupler, Sen and Tarjan:
* - every rank-difference is 1 or 2.
* - the rank of any leaf is 1.
*
* For historical reasons, rank differences that are even are associated
* with the color red (Rank-Even-Difference), and the child that a red edge
* points to is called a red child.
*
* Every operation on a rank-balanced tree is bounded as O(lg n).
* The maximum height of a rank-balanced tree is 2lg (n+1).
*/
#define SPLAY_HEAD(name, type) \
struct name { \
struct type *sph_root; /* root of the tree */ \
}
#define SPLAY_INITIALIZER(root) \
{ NULL }
#define SPLAY_INIT(root) do { \
(root)->sph_root = NULL; \
} while (/* CONSTCOND */ 0)
#define SPLAY_ENTRY(type) \
struct { \
struct type *spe_left; /* left element */ \
struct type *spe_right; /* right element */ \
}
#define SPLAY_LEFT(elm, field) (elm)->field.spe_left
#define SPLAY_RIGHT(elm, field) (elm)->field.spe_right
#define SPLAY_ROOT(head) (head)->sph_root
#define SPLAY_EMPTY(head) (SPLAY_ROOT(head) == NULL)
/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */
#define SPLAY_ROTATE_RIGHT(head, tmp, field) do { \
SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \
SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
(head)->sph_root = tmp; \
} while (/* CONSTCOND */ 0)
#define SPLAY_ROTATE_LEFT(head, tmp, field) do { \
SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \
SPLAY_LEFT(tmp, field) = (head)->sph_root; \
(head)->sph_root = tmp; \
} while (/* CONSTCOND */ 0)
#define SPLAY_LINKLEFT(head, tmp, field) do { \
SPLAY_LEFT(tmp, field) = (head)->sph_root; \
tmp = (head)->sph_root; \
(head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \
} while (/* CONSTCOND */ 0)
#define SPLAY_LINKRIGHT(head, tmp, field) do { \
SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
tmp = (head)->sph_root; \
(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \
} while (/* CONSTCOND */ 0)
#define SPLAY_ASSEMBLE(head, node, left, right, field) do { \
SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \
SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \
SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \
} while (/* CONSTCOND */ 0)
/* Generates prototypes and inline functions */
#define SPLAY_PROTOTYPE(name, type, field, cmp) \
void name##_SPLAY(struct name *, struct type *); \
void name##_SPLAY_MINMAX(struct name *, int); \
struct type *name##_SPLAY_INSERT(struct name *, struct type *); \
struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \
\
/* Finds the node with the same key as elm */ \
static __attribute__((unused)) __inline struct type * \
name##_SPLAY_FIND(struct name *head, struct type *elm) \
{ \
if (SPLAY_EMPTY(head)) \
return(NULL); \
name##_SPLAY(head, elm); \
if ((cmp)(elm, (head)->sph_root) == 0) \
return (head->sph_root); \
return (NULL); \
} \
\
static __attribute__((unused)) __inline struct type * \
name##_SPLAY_NEXT(struct name *head, struct type *elm) \
{ \
name##_SPLAY(head, elm); \
if (SPLAY_RIGHT(elm, field) != NULL) { \
elm = SPLAY_RIGHT(elm, field); \
while (SPLAY_LEFT(elm, field) != NULL) { \
elm = SPLAY_LEFT(elm, field); \
} \
} else \
elm = NULL; \
return (elm); \
} \
\
static __attribute__((unused)) __inline struct type * \
name##_SPLAY_MIN_MAX(struct name *head, int val) \
{ \
name##_SPLAY_MINMAX(head, val); \
return (SPLAY_ROOT(head)); \
}
/* Main splay operation.
* Moves node close to the key of elm to top
*/
#define SPLAY_GENERATE(name, type, field, cmp) \
struct type * \
name##_SPLAY_INSERT(struct name *head, struct type *elm) \
{ \
if (SPLAY_EMPTY(head)) { \
SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \
} else { \
int __comp; \
name##_SPLAY(head, elm); \
__comp = (cmp)(elm, (head)->sph_root); \
if (__comp < 0) { \
SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\
SPLAY_RIGHT(elm, field) = (head)->sph_root; \
SPLAY_LEFT((head)->sph_root, field) = NULL; \
} else if (__comp > 0) { \
SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\
SPLAY_LEFT(elm, field) = (head)->sph_root; \
SPLAY_RIGHT((head)->sph_root, field) = NULL; \
} else \
return ((head)->sph_root); \
} \
(head)->sph_root = (elm); \
return (NULL); \
} \
\
struct type * \
name##_SPLAY_REMOVE(struct name *head, struct type *elm) \
{ \
struct type *__tmp; \
if (SPLAY_EMPTY(head)) \
return (NULL); \
name##_SPLAY(head, elm); \
if ((cmp)(elm, (head)->sph_root) == 0) { \
if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \
(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\
} else { \
__tmp = SPLAY_RIGHT((head)->sph_root, field); \
(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\
name##_SPLAY(head, elm); \
SPLAY_RIGHT((head)->sph_root, field) = __tmp; \
} \
return (elm); \
} \
return (NULL); \
} \
\
void \
name##_SPLAY(struct name *head, struct type *elm) \
{ \
struct type __node, *__left, *__right, *__tmp; \
int __comp; \
\
SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
__left = __right = &__node; \
\
while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) { \
if (__comp < 0) { \
__tmp = SPLAY_LEFT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if ((cmp)(elm, __tmp) < 0){ \
SPLAY_ROTATE_RIGHT(head, __tmp, field); \
if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
break; \
} \
SPLAY_LINKLEFT(head, __right, field); \
} else if (__comp > 0) { \
__tmp = SPLAY_RIGHT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if ((cmp)(elm, __tmp) > 0){ \
SPLAY_ROTATE_LEFT(head, __tmp, field); \
if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
break; \
} \
SPLAY_LINKRIGHT(head, __left, field); \
} \
} \
SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
} \
\
/* Splay with either the minimum or the maximum element \
* Used to find minimum or maximum element in tree. \
*/ \
void name##_SPLAY_MINMAX(struct name *head, int __comp) \
{ \
struct type __node, *__left, *__right, *__tmp; \
\
SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
__left = __right = &__node; \
\
while (1) { \
if (__comp < 0) { \
__tmp = SPLAY_LEFT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if (__comp < 0){ \
SPLAY_ROTATE_RIGHT(head, __tmp, field); \
if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
break; \
} \
SPLAY_LINKLEFT(head, __right, field); \
} else if (__comp > 0) { \
__tmp = SPLAY_RIGHT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if (__comp > 0) { \
SPLAY_ROTATE_LEFT(head, __tmp, field); \
if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
break; \
} \
SPLAY_LINKRIGHT(head, __left, field); \
} \
} \
SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
}
#define SPLAY_NEGINF -1
#define SPLAY_INF 1
#define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y)
#define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y)
#define SPLAY_FIND(name, x, y) name##_SPLAY_FIND(x, y)
#define SPLAY_NEXT(name, x, y) name##_SPLAY_NEXT(x, y)
#define SPLAY_MIN(name, x) (SPLAY_EMPTY(x) ? NULL \
: name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF))
#define SPLAY_MAX(name, x) (SPLAY_EMPTY(x) ? NULL \
: name##_SPLAY_MIN_MAX(x, SPLAY_INF))
#define SPLAY_FOREACH(x, name, head) \
for ((x) = SPLAY_MIN(name, head); \
(x) != NULL; \
(x) = SPLAY_NEXT(name, head, x))
/* Macros that define a rank-balanced tree */
#define RB_HEAD(name, type) \
struct name { \
struct type *rbh_root; /* root of the tree */ \
}
#define RB_INITIALIZER(root) \
{ NULL }
#define RB_INIT(root) do { \
(root)->rbh_root = NULL; \
} while (/* CONSTCOND */ 0)
#define RB_ENTRY(type) \
struct { \
struct type *rbe_left; /* left element */ \
struct type *rbe_right; /* right element */ \
struct type *rbe_parent; /* parent element */ \
}
#define RB_LEFT(elm, field) (elm)->field.rbe_left
#define RB_RIGHT(elm, field) (elm)->field.rbe_right
/*
* With the expectation that any object of struct type has an
* address that is a multiple of 4, and that therefore the
* 2 least significant bits of a pointer to struct type are
* always zero, this implementation sets those bits to indicate
* that the left or right child of the tree node is "red".
*/
#define RB_UP(elm, field) (elm)->field.rbe_parent
#define RB_BITS(elm, field) (*(uintptr_t *)&RB_UP(elm, field))
#define RB_RED_L ((uintptr_t)1)
#define RB_RED_R ((uintptr_t)2)
#define RB_RED_MASK ((uintptr_t)3)
#define RB_FLIP_LEFT(elm, field) (RB_BITS(elm, field) ^= RB_RED_L)
#define RB_FLIP_RIGHT(elm, field) (RB_BITS(elm, field) ^= RB_RED_R)
#define RB_RED_LEFT(elm, field) ((RB_BITS(elm, field) & RB_RED_L) != 0)
#define RB_RED_RIGHT(elm, field) ((RB_BITS(elm, field) & RB_RED_R) != 0)
#define RB_PARENT(elm, field) ((__typeof(RB_UP(elm, field))) \
(RB_BITS(elm, field) & ~RB_RED_MASK))
/*
* _RB_ROOT starts with an underscore. This is a workaround for the issue that
* RB_ROOT() had a name conflict with the SPDK FIO plugin. The SPDK FIO plugin
* includes FIO and FIO defines RB_ROOT() itself.
*/
#define _RB_ROOT(head) (head)->rbh_root
#define RB_EMPTY(head) (_RB_ROOT(head) == NULL)
#define RB_SET_PARENT(dst, src, field) do { \
RB_BITS(dst, field) &= RB_RED_MASK; \
RB_BITS(dst, field) |= (uintptr_t)src; \
} while (/* CONSTCOND */ 0)
#define RB_SET(elm, parent, field) do { \
RB_UP(elm, field) = parent; \
RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \
} while (/* CONSTCOND */ 0)
#define RB_COLOR(elm, field) (RB_PARENT(elm, field) == NULL ? 0 : \
RB_LEFT(RB_PARENT(elm, field), field) == elm ? \
RB_RED_LEFT(RB_PARENT(elm, field), field) : \
RB_RED_RIGHT(RB_PARENT(elm, field), field))
/*
* Something to be invoked in a loop at the root of every modified subtree,
* from the bottom up to the root, to update augmented node data.
*/
#ifndef RB_AUGMENT
#define RB_AUGMENT(x) break
#endif
#define RB_SWAP_CHILD(head, out, in, field) do { \
if (RB_PARENT(out, field) == NULL) \
_RB_ROOT(head) = (in); \
else if ((out) == RB_LEFT(RB_PARENT(out, field), field)) \
RB_LEFT(RB_PARENT(out, field), field) = (in); \
else \
RB_RIGHT(RB_PARENT(out, field), field) = (in); \
} while (/* CONSTCOND */ 0)
#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \
(tmp) = RB_RIGHT(elm, field); \
if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \
RB_SET_PARENT(RB_RIGHT(elm, field), elm, field); \
} \
RB_SET_PARENT(tmp, RB_PARENT(elm, field), field); \
RB_SWAP_CHILD(head, elm, tmp, field); \
RB_LEFT(tmp, field) = (elm); \
RB_SET_PARENT(elm, tmp, field); \
RB_AUGMENT(elm); \
} while (/* CONSTCOND */ 0)
#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \
(tmp) = RB_LEFT(elm, field); \
if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \
RB_SET_PARENT(RB_LEFT(elm, field), elm, field); \
} \
RB_SET_PARENT(tmp, RB_PARENT(elm, field), field); \
RB_SWAP_CHILD(head, elm, tmp, field); \
RB_RIGHT(tmp, field) = (elm); \
RB_SET_PARENT(elm, tmp, field); \
RB_AUGMENT(elm); \
} while (/* CONSTCOND */ 0)
/* Generates prototypes and inline functions */
#define RB_PROTOTYPE(name, type, field, cmp) \
RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \
RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __attribute__((unused)) static)
#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \
RB_PROTOTYPE_INSERT_COLOR(name, type, attr); \
RB_PROTOTYPE_REMOVE_COLOR(name, type, attr); \
RB_PROTOTYPE_INSERT(name, type, attr); \
RB_PROTOTYPE_REMOVE(name, type, attr); \
RB_PROTOTYPE_FIND(name, type, attr); \
RB_PROTOTYPE_NFIND(name, type, attr); \
RB_PROTOTYPE_NEXT(name, type, attr); \
RB_PROTOTYPE_PREV(name, type, attr); \
RB_PROTOTYPE_MINMAX(name, type, attr); \
RB_PROTOTYPE_REINSERT(name, type, attr);
#define RB_PROTOTYPE_INSERT_COLOR(name, type, attr) \
attr void name##_RB_INSERT_COLOR(struct name *, struct type *)
#define RB_PROTOTYPE_REMOVE_COLOR(name, type, attr) \
attr void name##_RB_REMOVE_COLOR(struct name *, \
struct type *, struct type *)
#define RB_PROTOTYPE_REMOVE(name, type, attr) \
attr struct type *name##_RB_REMOVE(struct name *, struct type *)
#define RB_PROTOTYPE_INSERT(name, type, attr) \
attr struct type *name##_RB_INSERT(struct name *, struct type *)
#define RB_PROTOTYPE_FIND(name, type, attr) \
attr struct type *name##_RB_FIND(struct name *, struct type *)
#define RB_PROTOTYPE_NFIND(name, type, attr) \
attr struct type *name##_RB_NFIND(struct name *, struct type *)
#define RB_PROTOTYPE_NEXT(name, type, attr) \
attr struct type *name##_RB_NEXT(struct type *)
#define RB_PROTOTYPE_PREV(name, type, attr) \
attr struct type *name##_RB_PREV(struct type *)
#define RB_PROTOTYPE_MINMAX(name, type, attr) \
attr struct type *name##_RB_MINMAX(struct name *, int)
#define RB_PROTOTYPE_REINSERT(name, type, attr) \
attr struct type *name##_RB_REINSERT(struct name *, struct type *)
/* Main rb operation.
* Moves node close to the key of elm to top
*/
#define RB_GENERATE(name, type, field, cmp) \
RB_GENERATE_INTERNAL(name, type, field, cmp,)
#define RB_GENERATE_STATIC(name, type, field, cmp) \
RB_GENERATE_INTERNAL(name, type, field, cmp, __attribute__((unused)) static)
#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \
RB_GENERATE_INSERT_COLOR(name, type, field, attr) \
RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \
RB_GENERATE_INSERT(name, type, field, cmp, attr) \
RB_GENERATE_REMOVE(name, type, field, attr) \
RB_GENERATE_FIND(name, type, field, cmp, attr) \
RB_GENERATE_NFIND(name, type, field, cmp, attr) \
RB_GENERATE_NEXT(name, type, field, attr) \
RB_GENERATE_PREV(name, type, field, attr) \
RB_GENERATE_MINMAX(name, type, field, attr) \
RB_GENERATE_REINSERT(name, type, field, cmp, attr)
#define RB_GENERATE_INSERT_COLOR(name, type, field, attr) \
attr void \
name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
{ \
struct type *child, *parent; \
while ((parent = RB_PARENT(elm, field)) != NULL) { \
if (RB_LEFT(parent, field) == elm) { \
if (RB_RED_LEFT(parent, field)) { \
RB_FLIP_LEFT(parent, field); \
return; \
} \
RB_FLIP_RIGHT(parent, field); \
if (RB_RED_RIGHT(parent, field)) { \
elm = parent; \
continue; \
} \
if (!RB_RED_RIGHT(elm, field)) { \
RB_FLIP_LEFT(elm, field); \
RB_ROTATE_LEFT(head, elm, child, field);\
if (RB_RED_LEFT(child, field)) \
RB_FLIP_RIGHT(elm, field); \
else if (RB_RED_RIGHT(child, field)) \
RB_FLIP_LEFT(parent, field); \
elm = child; \
} \
RB_ROTATE_RIGHT(head, parent, elm, field); \
} else { \
if (RB_RED_RIGHT(parent, field)) { \
RB_FLIP_RIGHT(parent, field); \
return; \
} \
RB_FLIP_LEFT(parent, field); \
if (RB_RED_LEFT(parent, field)) { \
elm = parent; \
continue; \
} \
if (!RB_RED_LEFT(elm, field)) { \
RB_FLIP_RIGHT(elm, field); \
RB_ROTATE_RIGHT(head, elm, child, field);\
if (RB_RED_RIGHT(child, field)) \
RB_FLIP_LEFT(elm, field); \
else if (RB_RED_LEFT(child, field)) \
RB_FLIP_RIGHT(parent, field); \
elm = child; \
} \
RB_ROTATE_LEFT(head, parent, elm, field); \
} \
RB_BITS(elm, field) &= ~RB_RED_MASK; \
break; \
} \
}
#define RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \
attr void \
name##_RB_REMOVE_COLOR(struct name *head, \
struct type *parent, struct type *elm) \
{ \
struct type *sib; \
if (RB_LEFT(parent, field) == elm && \
RB_RIGHT(parent, field) == elm) { \
RB_BITS(parent, field) &= ~RB_RED_MASK; \
elm = parent; \
parent = RB_PARENT(elm, field); \
if (parent == NULL) \
return; \
} \
do { \
if (RB_LEFT(parent, field) == elm) { \
if (!RB_RED_LEFT(parent, field)) { \
RB_FLIP_LEFT(parent, field); \
return; \
} \
if (RB_RED_RIGHT(parent, field)) { \
RB_FLIP_RIGHT(parent, field); \
elm = parent; \
continue; \
} \
sib = RB_RIGHT(parent, field); \
if ((~RB_BITS(sib, field) & RB_RED_MASK) == 0) {\
RB_BITS(sib, field) &= ~RB_RED_MASK; \
elm = parent; \
continue; \
} \
RB_FLIP_RIGHT(sib, field); \
if (RB_RED_LEFT(sib, field)) \
RB_FLIP_LEFT(parent, field); \
else if (!RB_RED_RIGHT(sib, field)) { \
RB_FLIP_LEFT(parent, field); \
RB_ROTATE_RIGHT(head, sib, elm, field); \
if (RB_RED_RIGHT(elm, field)) \
RB_FLIP_LEFT(sib, field); \
if (RB_RED_LEFT(elm, field)) \
RB_FLIP_RIGHT(parent, field); \
RB_BITS(elm, field) |= RB_RED_MASK; \
sib = elm; \
} \
RB_ROTATE_LEFT(head, parent, sib, field); \
} else { \
if (!RB_RED_RIGHT(parent, field)) { \
RB_FLIP_RIGHT(parent, field); \
return; \
} \
if (RB_RED_LEFT(parent, field)) { \
RB_FLIP_LEFT(parent, field); \
elm = parent; \
continue; \
} \
sib = RB_LEFT(parent, field); \
if ((~RB_BITS(sib, field) & RB_RED_MASK) == 0) {\
RB_BITS(sib, field) &= ~RB_RED_MASK; \
elm = parent; \
continue; \
} \
RB_FLIP_LEFT(sib, field); \
if (RB_RED_RIGHT(sib, field)) \
RB_FLIP_RIGHT(parent, field); \
else if (!RB_RED_LEFT(sib, field)) { \
RB_FLIP_RIGHT(parent, field); \
RB_ROTATE_LEFT(head, sib, elm, field); \
if (RB_RED_LEFT(elm, field)) \
RB_FLIP_RIGHT(sib, field); \
if (RB_RED_RIGHT(elm, field)) \
RB_FLIP_LEFT(parent, field); \
RB_BITS(elm, field) |= RB_RED_MASK; \
sib = elm; \
} \
RB_ROTATE_RIGHT(head, parent, sib, field); \
} \
break; \
} while ((parent = RB_PARENT(elm, field)) != NULL); \
}
#define RB_GENERATE_REMOVE(name, type, field, attr) \
attr struct type * \
name##_RB_REMOVE(struct name *head, struct type *elm) \
{ \
struct type *child, *old, *parent, *right; \
\
old = elm; \
parent = RB_PARENT(elm, field); \
right = RB_RIGHT(elm, field); \
if (RB_LEFT(elm, field) == NULL) \
elm = child = right; \
else if (right == NULL) \
elm = child = RB_LEFT(elm, field); \
else { \
if ((child = RB_LEFT(right, field)) == NULL) { \
child = RB_RIGHT(right, field); \
RB_RIGHT(old, field) = child; \
parent = elm = right; \
} else { \
do \
elm = child; \
while ((child = RB_LEFT(elm, field)) != NULL); \
child = RB_RIGHT(elm, field); \
parent = RB_PARENT(elm, field); \
RB_LEFT(parent, field) = child; \
RB_SET_PARENT(RB_RIGHT(old, field), elm, field);\
} \
RB_SET_PARENT(RB_LEFT(old, field), elm, field); \
elm->field = old->field; \
} \
RB_SWAP_CHILD(head, old, elm, field); \
if (child != NULL) \
RB_SET_PARENT(child, parent, field); \
if (parent != NULL) \
name##_RB_REMOVE_COLOR(head, parent, child); \
while (parent != NULL) { \
RB_AUGMENT(parent); \
parent = RB_PARENT(parent, field); \
} \
return (old); \
}
#define RB_GENERATE_INSERT(name, type, field, cmp, attr) \
/* Inserts a node into the RB tree */ \
attr struct type * \
name##_RB_INSERT(struct name *head, struct type *elm) \
{ \
struct type *tmp; \
struct type *parent = NULL; \
int comp = 0; \
tmp = _RB_ROOT(head); \
while (tmp) { \
parent = tmp; \
comp = (cmp)(elm, parent); \
if (comp < 0) \
tmp = RB_LEFT(tmp, field); \
else if (comp > 0) \
tmp = RB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
RB_SET(elm, parent, field); \
if (parent == NULL) \
_RB_ROOT(head) = elm; \
else if (comp < 0) \
RB_LEFT(parent, field) = elm; \
else \
RB_RIGHT(parent, field) = elm; \
name##_RB_INSERT_COLOR(head, elm); \
while (elm != NULL) { \
RB_AUGMENT(elm); \
elm = RB_PARENT(elm, field); \
} \
return (NULL); \
}
#define RB_GENERATE_FIND(name, type, field, cmp, attr) \
/* Finds the node with the same key as elm */ \
attr struct type * \
name##_RB_FIND(struct name *head, struct type *elm) \
{ \
struct type *tmp = _RB_ROOT(head); \
int comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) \
tmp = RB_LEFT(tmp, field); \
else if (comp > 0) \
tmp = RB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
return (NULL); \
}
#define RB_GENERATE_NFIND(name, type, field, cmp, attr) \
/* Finds the first node greater than or equal to the search key */ \
attr struct type * \
name##_RB_NFIND(struct name *head, struct type *elm) \
{ \
struct type *tmp = _RB_ROOT(head); \
struct type *res = NULL; \
int comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) { \
res = tmp; \
tmp = RB_LEFT(tmp, field); \
} \
else if (comp > 0) \
tmp = RB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
return (res); \
}
#define RB_GENERATE_NEXT(name, type, field, attr) \
/* ARGSUSED */ \
attr struct type * \
name##_RB_NEXT(struct type *elm) \
{ \
if (RB_RIGHT(elm, field)) { \
elm = RB_RIGHT(elm, field); \
while (RB_LEFT(elm, field)) \
elm = RB_LEFT(elm, field); \
} else { \
if (RB_PARENT(elm, field) && \
(elm == RB_LEFT(RB_PARENT(elm, field), field))) \
elm = RB_PARENT(elm, field); \
else { \
while (RB_PARENT(elm, field) && \
(elm == RB_RIGHT(RB_PARENT(elm, field), field)))\
elm = RB_PARENT(elm, field); \
elm = RB_PARENT(elm, field); \
} \
} \
return (elm); \
}
#define RB_GENERATE_PREV(name, type, field, attr) \
/* ARGSUSED */ \
attr struct type * \
name##_RB_PREV(struct type *elm) \
{ \
if (RB_LEFT(elm, field)) { \
elm = RB_LEFT(elm, field); \
while (RB_RIGHT(elm, field)) \
elm = RB_RIGHT(elm, field); \
} else { \
if (RB_PARENT(elm, field) && \
(elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
elm = RB_PARENT(elm, field); \
else { \
while (RB_PARENT(elm, field) && \
(elm == RB_LEFT(RB_PARENT(elm, field), field)))\
elm = RB_PARENT(elm, field); \
elm = RB_PARENT(elm, field); \
} \
} \
return (elm); \
}
#define RB_GENERATE_MINMAX(name, type, field, attr) \
attr struct type * \
name##_RB_MINMAX(struct name *head, int val) \
{ \
struct type *tmp = _RB_ROOT(head); \
struct type *parent = NULL; \
while (tmp) { \
parent = tmp; \
if (val < 0) \
tmp = RB_LEFT(tmp, field); \
else \
tmp = RB_RIGHT(tmp, field); \
} \
return (parent); \
}
#define RB_GENERATE_REINSERT(name, type, field, cmp, attr) \
attr struct type * \
name##_RB_REINSERT(struct name *head, struct type *elm) \
{ \
struct type *cmpelm; \
if (((cmpelm = RB_PREV(name, head, elm)) != NULL && \
cmp(cmpelm, elm) >= 0) || \
((cmpelm = RB_NEXT(name, head, elm)) != NULL && \
cmp(elm, cmpelm) >= 0)) { \
/* XXXLAS: Remove/insert is heavy handed. */ \
RB_REMOVE(name, head, elm); \
return (RB_INSERT(name, head, elm)); \
} \
return (NULL); \
} \
#define RB_NEGINF -1
#define RB_INF 1
#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y)
#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y)
#define RB_FIND(name, x, y) name##_RB_FIND(x, y)
#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y)
#define RB_NEXT(name, x, y) name##_RB_NEXT(y)
#define RB_PREV(name, x, y) name##_RB_PREV(y)
#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF)
#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF)
#define RB_REINSERT(name, x, y) name##_RB_REINSERT(x, y)
#define RB_FOREACH(x, name, head) \
for ((x) = RB_MIN(name, head); \
(x) != NULL; \
(x) = name##_RB_NEXT(x))
#define RB_FOREACH_FROM(x, name, y) \
for ((x) = (y); \
((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
(x) = (y))
#define RB_FOREACH_SAFE(x, name, head, y) \
for ((x) = RB_MIN(name, head); \
((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
(x) = (y))
#define RB_FOREACH_REVERSE(x, name, head) \
for ((x) = RB_MAX(name, head); \
(x) != NULL; \
(x) = name##_RB_PREV(x))
#define RB_FOREACH_REVERSE_FROM(x, name, y) \
for ((x) = (y); \
((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
(x) = (y))
#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \
for ((x) = RB_MAX(name, head); \
((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
(x) = (y))
#endif /* SPDK_TREE_H */

View File

@ -53,6 +53,11 @@ extern "C" {
#define SPDK_CONTAINEROF(ptr, type, member) ((type *)((uintptr_t)ptr - offsetof(type, member)))
/**
* Get the size of a member of a struct.
*/
#define SPDK_SIZEOF_MEMBER(type, member) (sizeof(((type *)0)->member))
#define SPDK_SEC_TO_USEC 1000000ULL
#define SPDK_SEC_TO_NSEC 1000000000ULL
@ -66,7 +71,7 @@ extern "C" {
* power-of-two value.
*/
#define SPDK_ALIGN_FLOOR(val, align) \
(typeof(val))((val) & (~((typeof(val))((align) - 1))))
(__typeof__(val))((val) & (~((__typeof__(val))((align) - 1))))
/**
* Macro to align a value to a given power-of-two. The resultant value
* will be of the same type as the first parameter, and will be no lower
@ -74,7 +79,7 @@ extern "C" {
* value.
*/
#define SPDK_ALIGN_CEIL(val, align) \
SPDK_ALIGN_FLOOR(((val) + ((typeof(val)) (align) - 1)), align)
SPDK_ALIGN_FLOOR(((val) + ((__typeof__(val)) (align) - 1)), align)
uint32_t spdk_u32log2(uint32_t x);

View File

@ -46,7 +46,7 @@
/**
* Minor version number (month of original release).
*/
#define SPDK_VERSION_MINOR 4
#define SPDK_VERSION_MINOR 7
/**
* Patch level.
@ -54,7 +54,7 @@
* Patch level is incremented on maintenance branch releases and reset to 0 for each
* new major.minor release.
*/
#define SPDK_VERSION_PATCH 0
#define SPDK_VERSION_PATCH 1
/**
* Version string suffix.

View File

@ -36,29 +36,34 @@
#include "spdk/stdinc.h"
#ifdef __cplusplus
extern "C" {
#endif
enum vfio_user_command {
VFIO_USER_VERSION = 1,
VFIO_USER_DMA_MAP = 2,
VFIO_USER_DMA_UNMAP = 3,
VFIO_USER_DEVICE_GET_INFO = 4,
VFIO_USER_DEVICE_GET_REGION_INFO = 5,
VFIO_USER_DEVICE_GET_IRQ_INFO = 6,
VFIO_USER_DEVICE_SET_IRQS = 7,
VFIO_USER_REGION_READ = 8,
VFIO_USER_REGION_WRITE = 9,
VFIO_USER_DMA_READ = 10,
VFIO_USER_DMA_WRITE = 11,
VFIO_USER_VM_INTERRUPT = 12,
VFIO_USER_DEVICE_GET_REGION_IO_FDS = 6,
VFIO_USER_DEVICE_GET_IRQ_INFO = 7,
VFIO_USER_DEVICE_SET_IRQS = 8,
VFIO_USER_REGION_READ = 9,
VFIO_USER_REGION_WRITE = 10,
VFIO_USER_DMA_READ = 11,
VFIO_USER_DMA_WRITE = 12,
VFIO_USER_DEVICE_RESET = 13,
VFIO_USER_DIRTY_PAGES = 14,
VFIO_USER_MAX,
};
enum vfio_user_message_type {
VFIO_USER_MESSAGE_COMMAND = 0,
VFIO_USER_MESSAGE_REPLY = 1,
VFIO_USER_MESSAGE_COMMAND = 0,
VFIO_USER_MESSAGE_REPLY = 1,
};
#define VFIO_USER_FLAGS_NO_REPLY (0x1)
#define VFIO_USER_FLAGS_NO_REPLY (0x1)
struct vfio_user_header {
uint16_t msg_id;
@ -66,8 +71,8 @@ struct vfio_user_header {
uint32_t msg_size;
struct {
uint32_t type : 4;
#define VFIO_USER_F_TYPE_COMMAND 0
#define VFIO_USER_F_TYPE_REPLY 1
#define VFIO_USER_F_TYPE_COMMAND 0
#define VFIO_USER_F_TYPE_REPLY 1
uint32_t no_reply : 1;
uint32_t error : 1;
uint32_t resvd : 26;
@ -81,15 +86,47 @@ struct vfio_user_version {
uint8_t data[];
} __attribute__((packed));
struct vfio_user_dma_region {
/*
* Similar to vfio_device_info, but without caps (yet).
*/
struct vfio_user_device_info {
uint32_t argsz;
/* VFIO_DEVICE_FLAGS_* */
uint32_t flags;
uint32_t num_regions;
uint32_t num_irqs;
} __attribute__((packed));
/* based on struct vfio_bitmap */
struct vfio_user_bitmap {
uint64_t pgsize;
uint64_t size;
char data[];
} __attribute__((packed));
/* based on struct vfio_iommu_type1_dma_map */
struct vfio_user_dma_map {
uint32_t argsz;
#define VFIO_USER_F_DMA_REGION_READ (1 << 0)
#define VFIO_USER_F_DMA_REGION_WRITE (1 << 1)
uint32_t flags;
uint64_t offset;
uint64_t addr;
uint64_t size;
uint64_t offset;
uint32_t prot;
uint32_t flags;
#define VFIO_USER_F_DMA_REGION_MAPPABLE (1 << 0)
} __attribute__((packed));
/* based on struct vfio_iommu_type1_dma_unmap */
struct vfio_user_dma_unmap {
uint32_t argsz;
#ifndef VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP
#define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0)
#endif
uint32_t flags;
uint64_t addr;
uint64_t size;
struct vfio_user_bitmap bitmap[];
};
struct vfio_user_region_access {
uint64_t offset;
uint32_t region;
@ -98,13 +135,25 @@ struct vfio_user_region_access {
} __attribute__((packed));
struct vfio_user_dma_region_access {
uint64_t addr;
uint32_t count;
uint8_t data[];
uint64_t addr;
uint64_t count;
uint8_t data[];
} __attribute__((packed));
struct vfio_user_irq_info {
uint32_t subindex;
uint32_t subindex;
} __attribute__((packed));
/* based on struct vfio_iommu_type1_dirty_bitmap_get */
struct vfio_user_bitmap_range {
uint64_t iova;
uint64_t size;
struct vfio_user_bitmap bitmap;
} __attribute__((packed));
#ifdef __cplusplus
}
#endif
#endif

View File

@ -31,49 +31,53 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SPDK_NET_INTERNAL_H
#define SPDK_NET_INTERNAL_H
/** \file
* Zipf random number distribution
*/
#ifndef SPDK_ZIPF_H
#define SPDK_ZIPF_H
#include "spdk/stdinc.h"
#include "spdk/queue.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SPDK_IFNAMSIZE 32
#define SPDK_MAX_IP_PER_IFC 32
struct spdk_interface {
char name[SPDK_IFNAMSIZE];
uint32_t index;
uint32_t num_ip_addresses; /* number of IP addresses defined */
uint32_t ip_address[SPDK_MAX_IP_PER_IFC];
TAILQ_ENTRY(spdk_interface) tailq;
};
struct spdk_zipf;
/**
* Add an ip address to the network interface.
* Create a zipf random number generator.
*
* \param ifc_index Index of the network interface.
* \param ip_addr Ip address to add.
* Numbers from [0, range) will be returned by the generator when
* calling \ref spdk_zipf_generate.
*
* \return 0 on success, -1 on failure.
* \param range Range of values for the zipf distribution.
* \param theta Theta distribution parameter.
* \param seed Seed value for the random number generator.
*
* \return a pointer to the new zipf generator.
*/
int interface_net_interface_add_ip_address(int ifc_index, char *ip_addr);
struct spdk_zipf *spdk_zipf_create(uint64_t range, double theta, uint32_t seed);
/**
* Delete an ip address from the network interface.
* Free a zipf generator and set the pointer to NULL.
*
* \param ifc_index Index of the network interface.
* \param ip_addr Ip address to delete.
*
* \return 0 on success, -1 on failure.
* \param zipfp Zipf generator to free.
*/
int interface_net_interface_delete_ip_address(int ifc_index, char *ip_addr);
void spdk_zipf_free(struct spdk_zipf **zipfp);
/**
* Get the list of all the network interfaces.
* Generate a value from the zipf generator.
*
* \return a pointer to the head of the linked list of all the network interfaces.
* \param zipf Zipf generator to generate the value from.
*
* \return value in the range [0, range)
*/
void *interface_get_list(void);
uint64_t spdk_zipf_generate(struct spdk_zipf *zipf);
#endif /* SPDK_NET_INTERNAL_H */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -67,12 +67,13 @@ struct spdk_accel_batch {
};
enum accel_opcode {
ACCEL_OPCODE_MEMMOVE = 0,
ACCEL_OPCODE_MEMFILL = 1,
ACCEL_OPCODE_COMPARE = 2,
ACCEL_OPCODE_BATCH = 3,
ACCEL_OPCODE_CRC32C = 4,
ACCEL_OPCODE_DUALCAST = 5,
ACCEL_OPCODE_MEMMOVE = 0,
ACCEL_OPCODE_MEMFILL = 1,
ACCEL_OPCODE_COMPARE = 2,
ACCEL_OPCODE_BATCH = 3,
ACCEL_OPCODE_CRC32C = 4,
ACCEL_OPCODE_DUALCAST = 5,
ACCEL_OPCODE_COPY_CRC32C = 6,
};
struct spdk_accel_task {
@ -80,6 +81,10 @@ struct spdk_accel_task {
struct spdk_accel_batch *batch;
spdk_accel_completion_cb cb_fn;
void *cb_arg;
struct {
spdk_accel_completion_cb cb_fn;
void *cb_arg;
} chained;
union {
struct {
struct iovec *iovs; /* iovs passed by the caller */
@ -92,14 +97,11 @@ struct spdk_accel_task {
void *src2;
};
union {
struct {
spdk_accel_completion_cb cb_fn;
void *cb_arg;
} chained;
void *dst2;
uint32_t seed;
uint64_t fill_pattern;
};
uint32_t *crc_dst;
enum accel_opcode op_code;
uint64_t nbytes;
TAILQ_ENTRY(spdk_accel_task) link;

View File

@ -64,11 +64,11 @@ struct spdk_lw_thread {
TAILQ_ENTRY(spdk_lw_thread) link;
uint64_t tsc_start;
uint32_t lcore;
uint32_t new_lcore;
bool resched;
/* stats over a lifetime of a thread */
struct spdk_thread_stats total_stats;
/* stats during the last scheduling period */
struct spdk_thread_stats current_stats;
struct spdk_thread_stats snapshot_stats;
struct spdk_thread_stats last_stats;
};
/**
@ -88,8 +88,7 @@ struct spdk_reactor {
struct {
uint32_t is_valid : 1;
uint32_t is_scheduling : 1;
uint32_t reserved : 30;
uint32_t reserved : 31;
} flags;
uint64_t tsc_last;
@ -125,7 +124,7 @@ void spdk_reactors_stop(void *arg1);
struct spdk_reactor *spdk_reactor_get(uint32_t lcore);
struct spdk_reactor *_spdk_get_scheduling_reactor(void);
extern bool g_scheduling_in_progress;
/**
* Allocate and pass an event to each reactor, serially.
@ -164,68 +163,7 @@ int spdk_reactor_set_interrupt_mode(uint32_t lcore, bool new_in_interrupt,
*/
struct spdk_thread *_spdk_get_app_thread(void);
struct spdk_subsystem {
const char *name;
/* User must call spdk_subsystem_init_next() when they are done with their initialization. */
void (*init)(void);
void (*fini)(void);
/**
* Write JSON configuration handler.
*
* \param w JSON write context
*/
void (*write_config_json)(struct spdk_json_write_ctx *w);
TAILQ_ENTRY(spdk_subsystem) tailq;
};
struct spdk_subsystem *spdk_subsystem_find(const char *name);
struct spdk_subsystem *spdk_subsystem_get_first(void);
struct spdk_subsystem *spdk_subsystem_get_next(struct spdk_subsystem *cur_subsystem);
struct spdk_subsystem_depend {
const char *name;
const char *depends_on;
TAILQ_ENTRY(spdk_subsystem_depend) tailq;
};
struct spdk_subsystem_depend *spdk_subsystem_get_first_depend(void);
struct spdk_subsystem_depend *spdk_subsystem_get_next_depend(struct spdk_subsystem_depend
*cur_depend);
void spdk_add_subsystem(struct spdk_subsystem *subsystem);
void spdk_add_subsystem_depend(struct spdk_subsystem_depend *depend);
typedef void (*spdk_subsystem_init_fn)(int rc, void *ctx);
void spdk_subsystem_init(spdk_subsystem_init_fn cb_fn, void *cb_arg);
void spdk_subsystem_fini(spdk_msg_fn cb_fn, void *cb_arg);
void spdk_subsystem_init_next(int rc);
void spdk_subsystem_fini_next(void);
void spdk_app_json_config_load(const char *json_config_file, const char *rpc_addr,
spdk_subsystem_init_fn cb_fn, void *cb_arg,
bool stop_on_error);
/**
* Save pointed \c subsystem configuration to the JSON write context \c w. In case of
* error \c null is written to the JSON context.
*
* \param w JSON write context
* \param subsystem the subsystem to query
*/
void spdk_subsystem_config_json(struct spdk_json_write_ctx *w, struct spdk_subsystem *subsystem);
int spdk_rpc_initialize(const char *listen_addr);
void spdk_rpc_finish(void);
struct spdk_governor_capabilities {
bool freq_change;
bool freq_getset;
bool freq_up;
bool freq_down;
bool freq_max;
bool freq_min;
bool turbo_set;
bool turbo_available;
bool priority;
};
@ -233,37 +171,14 @@ struct spdk_governor_capabilities {
struct spdk_governor {
char *name;
/* freqs - the buffer array to save the frequencies; num - the number of frequencies to get; return - the number of available frequencies */
uint32_t (*get_core_freqs)(uint32_t lcore_id, uint32_t *freqs, uint32_t num);
/* return - current frequency on success, 0 on failure */
uint32_t (*get_core_curr_freq)(uint32_t lcore_id);
/**
* freq_index - index of available frequencies returned from get_core_freqs call
*
* return
* - 1 on success with frequency changed.
* - 0 on success without frequency changed.
* - Negative on error.
*/
int (*set_core_freq)(uint32_t lcore_id, uint32_t freq_index);
int (*core_freq_up)(uint32_t lcore_id);
int (*core_freq_down)(uint32_t lcore_id);
int (*set_core_freq_max)(uint32_t lcore_id);
int (*set_core_freq_min)(uint32_t lcore_id);
/**
* return
* - 1 Turbo Boost is enabled for this lcore.
* - 0 Turbo Boost is disabled for this lcore.
* - Negative on error.
*/
int (*get_core_turbo_status)(uint32_t lcore_id);
/* return - 0 on success; negative on error */
int (*enable_core_turbo)(uint32_t lcore_id);
int (*disable_core_turbo)(uint32_t lcore_id);
int (*get_core_capabilities)(uint32_t lcore_id, struct spdk_governor_capabilities *capabilities);
int (*init_core)(uint32_t lcore_id);
int (*deinit_core)(uint32_t lcore_id);
@ -308,17 +223,33 @@ struct spdk_governor *_spdk_governor_get(void);
_spdk_governor_list_add(governor); \
} \
/**
* Structure representing thread used for scheduling.
*/
struct spdk_scheduler_thread_info {
uint32_t lcore;
uint64_t thread_id;
/* stats over a lifetime of a thread */
struct spdk_thread_stats total_stats;
/* stats during the last scheduling period */
struct spdk_thread_stats current_stats;
};
/**
* A list of cores and threads which is used for scheduling.
*/
struct spdk_scheduler_core_info {
uint64_t core_idle_tsc;
uint64_t core_busy_tsc;
/* stats over a lifetime of a core */
uint64_t total_idle_tsc;
uint64_t total_busy_tsc;
/* stats during the last scheduling period */
uint64_t current_idle_tsc;
uint64_t current_busy_tsc;
uint32_t lcore;
uint32_t threads_count;
uint32_t pending_threads_count;
bool interrupt_mode;
struct spdk_lw_thread **threads;
struct spdk_scheduler_thread_info *thread_infos;
};
/**
@ -380,11 +311,6 @@ struct spdk_scheduler *_spdk_scheduler_get(void);
*/
void _spdk_scheduler_period_set(uint64_t period);
/**
* Disable the scheduler.
*/
void _spdk_scheduler_disable(void);
/**
* Get period of currently set scheduler.
*/
@ -408,37 +334,6 @@ static void __attribute__((constructor)) _spdk_scheduler_register_ ## scheduler
*/
void _spdk_lw_thread_set_core(struct spdk_lw_thread *thread, uint32_t lcore);
/**
* Get threads stats
*
* \param thread thread that stats regards to.
* \param stats Output parameter for accumulated TSC counts while the thread was busy.
*/
void _spdk_lw_thread_get_current_stats(struct spdk_lw_thread *thread,
struct spdk_thread_stats *stats);
/**
* \brief Register a new subsystem
*/
#define SPDK_SUBSYSTEM_REGISTER(_name) \
__attribute__((constructor)) static void _name ## _register(void) \
{ \
spdk_add_subsystem(&_name); \
}
/**
* \brief Declare that a subsystem depends on another subsystem.
*/
#define SPDK_SUBSYSTEM_DEPEND(_name, _depends_on) \
static struct spdk_subsystem_depend __subsystem_ ## _name ## _depend_on ## _depends_on = { \
.name = #_name, \
.depends_on = #_depends_on, \
}; \
__attribute__((constructor)) static void _name ## _depend_on ## _depends_on(void) \
{ \
spdk_add_subsystem_depend(&__subsystem_ ## _name ## _depend_on ## _depends_on); \
}
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,90 @@
/*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SPDK_INIT_INTERNAL_H
#define SPDK_INIT_INTERNAL_H
#include "spdk/stdinc.h"
#include "spdk/queue.h"
struct spdk_json_write_ctx;
struct spdk_subsystem {
const char *name;
/* User must call spdk_subsystem_init_next() when they are done with their initialization. */
void (*init)(void);
void (*fini)(void);
/**
* Write JSON configuration handler.
*
* \param w JSON write context
*/
void (*write_config_json)(struct spdk_json_write_ctx *w);
TAILQ_ENTRY(spdk_subsystem) tailq;
};
struct spdk_subsystem_depend {
const char *name;
const char *depends_on;
TAILQ_ENTRY(spdk_subsystem_depend) tailq;
};
void spdk_add_subsystem(struct spdk_subsystem *subsystem);
void spdk_add_subsystem_depend(struct spdk_subsystem_depend *depend);
void spdk_subsystem_init_next(int rc);
void spdk_subsystem_fini_next(void);
/**
* \brief Register a new subsystem
*/
#define SPDK_SUBSYSTEM_REGISTER(_name) \
__attribute__((constructor)) static void _name ## _register(void) \
{ \
spdk_add_subsystem(&_name); \
}
/**
* \brief Declare that a subsystem depends on another subsystem.
*/
#define SPDK_SUBSYSTEM_DEPEND(_name, _depends_on) \
static struct spdk_subsystem_depend __subsystem_ ## _name ## _depend_on ## _depends_on = { \
.name = #_name, \
.depends_on = #_depends_on, \
}; \
__attribute__((constructor)) static void _name ## _depend_on ## _depends_on(void) \
{ \
spdk_add_subsystem_depend(&__subsystem_ ## _name ## _depend_on ## _depends_on); \
}
#endif

View File

@ -36,8 +36,8 @@
#include "spdk/blob.h"
#include "spdk/lvol.h"
#include "spdk/queue.h"
#include "spdk/uuid.h"
#include "spdk/bdev_module.h"
/* Default size of blobstore cluster */
#define SPDK_LVS_OPTS_CLUSTER_SZ (4 * 1024 * 1024)

View File

@ -38,6 +38,8 @@
#include "spdk/sock.h"
#include "spdk/dif.h"
#include "sgl.h"
#define SPDK_CRC32C_XOR 0xffffffffUL
#define SPDK_NVME_TCP_DIGEST_LEN 4
#define SPDK_NVME_TCP_DIGEST_ALIGNMENT 4
@ -76,13 +78,6 @@
typedef void (*nvme_tcp_qpair_xfer_complete_cb)(void *cb_arg);
struct _nvme_tcp_sgl {
struct iovec *iov;
int iovcnt;
uint32_t iov_offset;
uint32_t total_size;
};
struct nvme_tcp_pdu {
union {
/* to hold error pdu data */
@ -101,7 +96,6 @@ struct nvme_tcp_pdu {
bool has_hdgst;
bool ddgst_enable;
uint32_t header_digest_crc32;
uint32_t data_digest_crc32;
uint8_t data_digest[SPDK_NVME_TCP_DIGEST_LEN];
@ -126,7 +120,7 @@ struct nvme_tcp_pdu {
TAILQ_ENTRY(nvme_tcp_pdu) tailq;
uint32_t remaining;
uint32_t padding_len;
struct _nvme_tcp_sgl sgl;
struct spdk_iov_sgl sgl;
struct spdk_dif_ctx *dif_ctx;
@ -206,20 +200,6 @@ nvme_tcp_pdu_calc_header_digest(struct nvme_tcp_pdu *pdu)
return crc32c;
}
static uint32_t
_update_crc32c_iov(struct iovec *iov, int iovcnt, uint32_t crc32c)
{
int i;
for (i = 0; i < iovcnt; i++) {
assert(iov[i].iov_base != NULL);
assert(iov[i].iov_len != 0);
crc32c = spdk_crc32c_update(iov[i].iov_base, iov[i].iov_len, crc32c);
}
return crc32c;
}
static uint32_t
nvme_tcp_pdu_calc_data_digest(struct nvme_tcp_pdu *pdu)
{
@ -229,7 +209,7 @@ nvme_tcp_pdu_calc_data_digest(struct nvme_tcp_pdu *pdu)
assert(pdu->data_len != 0);
if (spdk_likely(!pdu->dif_ctx)) {
crc32c = _update_crc32c_iov(pdu->data_iov, pdu->data_iovcnt, crc32c);
crc32c = spdk_crc32c_iov_update(pdu->data_iov, pdu->data_iovcnt, crc32c);
} else {
spdk_dif_update_crc32c_stream(pdu->data_iov, pdu->data_iovcnt,
0, pdu->data_len, &crc32c, pdu->dif_ctx);
@ -249,32 +229,7 @@ nvme_tcp_pdu_calc_data_digest(struct nvme_tcp_pdu *pdu)
}
static inline void
_nvme_tcp_sgl_init(struct _nvme_tcp_sgl *s, struct iovec *iov, int iovcnt,
uint32_t iov_offset)
{
s->iov = iov;
s->iovcnt = iovcnt;
s->iov_offset = iov_offset;
s->total_size = 0;
}
static inline void
_nvme_tcp_sgl_advance(struct _nvme_tcp_sgl *s, uint32_t step)
{
s->iov_offset += step;
while (s->iovcnt > 0) {
if (s->iov_offset < s->iov->iov_len) {
break;
}
s->iov_offset -= s->iov->iov_len;
s->iov++;
s->iovcnt--;
}
}
static inline void
_nvme_tcp_sgl_get_buf(struct _nvme_tcp_sgl *s, void **_buf, uint32_t *_buf_len)
_nvme_tcp_sgl_get_buf(struct spdk_iov_sgl *s, void **_buf, uint32_t *_buf_len)
{
if (_buf != NULL) {
*_buf = s->iov->iov_base + s->iov_offset;
@ -285,33 +240,12 @@ _nvme_tcp_sgl_get_buf(struct _nvme_tcp_sgl *s, void **_buf, uint32_t *_buf_len)
}
static inline bool
_nvme_tcp_sgl_append(struct _nvme_tcp_sgl *s, uint8_t *data, uint32_t data_len)
{
if (s->iov_offset >= data_len) {
s->iov_offset -= data_len;
} else {
assert(s->iovcnt > 0);
s->iov->iov_base = data + s->iov_offset;
s->iov->iov_len = data_len - s->iov_offset;
s->total_size += data_len - s->iov_offset;
s->iov_offset = 0;
s->iov++;
s->iovcnt--;
if (s->iovcnt == 0) {
return false;
}
}
return true;
}
static inline bool
_nvme_tcp_sgl_append_multi(struct _nvme_tcp_sgl *s, struct iovec *iov, int iovcnt)
_nvme_tcp_sgl_append_multi(struct spdk_iov_sgl *s, struct iovec *iov, int iovcnt)
{
int i;
for (i = 0; i < iovcnt; i++) {
if (!_nvme_tcp_sgl_append(s, iov[i].iov_base, iov[i].iov_len)) {
if (!spdk_iov_sgl_append(s, iov[i].iov_base, iov[i].iov_len)) {
return false;
}
}
@ -333,7 +267,7 @@ _get_iov_array_size(struct iovec *iov, int iovcnt)
}
static inline bool
_nvme_tcp_sgl_append_multi_with_md(struct _nvme_tcp_sgl *s, struct iovec *iov, int iovcnt,
_nvme_tcp_sgl_append_multi_with_md(struct spdk_iov_sgl *s, struct iovec *iov, int iovcnt,
uint32_t data_len, const struct spdk_dif_ctx *dif_ctx)
{
int rc;
@ -369,14 +303,14 @@ nvme_tcp_build_iovs(struct iovec *iov, int iovcnt, struct nvme_tcp_pdu *pdu,
bool hdgst_enable, bool ddgst_enable, uint32_t *_mapped_length)
{
uint32_t hlen, plen;
struct _nvme_tcp_sgl *sgl;
struct spdk_iov_sgl *sgl;
if (iovcnt == 0) {
return 0;
}
sgl = &pdu->sgl;
_nvme_tcp_sgl_init(sgl, iov, iovcnt, 0);
spdk_iov_sgl_init(sgl, iov, iovcnt, 0);
hlen = pdu->hdr.common.hlen;
/* Header Digest */
@ -387,7 +321,7 @@ nvme_tcp_build_iovs(struct iovec *iov, int iovcnt, struct nvme_tcp_pdu *pdu,
plen = hlen;
if (!pdu->data_len) {
/* PDU header + possible header digest */
_nvme_tcp_sgl_append(sgl, (uint8_t *)&pdu->hdr.raw, hlen);
spdk_iov_sgl_append(sgl, (uint8_t *)&pdu->hdr.raw, hlen);
goto end;
}
@ -397,7 +331,7 @@ nvme_tcp_build_iovs(struct iovec *iov, int iovcnt, struct nvme_tcp_pdu *pdu,
plen = hlen;
}
if (!_nvme_tcp_sgl_append(sgl, (uint8_t *)&pdu->hdr.raw, hlen)) {
if (!spdk_iov_sgl_append(sgl, (uint8_t *)&pdu->hdr.raw, hlen)) {
goto end;
}
@ -417,7 +351,7 @@ nvme_tcp_build_iovs(struct iovec *iov, int iovcnt, struct nvme_tcp_pdu *pdu,
/* Data Digest */
if (g_nvme_tcp_ddgst[pdu->hdr.common.pdu_type] && ddgst_enable) {
plen += SPDK_NVME_TCP_DIGEST_LEN;
_nvme_tcp_sgl_append(sgl, pdu->data_digest, SPDK_NVME_TCP_DIGEST_LEN);
spdk_iov_sgl_append(sgl, pdu->data_digest, SPDK_NVME_TCP_DIGEST_LEN);
}
assert(plen == pdu->hdr.common.plen);
@ -434,14 +368,14 @@ static int
nvme_tcp_build_payload_iovs(struct iovec *iov, int iovcnt, struct nvme_tcp_pdu *pdu,
bool ddgst_enable, uint32_t *_mapped_length)
{
struct _nvme_tcp_sgl *sgl;
struct spdk_iov_sgl *sgl;
if (iovcnt == 0) {
return 0;
}
sgl = &pdu->sgl;
_nvme_tcp_sgl_init(sgl, iov, iovcnt, pdu->rw_offset);
spdk_iov_sgl_init(sgl, iov, iovcnt, pdu->rw_offset);
if (spdk_likely(!pdu->dif_ctx)) {
if (!_nvme_tcp_sgl_append_multi(sgl, pdu->data_iov, pdu->data_iovcnt)) {
@ -456,7 +390,7 @@ nvme_tcp_build_payload_iovs(struct iovec *iov, int iovcnt, struct nvme_tcp_pdu *
/* Data Digest */
if (ddgst_enable) {
_nvme_tcp_sgl_append(sgl, pdu->data_digest, SPDK_NVME_TCP_DIGEST_LEN);
spdk_iov_sgl_append(sgl, pdu->data_digest, SPDK_NVME_TCP_DIGEST_LEN);
}
end:
@ -566,7 +500,7 @@ nvme_tcp_pdu_set_data_buf(struct nvme_tcp_pdu *pdu,
{
uint32_t buf_offset, buf_len, remain_len, len;
uint8_t *buf;
struct _nvme_tcp_sgl *pdu_sgl, buf_sgl;
struct spdk_iov_sgl *pdu_sgl, buf_sgl;
pdu->data_len = data_len;
@ -584,20 +518,20 @@ nvme_tcp_pdu_set_data_buf(struct nvme_tcp_pdu *pdu,
} else {
pdu_sgl = &pdu->sgl;
_nvme_tcp_sgl_init(pdu_sgl, pdu->data_iov, NVME_TCP_MAX_SGL_DESCRIPTORS, 0);
_nvme_tcp_sgl_init(&buf_sgl, iov, iovcnt, 0);
spdk_iov_sgl_init(pdu_sgl, pdu->data_iov, NVME_TCP_MAX_SGL_DESCRIPTORS, 0);
spdk_iov_sgl_init(&buf_sgl, iov, iovcnt, 0);
_nvme_tcp_sgl_advance(&buf_sgl, buf_offset);
spdk_iov_sgl_advance(&buf_sgl, buf_offset);
remain_len = buf_len;
while (remain_len > 0) {
_nvme_tcp_sgl_get_buf(&buf_sgl, (void *)&buf, &len);
len = spdk_min(len, remain_len);
_nvme_tcp_sgl_advance(&buf_sgl, len);
spdk_iov_sgl_advance(&buf_sgl, len);
remain_len -= len;
if (!_nvme_tcp_sgl_append(pdu_sgl, buf, len)) {
if (!spdk_iov_sgl_append(pdu_sgl, buf, len)) {
break;
}
}

127
include/spdk_internal/sgl.h Normal file
View File

@ -0,0 +1,127 @@
/*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __SGL_INTERNAL_H__
#define __SGL_INTERNAL_H__
#include "spdk/stdinc.h"
#ifdef __cplusplus
extern "C" {
#endif
struct spdk_iov_sgl {
struct iovec *iov;
int iovcnt;
uint32_t iov_offset;
uint32_t total_size;
};
/**
* Initialize struct spdk_iov_sgl with iov, iovcnt and iov_offset.
*
* \param s the spdk_iov_sgl to be filled.
* \param iov the io vector to fill the s
* \param iovcnt the size the iov
* \param iov_offset the current filled iov_offset for s.
*/
static inline void
spdk_iov_sgl_init(struct spdk_iov_sgl *s, struct iovec *iov, int iovcnt,
uint32_t iov_offset)
{
s->iov = iov;
s->iovcnt = iovcnt;
s->iov_offset = iov_offset;
s->total_size = 0;
}
/**
* Consume the iovs in spdk_iov_sgl with passed bytes
*
* \param s the spdk_iov_sgl which contains the iov
* \param step the bytes_size consumed.
*/
static inline void
spdk_iov_sgl_advance(struct spdk_iov_sgl *s, uint32_t step)
{
s->iov_offset += step;
while (s->iovcnt > 0) {
assert(s->iov != NULL);
if (s->iov_offset < s->iov->iov_len) {
break;
}
s->iov_offset -= s->iov->iov_len;
s->iov++;
s->iovcnt--;
}
}
/**
* Append the data to the struct spdk_iov_sgl pointed by s
*
* \param s the address of the struct spdk_iov_sgl
* \param data the data buffer to be appended
* \param data_len the length of the data.
*
* \return true if all the data is appended.
*/
static inline bool
spdk_iov_sgl_append(struct spdk_iov_sgl *s, uint8_t *data, uint32_t data_len)
{
if (s->iov_offset >= data_len) {
s->iov_offset -= data_len;
} else {
assert(s->iovcnt > 0);
s->iov->iov_base = data + s->iov_offset;
s->iov->iov_len = data_len - s->iov_offset;
s->total_size += data_len - s->iov_offset;
s->iov_offset = 0;
s->iov++;
s->iovcnt--;
if (s->iovcnt == 0) {
return false;
}
}
return true;
}
#ifdef __cplusplus
}
#endif
#endif /* __SGL_INTERNAL_H__ */

View File

@ -31,115 +31,40 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SPDK_THREAD_INTERNAL_H_
#define SPDK_THREAD_INTERNAL_H_
#ifndef SPDK_INTERNAL_THREAD_H_
#define SPDK_INTERNAL_THREAD_H_
#include "spdk/stdinc.h"
#include "spdk/thread.h"
#define SPDK_MAX_POLLER_NAME_LEN 256
#define SPDK_MAX_THREAD_NAME_LEN 256
struct spdk_poller;
enum spdk_poller_state {
/* The poller is registered with a thread but not currently executing its fn. */
SPDK_POLLER_STATE_WAITING,
/* The poller is currently running its fn. */
SPDK_POLLER_STATE_RUNNING,
/* The poller was unregistered during the execution of its fn. */
SPDK_POLLER_STATE_UNREGISTERED,
/* The poller is in the process of being paused. It will be paused
* during the next time it's supposed to be executed.
*/
SPDK_POLLER_STATE_PAUSING,
/* The poller is registered but currently paused. It's on the
* paused_pollers list.
*/
SPDK_POLLER_STATE_PAUSED,
struct spdk_poller_stats {
uint64_t run_count;
uint64_t busy_count;
};
struct spdk_poller {
TAILQ_ENTRY(spdk_poller) tailq;
struct io_device;
struct spdk_thread;
/* Current state of the poller; should only be accessed from the poller's thread. */
enum spdk_poller_state state;
const char *spdk_poller_get_name(struct spdk_poller *poller);
const char *spdk_poller_get_state_str(struct spdk_poller *poller);
uint64_t spdk_poller_get_period_ticks(struct spdk_poller *poller);
void spdk_poller_get_stats(struct spdk_poller *poller, struct spdk_poller_stats *stats);
uint64_t period_ticks;
uint64_t next_run_tick;
uint64_t run_count;
uint64_t busy_count;
spdk_poller_fn fn;
void *arg;
struct spdk_thread *thread;
int interruptfd;
spdk_poller_set_interrupt_mode_cb set_intr_cb_fn;
void *set_intr_cb_arg;
char name[SPDK_MAX_POLLER_NAME_LEN + 1];
};
enum spdk_thread_state {
/* The thread is pocessing poller and message by spdk_thread_poll(). */
SPDK_THREAD_STATE_RUNNING,
/* The thread is in the process of termination. It reaps unregistering
* poller are releasing I/O channel.
*/
SPDK_THREAD_STATE_EXITING,
/* The thread is exited. It is ready to call spdk_thread_destroy(). */
SPDK_THREAD_STATE_EXITED,
};
struct spdk_thread {
uint64_t tsc_last;
struct spdk_thread_stats stats;
/*
* Contains pollers actively running on this thread. Pollers
* are run round-robin. The thread takes one poller from the head
* of the ring, executes it, then puts it back at the tail of
* the ring.
*/
TAILQ_HEAD(active_pollers_head, spdk_poller) active_pollers;
/**
* Contains pollers running on this thread with a periodic timer.
*/
TAILQ_HEAD(timed_pollers_head, spdk_poller) timed_pollers;
/*
* Contains paused pollers. Pollers on this queue are waiting until
* they are resumed (in which case they're put onto the active/timer
* queues) or unregistered.
*/
TAILQ_HEAD(paused_pollers_head, spdk_poller) paused_pollers;
struct spdk_ring *messages;
int msg_fd;
SLIST_HEAD(, spdk_msg) msg_cache;
size_t msg_cache_count;
spdk_msg_fn critical_msg;
uint64_t id;
enum spdk_thread_state state;
int pending_unregister_count;
TAILQ_HEAD(, spdk_io_channel) io_channels;
TAILQ_ENTRY(spdk_thread) tailq;
char name[SPDK_MAX_THREAD_NAME_LEN + 1];
struct spdk_cpuset cpumask;
uint64_t exit_timeout_tsc;
/* Indicates whether this spdk_thread currently runs in interrupt. */
bool in_interrupt;
struct spdk_fd_group *fgrp;
/* User context allocated at the end */
uint8_t ctx[0];
};
const char *spdk_poller_state_str(enum spdk_poller_state state);
const char *spdk_io_channel_get_io_device_name(struct spdk_io_channel *ch);
int spdk_io_channel_get_ref_count(struct spdk_io_channel *ch);
const char *spdk_io_device_get_name(struct io_device *dev);
#endif /* SPDK_THREAD_INTERNAL_H_ */
struct spdk_poller *spdk_thread_get_first_active_poller(struct spdk_thread *thread);
struct spdk_poller *spdk_thread_get_next_active_poller(struct spdk_poller *prev);
struct spdk_poller *spdk_thread_get_first_timed_poller(struct spdk_thread *thread);
struct spdk_poller *spdk_thread_get_next_timed_poller(struct spdk_poller *prev);
struct spdk_poller *spdk_thread_get_first_paused_poller(struct spdk_thread *thread);
struct spdk_poller *spdk_thread_get_next_paused_poller(struct spdk_poller *prev);
struct spdk_io_channel *spdk_thread_get_first_io_channel(struct spdk_thread *thread);
struct spdk_io_channel *spdk_thread_get_next_io_channel(struct spdk_io_channel *prev);
#endif /* SPDK_INTERNAL_THREAD_H_ */

View File

@ -31,33 +31,30 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "spdk/stdinc.h"
#ifndef SPDK_INTERNAL_USDT_H
#define SPDK_INTERNAL_USDT_H
#include "spdk/net.h"
#include "spdk/config.h"
#include "spdk/env.h"
#include "spdk_internal/event.h"
#if defined(SPDK_CONFIG_USDT) && !defined(SPDK_UNIT_TEST)
static void
interface_subsystem_init(void)
{
int rc;
#include <sys/sdt.h>
rc = spdk_interface_init();
#define SPDK_DTRACE_PROBE(name) DTRACE_PROBE1(spdk,name,spdk_get_ticks())
#define SPDK_DTRACE_PROBE1(name,a1) DTRACE_PROBE2(spdk,name,spdk_get_ticks(),a1)
#define SPDK_DTRACE_PROBE2(name,a1,a2) DTRACE_PROBE3(spdk,name,spdk_get_ticks(),a1,a2)
#define SPDK_DTRACE_PROBE3(name,a1,a2,a3) DTRACE_PROBE4(spdk,name,spdk_get_ticks(),a1,a2,a3)
#define SPDK_DTRACE_PROBE4(name,a1,a2,a3,a4) DTRACE_PROBE5(spdk,name,spdk_get_ticks(),a1,a2,a3,a4)
spdk_subsystem_init_next(rc);
}
#else
static void
interface_subsystem_destroy(void)
{
spdk_interface_destroy();
spdk_subsystem_fini_next();
}
#define SPDK_DTRACE_PROBE(...)
#define SPDK_DTRACE_PROBE1(...)
#define SPDK_DTRACE_PROBE2(...)
#define SPDK_DTRACE_PROBE3(...)
#define SPDK_DTRACE_PROBE4(...)
static struct spdk_subsystem g_spdk_subsystem_interface = {
.name = "interface",
.init = interface_subsystem_init,
.fini = interface_subsystem_destroy,
};
#endif
SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_interface);
#endif /* SPDK_INTERNAL_USDT_H */

View File

@ -36,8 +36,8 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
include $(SPDK_ROOT_DIR)/mk/spdk.lib_deps.mk
DIRS-y += bdev blob blobfs conf accel event json jsonrpc \
log lvol net rpc sock thread trace util nvme vmd nvmf scsi \
ioat ut_mock iscsi notify
log lvol rpc sock thread trace util nvme vmd nvmf scsi \
ioat ut_mock iscsi notify init
ifeq ($(OS),Linux)
DIRS-y += nbd ftl
endif

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 5
SO_VER := 6
SO_MINOR := 0
SO_SUFFIX := $(SO_VER).$(SO_MINOR)

View File

@ -301,7 +301,7 @@ spdk_accel_submit_fill(struct spdk_io_channel *ch, void *dst, uint8_t fill, uint
/* Accel framework public API for CRC-32C function */
int
spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *dst, void *src, uint32_t seed,
spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *crc_dst, void *src, uint32_t seed,
uint64_t nbytes, spdk_accel_completion_cb cb_fn, void *cb_arg)
{
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
@ -312,7 +312,7 @@ spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *dst, void *src, u
return -ENOMEM;
}
accel_task->dst = (void *)dst;
accel_task->crc_dst = crc_dst;
accel_task->src = src;
accel_task->v.iovcnt = 0;
accel_task->seed = seed;
@ -322,7 +322,7 @@ spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *dst, void *src, u
if (_is_supported(accel_ch->engine, ACCEL_CRC32C)) {
return accel_ch->engine->submit_tasks(accel_ch->engine_ch, accel_task);
} else {
_sw_accel_crc32c(dst, src, seed, nbytes);
_sw_accel_crc32c(crc_dst, src, seed, nbytes);
spdk_accel_task_complete(accel_task, 0);
return 0;
}
@ -338,9 +338,18 @@ crc32cv_done(void *cb_arg, int status)
assert(accel_task->chained.cb_arg != NULL);
if (spdk_likely(!status)) {
status = spdk_accel_submit_crc32cv(ch, accel_task->dst, ++accel_task->v.iovs,
accel_task->v.iovcnt - 1, ~(*((uint32_t *)accel_task->dst)),
accel_task->chained.cb_fn, accel_task->chained.cb_arg);
if (accel_task->op_code == ACCEL_OPCODE_COPY_CRC32C) {
accel_task->dst = (char *)accel_task->dst + accel_task->nbytes;
status = spdk_accel_submit_copy_crc32cv(ch, accel_task->dst, ++accel_task->v.iovs,
accel_task->v.iovcnt - 1, accel_task->crc_dst,
~(*((uint32_t *)accel_task->crc_dst)),
accel_task->chained.cb_fn, accel_task->chained.cb_arg);
} else {
status = spdk_accel_submit_crc32cv(ch, accel_task->crc_dst, ++accel_task->v.iovs,
accel_task->v.iovcnt - 1, ~(*((uint32_t *)accel_task->crc_dst)),
accel_task->chained.cb_fn, accel_task->chained.cb_arg);
}
if (spdk_likely(!status)) {
return;
}
@ -351,7 +360,7 @@ crc32cv_done(void *cb_arg, int status)
/* Accel framework public API for chained CRC-32C function */
int
spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *dst, struct iovec *iov,
spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *crc_dst, struct iovec *iov,
uint32_t iov_cnt, uint32_t seed, spdk_accel_completion_cb cb_fn, void *cb_arg)
{
struct accel_io_channel *accel_ch;
@ -368,7 +377,7 @@ spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *dst, struct iove
}
if (iov_cnt == 1) {
return spdk_accel_submit_crc32c(ch, dst, iov[0].iov_base, seed, iov[0].iov_len, cb_fn, cb_arg);
return spdk_accel_submit_crc32c(ch, crc_dst, iov[0].iov_base, seed, iov[0].iov_len, cb_fn, cb_arg);
}
accel_ch = spdk_io_channel_get_ctx(ch);
@ -381,7 +390,8 @@ spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *dst, struct iove
accel_task->v.iovs = iov;
accel_task->v.iovcnt = iov_cnt;
accel_task->dst = (void *)dst;
accel_task->crc_dst = crc_dst;
accel_task->seed = seed;
accel_task->op_code = ACCEL_OPCODE_CRC32C;
if (_is_supported(accel_ch->engine, ACCEL_CRC32C)) {
@ -394,12 +404,101 @@ spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *dst, struct iove
return accel_ch->engine->submit_tasks(accel_ch->engine_ch, accel_task);
} else {
_sw_accel_crc32cv(dst, iov, iov_cnt, seed);
_sw_accel_crc32cv(crc_dst, iov, iov_cnt, seed);
spdk_accel_task_complete(accel_task, 0);
return 0;
}
}
/* Accel framework public API for copy with CRC-32C function */
int
spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *src,
uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
spdk_accel_completion_cb cb_fn, void *cb_arg)
{
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task;
accel_task = _get_task(accel_ch, NULL, cb_fn, cb_arg);
if (accel_task == NULL) {
return -ENOMEM;
}
accel_task->dst = dst;
accel_task->src = src;
accel_task->crc_dst = crc_dst;
accel_task->v.iovcnt = 0;
accel_task->seed = seed;
accel_task->nbytes = nbytes;
accel_task->op_code = ACCEL_OPCODE_COPY_CRC32C;
if (_is_supported(accel_ch->engine, ACCEL_COPY_CRC32C)) {
return accel_ch->engine->submit_tasks(accel_ch->engine_ch, accel_task);
} else {
_sw_accel_copy(dst, src, nbytes);
_sw_accel_crc32c(crc_dst, src, seed, nbytes);
spdk_accel_task_complete(accel_task, 0);
return 0;
}
}
/* Accel framework public API for chained copy + CRC-32C function */
int
spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst, struct iovec *src_iovs,
uint32_t iov_cnt, uint32_t *crc_dst, uint32_t seed,
spdk_accel_completion_cb cb_fn, void *cb_arg)
{
struct accel_io_channel *accel_ch;
struct spdk_accel_task *accel_task;
if (src_iovs == NULL) {
SPDK_ERRLOG("iov should not be NULL");
return -EINVAL;
}
if (!iov_cnt) {
SPDK_ERRLOG("iovcnt should not be zero value\n");
return -EINVAL;
}
if (iov_cnt == 1) {
return spdk_accel_submit_copy_crc32c(ch, dst, src_iovs[0].iov_base, crc_dst, seed,
src_iovs[0].iov_len, cb_fn, cb_arg);
}
accel_ch = spdk_io_channel_get_ctx(ch);
accel_task = _get_task(accel_ch, NULL, cb_fn, cb_arg);
if (accel_task == NULL) {
SPDK_ERRLOG("no memory\n");
assert(0);
return -ENOMEM;
}
accel_task->v.iovs = src_iovs;
accel_task->v.iovcnt = iov_cnt;
accel_task->dst = (void *)dst;
accel_task->crc_dst = crc_dst;
accel_task->seed = seed;
accel_task->op_code = ACCEL_OPCODE_COPY_CRC32C;
if (_is_supported(accel_ch->engine, ACCEL_COPY_CRC32C)) {
accel_task->cb_fn = crc32cv_done;
accel_task->cb_arg = accel_task;
accel_task->chained.cb_fn = cb_fn;
accel_task->chained.cb_arg = cb_arg;
accel_task->nbytes = src_iovs[0].iov_len;
return accel_ch->engine->submit_tasks(accel_ch->engine_ch, accel_task);
} else {
_sw_accel_copy(dst, src_iovs[0].iov_base, src_iovs[0].iov_len);
_sw_accel_crc32cv(crc_dst, src_iovs, iov_cnt, seed);
spdk_accel_task_complete(accel_task, 0);
return 0;
}
}
/* Accel framework public API for getting max operations for a batch. */
uint32_t
spdk_accel_batch_get_max(struct spdk_io_channel *ch)
@ -525,7 +624,7 @@ spdk_accel_batch_prep_fill(struct spdk_io_channel *ch, struct spdk_accel_batch *
int
spdk_accel_batch_prep_crc32c(struct spdk_io_channel *ch, struct spdk_accel_batch *batch,
uint32_t *dst, void *src, uint32_t seed, uint64_t nbytes,
uint32_t *crc_dst, void *src, uint32_t seed, uint64_t nbytes,
spdk_accel_completion_cb cb_fn, void *cb_arg)
{
struct spdk_accel_task *accel_task;
@ -536,7 +635,7 @@ spdk_accel_batch_prep_crc32c(struct spdk_io_channel *ch, struct spdk_accel_batch
return -ENOMEM;
}
accel_task->dst = dst;
accel_task->crc_dst = crc_dst;
accel_task->src = src;
accel_task->v.iovcnt = 0;
accel_task->seed = seed;
@ -565,8 +664,9 @@ batched_crc32cv_done(void *cb_arg, int status)
assert(accel_task->chained.cb_arg != NULL);
if (spdk_likely(!status)) {
status = spdk_accel_batch_prep_crc32cv(ch, batch, accel_task->dst,
++accel_task->v.iovs, accel_task->v.iovcnt - 1, ~(*((uint32_t *)accel_task->dst)),
status = spdk_accel_batch_prep_crc32cv(ch, batch, accel_task->crc_dst,
++accel_task->v.iovs, accel_task->v.iovcnt - 1,
~(*((uint32_t *)accel_task->crc_dst)),
accel_task->chained.cb_fn, accel_task->chained.cb_arg);
if (spdk_likely(!status)) {
return;
@ -578,7 +678,7 @@ batched_crc32cv_done(void *cb_arg, int status)
int
spdk_accel_batch_prep_crc32cv(struct spdk_io_channel *ch, struct spdk_accel_batch *batch,
uint32_t *dst, struct iovec *iovs, uint32_t iov_cnt, uint32_t seed,
uint32_t *crc_dst, struct iovec *iovs, uint32_t iov_cnt, uint32_t seed,
spdk_accel_completion_cb cb_fn, void *cb_arg)
{
struct accel_io_channel *accel_ch;
@ -595,7 +695,8 @@ spdk_accel_batch_prep_crc32cv(struct spdk_io_channel *ch, struct spdk_accel_batc
}
if (iov_cnt == 1) {
return spdk_accel_batch_prep_crc32c(ch, batch, dst, iovs[0].iov_base, seed, iovs[0].iov_len, cb_fn,
return spdk_accel_batch_prep_crc32c(ch, batch, crc_dst, iovs[0].iov_base, seed, iovs[0].iov_len,
cb_fn,
cb_arg);
}
@ -607,7 +708,7 @@ spdk_accel_batch_prep_crc32cv(struct spdk_io_channel *ch, struct spdk_accel_batc
accel_task->v.iovs = iovs;
accel_task->v.iovcnt = iov_cnt;
accel_task->dst = dst;
accel_task->crc_dst = crc_dst;
accel_task->seed = seed;
accel_task->op_code = ACCEL_OPCODE_CRC32C;
@ -628,6 +729,36 @@ spdk_accel_batch_prep_crc32cv(struct spdk_io_channel *ch, struct spdk_accel_batc
return 0;
}
int
spdk_accel_batch_prep_copy_crc32c(struct spdk_io_channel *ch, struct spdk_accel_batch *batch,
void *dst, void *src, uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
spdk_accel_completion_cb cb_fn, void *cb_arg)
{
struct spdk_accel_task *accel_task;
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
accel_task = _get_task(accel_ch, batch, cb_fn, cb_arg);
if (accel_task == NULL) {
return -ENOMEM;
}
accel_task->dst = dst;
accel_task->src = src;
accel_task->crc_dst = crc_dst;
accel_task->v.iovcnt = 0;
accel_task->seed = seed;
accel_task->nbytes = nbytes;
accel_task->op_code = ACCEL_OPCODE_COPY_CRC32C;
if (_is_supported(accel_ch->engine, ACCEL_COPY_CRC32C)) {
TAILQ_INSERT_TAIL(&batch->hw_tasks, accel_task, link);
} else {
TAILQ_INSERT_TAIL(&batch->sw_tasks, accel_task, link);
}
return 0;
}
/* Accel framework public API for batch_create function. */
struct spdk_accel_batch *
spdk_accel_batch_create(struct spdk_io_channel *ch)
@ -715,6 +846,11 @@ spdk_accel_batch_submit(struct spdk_io_channel *ch, struct spdk_accel_batch *bat
}
spdk_accel_task_complete(accel_task, 0);
break;
case ACCEL_OPCODE_COPY_CRC32C:
_sw_accel_copy(accel_task->dst, accel_task->src, accel_task->nbytes);
_sw_accel_crc32c(accel_task->crc_dst, accel_task->src, accel_task->seed, accel_task->nbytes);
spdk_accel_task_complete(accel_task, 0);
break;
case ACCEL_OPCODE_DUALCAST:
_sw_accel_dualcast(accel_task->dst, accel_task->dst2, accel_task->src,
accel_task->nbytes);
@ -959,23 +1095,15 @@ _sw_accel_fill(void *dst, uint8_t fill, uint64_t nbytes)
}
static void
_sw_accel_crc32c(uint32_t *dst, void *src, uint32_t seed, uint64_t nbytes)
_sw_accel_crc32c(uint32_t *crc_dst, void *src, uint32_t seed, uint64_t nbytes)
{
*dst = spdk_crc32c_update(src, nbytes, ~seed);
*crc_dst = spdk_crc32c_update(src, nbytes, ~seed);
}
static void
_sw_accel_crc32cv(uint32_t *dst, struct iovec *iov, uint32_t iovcnt, uint32_t seed)
_sw_accel_crc32cv(uint32_t *crc_dst, struct iovec *iov, uint32_t iovcnt, uint32_t seed)
{
uint32_t i, crc32c = ~seed;
for (i = 0; i < iovcnt; i++) {
assert(iov[i].iov_base != NULL);
assert(iov[i].iov_len != 0);
crc32c = spdk_crc32c_update(iov[i].iov_base, iov[i].iov_len, crc32c);
}
*dst = crc32c;
*crc_dst = spdk_crc32c_iov_update(iov, iovcnt, ~seed);
}
static struct spdk_io_channel *sw_accel_get_io_channel(void);

View File

@ -15,6 +15,7 @@
spdk_accel_batch_prep_fill;
spdk_accel_batch_prep_crc32c;
spdk_accel_batch_prep_crc32cv;
spdk_accel_batch_prep_copy_crc32c;
spdk_accel_batch_submit;
spdk_accel_batch_cancel;
spdk_accel_submit_copy;
@ -23,6 +24,8 @@
spdk_accel_submit_fill;
spdk_accel_submit_crc32c;
spdk_accel_submit_crc32cv;
spdk_accel_submit_copy_crc32c;
spdk_accel_submit_copy_crc32cv;
spdk_accel_write_config_json;
# functions needed by modules

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 6
SO_VER := 7
SO_MINOR := 0
ifeq ($(CONFIG_VTUNE),y)

View File

@ -84,12 +84,27 @@ int __itt_init_ittlib(const char *, __itt_group_id);
#define SPDK_BDEV_POOL_ALIGNMENT 512
/* The maximum number of children requests for a UNMAP or WRITE ZEROES command
* when splitting into children requests at a time.
*/
#define SPDK_BDEV_MAX_CHILDREN_UNMAP_WRITE_ZEROES_REQS (8)
static const char *qos_rpc_type[] = {"rw_ios_per_sec",
"rw_mbytes_per_sec", "r_mbytes_per_sec", "w_mbytes_per_sec"
};
TAILQ_HEAD(spdk_bdev_list, spdk_bdev);
RB_HEAD(bdev_name_tree, spdk_bdev_name);
static int
bdev_name_cmp(struct spdk_bdev_name *name1, struct spdk_bdev_name *name2)
{
return strcmp(name1->name, name2->name);
}
RB_GENERATE_STATIC(bdev_name_tree, spdk_bdev_name, node, bdev_name_cmp);
struct spdk_bdev_mgr {
struct spdk_mempool *bdev_io_pool;
@ -101,6 +116,7 @@ struct spdk_bdev_mgr {
TAILQ_HEAD(bdev_module_list, spdk_bdev_module) bdev_modules;
struct spdk_bdev_list bdevs;
struct bdev_name_tree bdev_names;
bool init_complete;
bool module_init_complete;
@ -115,6 +131,7 @@ struct spdk_bdev_mgr {
static struct spdk_bdev_mgr g_bdev_mgr = {
.bdev_modules = TAILQ_HEAD_INITIALIZER(g_bdev_mgr.bdev_modules),
.bdevs = TAILQ_HEAD_INITIALIZER(g_bdev_mgr.bdevs),
.bdev_names = RB_INITIALIZER(g_bdev_mgr.bdev_names),
.init_complete = false,
.module_init_complete = false,
.mutex = PTHREAD_MUTEX_INITIALIZER,
@ -458,6 +475,33 @@ spdk_bdev_set_opts(struct spdk_bdev_opts *opts)
return 0;
}
static struct spdk_bdev *
bdev_get_by_name(const char *bdev_name)
{
struct spdk_bdev_name find;
struct spdk_bdev_name *res;
find.name = (char *)bdev_name;
res = RB_FIND(bdev_name_tree, &g_bdev_mgr.bdev_names, &find);
if (res != NULL) {
return res->bdev;
}
return NULL;
}
struct spdk_bdev *
spdk_bdev_get_by_name(const char *bdev_name)
{
struct spdk_bdev *bdev;
pthread_mutex_lock(&g_bdev_mgr.mutex);
bdev = bdev_get_by_name(bdev_name);
pthread_mutex_unlock(&g_bdev_mgr.mutex);
return bdev;
}
struct spdk_bdev_wait_for_examine_ctx {
struct spdk_poller *poller;
spdk_bdev_wait_for_examine_cb cb_fn;
@ -541,7 +585,7 @@ bdev_in_examine_allowlist(struct spdk_bdev *bdev)
return true;
}
TAILQ_FOREACH(tmp, &bdev->aliases, tailq) {
if (bdev_examine_allowlist_check(tmp->alias)) {
if (bdev_examine_allowlist_check(tmp->alias.name)) {
return true;
}
}
@ -708,29 +752,6 @@ spdk_bdev_next_leaf(struct spdk_bdev *prev)
return bdev;
}
struct spdk_bdev *
spdk_bdev_get_by_name(const char *bdev_name)
{
struct spdk_bdev_alias *tmp;
struct spdk_bdev *bdev = spdk_bdev_first();
while (bdev != NULL) {
if (strcmp(bdev_name, bdev->name) == 0) {
return bdev;
}
TAILQ_FOREACH(tmp, &bdev->aliases, tailq) {
if (strcmp(bdev_name, tmp->alias) == 0) {
return bdev;
}
}
bdev = spdk_bdev_next(bdev);
}
return NULL;
}
void
spdk_bdev_io_set_buf(struct spdk_bdev_io *bdev_io, void *buf, size_t len)
{
@ -1953,26 +1974,7 @@ bdev_queue_io_wait_with_cb(struct spdk_bdev_io *bdev_io, spdk_bdev_io_wait_cb cb
}
static bool
bdev_io_type_can_split(uint8_t type)
{
assert(type != SPDK_BDEV_IO_TYPE_INVALID);
assert(type < SPDK_BDEV_NUM_IO_TYPES);
/* Only split READ and WRITE I/O. Theoretically other types of I/O like
* UNMAP could be split, but these types of I/O are typically much larger
* in size (sometimes the size of the entire block device), and the bdev
* module can more efficiently split these types of I/O. Plus those types
* of I/O do not have a payload, which makes the splitting process simpler.
*/
if (type == SPDK_BDEV_IO_TYPE_READ || type == SPDK_BDEV_IO_TYPE_WRITE) {
return true;
} else {
return false;
}
}
static bool
bdev_io_should_split(struct spdk_bdev_io *bdev_io)
bdev_rw_should_split(struct spdk_bdev_io *bdev_io)
{
uint32_t io_boundary = bdev_io->bdev->optimal_io_boundary;
uint32_t max_size = bdev_io->bdev->max_segment_size;
@ -1984,10 +1986,6 @@ bdev_io_should_split(struct spdk_bdev_io *bdev_io)
return false;
}
if (!bdev_io_type_can_split(bdev_io->type)) {
return false;
}
if (io_boundary) {
uint64_t start_stripe, end_stripe;
@ -2024,6 +2022,52 @@ bdev_io_should_split(struct spdk_bdev_io *bdev_io)
return false;
}
static bool
bdev_unmap_should_split(struct spdk_bdev_io *bdev_io)
{
uint32_t num_unmap_segments;
if (!bdev_io->bdev->max_unmap || !bdev_io->bdev->max_unmap_segments) {
return false;
}
num_unmap_segments = spdk_divide_round_up(bdev_io->u.bdev.num_blocks, bdev_io->bdev->max_unmap);
if (num_unmap_segments > bdev_io->bdev->max_unmap_segments) {
return true;
}
return false;
}
static bool
bdev_write_zeroes_should_split(struct spdk_bdev_io *bdev_io)
{
if (!bdev_io->bdev->max_write_zeroes) {
return false;
}
if (bdev_io->u.bdev.num_blocks > bdev_io->bdev->max_write_zeroes) {
return true;
}
return false;
}
static bool
bdev_io_should_split(struct spdk_bdev_io *bdev_io)
{
switch (bdev_io->type) {
case SPDK_BDEV_IO_TYPE_READ:
case SPDK_BDEV_IO_TYPE_WRITE:
return bdev_rw_should_split(bdev_io);
case SPDK_BDEV_IO_TYPE_UNMAP:
return bdev_unmap_should_split(bdev_io);
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
return bdev_write_zeroes_should_split(bdev_io);
default:
return false;
}
}
static uint32_t
_to_next_boundary(uint64_t offset, uint32_t boundary)
{
@ -2034,7 +2078,104 @@ static void
bdev_io_split_done(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg);
static void
_bdev_io_split(void *_bdev_io)
_bdev_rw_split(void *_bdev_io);
static void
bdev_unmap_split(struct spdk_bdev_io *bdev_io);
static void
_bdev_unmap_split(void *_bdev_io)
{
return bdev_unmap_split((struct spdk_bdev_io *)_bdev_io);
}
static void
bdev_write_zeroes_split(struct spdk_bdev_io *bdev_io);
static void
_bdev_write_zeroes_split(void *_bdev_io)
{
return bdev_write_zeroes_split((struct spdk_bdev_io *)_bdev_io);
}
static int
bdev_io_split_submit(struct spdk_bdev_io *bdev_io, struct iovec *iov, int iovcnt, void *md_buf,
uint64_t num_blocks, uint64_t *offset, uint64_t *remaining)
{
int rc;
uint64_t current_offset, current_remaining;
spdk_bdev_io_wait_cb io_wait_fn;
current_offset = *offset;
current_remaining = *remaining;
bdev_io->u.bdev.split_outstanding++;
io_wait_fn = _bdev_rw_split;
switch (bdev_io->type) {
case SPDK_BDEV_IO_TYPE_READ:
rc = bdev_readv_blocks_with_md(bdev_io->internal.desc,
spdk_io_channel_from_ctx(bdev_io->internal.ch),
iov, iovcnt, md_buf, current_offset,
num_blocks,
bdev_io_split_done, bdev_io);
break;
case SPDK_BDEV_IO_TYPE_WRITE:
rc = bdev_writev_blocks_with_md(bdev_io->internal.desc,
spdk_io_channel_from_ctx(bdev_io->internal.ch),
iov, iovcnt, md_buf, current_offset,
num_blocks,
bdev_io_split_done, bdev_io);
break;
case SPDK_BDEV_IO_TYPE_UNMAP:
io_wait_fn = _bdev_unmap_split;
rc = spdk_bdev_unmap_blocks(bdev_io->internal.desc,
spdk_io_channel_from_ctx(bdev_io->internal.ch),
current_offset, num_blocks,
bdev_io_split_done, bdev_io);
break;
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
io_wait_fn = _bdev_write_zeroes_split;
rc = spdk_bdev_write_zeroes_blocks(bdev_io->internal.desc,
spdk_io_channel_from_ctx(bdev_io->internal.ch),
current_offset, num_blocks,
bdev_io_split_done, bdev_io);
break;
default:
assert(false);
rc = -EINVAL;
break;
}
if (rc == 0) {
current_offset += num_blocks;
current_remaining -= num_blocks;
bdev_io->u.bdev.split_current_offset_blocks = current_offset;
bdev_io->u.bdev.split_remaining_num_blocks = current_remaining;
*offset = current_offset;
*remaining = current_remaining;
} else {
bdev_io->u.bdev.split_outstanding--;
if (rc == -ENOMEM) {
if (bdev_io->u.bdev.split_outstanding == 0) {
/* No I/O is outstanding. Hence we should wait here. */
bdev_queue_io_wait_with_cb(bdev_io, io_wait_fn);
}
} else {
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_FAILED;
if (bdev_io->u.bdev.split_outstanding == 0) {
spdk_trace_record(TRACE_BDEV_IO_DONE, 0, 0, (uintptr_t)bdev_io);
TAILQ_REMOVE(&bdev_io->internal.ch->io_submitted, bdev_io, internal.ch_link);
bdev_io->internal.cb(bdev_io, false, bdev_io->internal.caller_ctx);
}
}
}
return rc;
}
static void
_bdev_rw_split(void *_bdev_io)
{
struct iovec *parent_iov, *iov;
struct spdk_bdev_io *bdev_io = _bdev_io;
@ -2138,8 +2279,7 @@ _bdev_io_split(void *_bdev_io)
if (bdev_io->u.bdev.split_outstanding == 0) {
SPDK_ERRLOG("The first child io was less than a block size\n");
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_FAILED;
spdk_trace_record_tsc(spdk_get_ticks(), TRACE_BDEV_IO_DONE, 0, 0,
(uintptr_t)bdev_io, 0);
spdk_trace_record(TRACE_BDEV_IO_DONE, 0, 0, (uintptr_t)bdev_io);
TAILQ_REMOVE(&bdev_io->internal.ch->io_submitted, bdev_io, internal.ch_link);
bdev_io->internal.cb(bdev_io, false, bdev_io->internal.caller_ctx);
}
@ -2162,44 +2302,56 @@ _bdev_io_split(void *_bdev_io)
to_next_boundary -= to_next_boundary_bytes / blocklen;
}
bdev_io->u.bdev.split_outstanding++;
if (bdev_io->type == SPDK_BDEV_IO_TYPE_READ) {
rc = bdev_readv_blocks_with_md(bdev_io->internal.desc,
spdk_io_channel_from_ctx(bdev_io->internal.ch),
iov, iovcnt, md_buf, current_offset,
to_next_boundary,
bdev_io_split_done, bdev_io);
} else {
rc = bdev_writev_blocks_with_md(bdev_io->internal.desc,
spdk_io_channel_from_ctx(bdev_io->internal.ch),
iov, iovcnt, md_buf, current_offset,
to_next_boundary,
bdev_io_split_done, bdev_io);
rc = bdev_io_split_submit(bdev_io, iov, iovcnt, md_buf, to_next_boundary,
&current_offset, &remaining);
if (spdk_unlikely(rc)) {
return;
}
}
}
if (rc == 0) {
current_offset += to_next_boundary;
remaining -= to_next_boundary;
bdev_io->u.bdev.split_current_offset_blocks = current_offset;
bdev_io->u.bdev.split_remaining_num_blocks = remaining;
static void
bdev_unmap_split(struct spdk_bdev_io *bdev_io)
{
uint64_t offset, unmap_blocks, remaining, max_unmap_blocks;
uint32_t num_children_reqs = 0;
int rc;
offset = bdev_io->u.bdev.split_current_offset_blocks;
remaining = bdev_io->u.bdev.split_remaining_num_blocks;
max_unmap_blocks = bdev_io->bdev->max_unmap * bdev_io->bdev->max_unmap_segments;
while (remaining && (num_children_reqs < SPDK_BDEV_MAX_CHILDREN_UNMAP_WRITE_ZEROES_REQS)) {
unmap_blocks = spdk_min(remaining, max_unmap_blocks);
rc = bdev_io_split_submit(bdev_io, NULL, 0, NULL, unmap_blocks,
&offset, &remaining);
if (spdk_likely(rc == 0)) {
num_children_reqs++;
} else {
bdev_io->u.bdev.split_outstanding--;
if (rc == -ENOMEM) {
if (bdev_io->u.bdev.split_outstanding == 0) {
/* No I/O is outstanding. Hence we should wait here. */
bdev_queue_io_wait_with_cb(bdev_io, _bdev_io_split);
}
} else {
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_FAILED;
if (bdev_io->u.bdev.split_outstanding == 0) {
spdk_trace_record_tsc(spdk_get_ticks(), TRACE_BDEV_IO_DONE, 0, 0,
(uintptr_t)bdev_io, 0);
TAILQ_REMOVE(&bdev_io->internal.ch->io_submitted, bdev_io, internal.ch_link);
bdev_io->internal.cb(bdev_io, false, bdev_io->internal.caller_ctx);
}
}
return;
}
}
}
static void
bdev_write_zeroes_split(struct spdk_bdev_io *bdev_io)
{
uint64_t offset, write_zeroes_blocks, remaining;
uint32_t num_children_reqs = 0;
int rc;
offset = bdev_io->u.bdev.split_current_offset_blocks;
remaining = bdev_io->u.bdev.split_remaining_num_blocks;
while (remaining && (num_children_reqs < SPDK_BDEV_MAX_CHILDREN_UNMAP_WRITE_ZEROES_REQS)) {
write_zeroes_blocks = spdk_min(remaining, bdev_io->bdev->max_write_zeroes);
rc = bdev_io_split_submit(bdev_io, NULL, 0, NULL, write_zeroes_blocks,
&offset, &remaining);
if (spdk_likely(rc == 0)) {
num_children_reqs++;
} else {
return;
}
}
@ -2228,8 +2380,7 @@ bdev_io_split_done(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
*/
if (parent_io->u.bdev.split_remaining_num_blocks == 0) {
assert(parent_io->internal.cb != bdev_io_split_done);
spdk_trace_record_tsc(spdk_get_ticks(), TRACE_BDEV_IO_DONE, 0, 0,
(uintptr_t)parent_io, 0);
spdk_trace_record(TRACE_BDEV_IO_DONE, 0, 0, (uintptr_t)parent_io);
TAILQ_REMOVE(&parent_io->internal.ch->io_submitted, parent_io, internal.ch_link);
parent_io->internal.cb(parent_io, parent_io->internal.status == SPDK_BDEV_IO_STATUS_SUCCESS,
parent_io->internal.caller_ctx);
@ -2240,40 +2391,66 @@ bdev_io_split_done(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
* Continue with the splitting process. This function will complete the parent I/O if the
* splitting is done.
*/
_bdev_io_split(parent_io);
switch (parent_io->type) {
case SPDK_BDEV_IO_TYPE_READ:
case SPDK_BDEV_IO_TYPE_WRITE:
_bdev_rw_split(parent_io);
break;
case SPDK_BDEV_IO_TYPE_UNMAP:
bdev_unmap_split(parent_io);
break;
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
bdev_write_zeroes_split(parent_io);
break;
default:
assert(false);
break;
}
}
static void
bdev_io_split_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bool success);
bdev_rw_split_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bool success);
static void
bdev_io_split(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
{
assert(bdev_io_type_can_split(bdev_io->type));
bdev_io->u.bdev.split_current_offset_blocks = bdev_io->u.bdev.offset_blocks;
bdev_io->u.bdev.split_remaining_num_blocks = bdev_io->u.bdev.num_blocks;
bdev_io->u.bdev.split_outstanding = 0;
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_SUCCESS;
if (_is_buf_allocated(bdev_io->u.bdev.iovs)) {
_bdev_io_split(bdev_io);
} else {
assert(bdev_io->type == SPDK_BDEV_IO_TYPE_READ);
spdk_bdev_io_get_buf(bdev_io, bdev_io_split_get_buf_cb,
bdev_io->u.bdev.num_blocks * bdev_io->bdev->blocklen);
switch (bdev_io->type) {
case SPDK_BDEV_IO_TYPE_READ:
case SPDK_BDEV_IO_TYPE_WRITE:
if (_is_buf_allocated(bdev_io->u.bdev.iovs)) {
_bdev_rw_split(bdev_io);
} else {
assert(bdev_io->type == SPDK_BDEV_IO_TYPE_READ);
spdk_bdev_io_get_buf(bdev_io, bdev_rw_split_get_buf_cb,
bdev_io->u.bdev.num_blocks * bdev_io->bdev->blocklen);
}
break;
case SPDK_BDEV_IO_TYPE_UNMAP:
bdev_unmap_split(bdev_io);
break;
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
bdev_write_zeroes_split(bdev_io);
break;
default:
assert(false);
break;
}
}
static void
bdev_io_split_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bool success)
bdev_rw_split_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bool success)
{
if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
_bdev_io_split(bdev_io);
_bdev_rw_split(bdev_io);
}
/* Explicitly mark this inline, since it's used as a function pointer and otherwise won't
@ -2467,11 +2644,6 @@ spdk_bdev_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type io_ty
/* The bdev layer will emulate write zeroes as long as write is supported. */
supported = bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_WRITE);
break;
case SPDK_BDEV_IO_TYPE_ZCOPY:
/* Zero copy can be emulated with regular read and write */
supported = bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_READ) &&
bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_WRITE);
break;
default:
break;
}
@ -3073,32 +3245,64 @@ bdev_channel_destroy(void *io_device, void *ctx_buf)
bdev_channel_destroy_resource(ch);
}
/*
* If the name already exists in the global bdev name tree, RB_INSERT() returns a pointer
* to it. Hence we do not have to call bdev_get_by_name() when using this function.
*/
static int
bdev_name_add(struct spdk_bdev_name *bdev_name, struct spdk_bdev *bdev, const char *name)
{
struct spdk_bdev_name *tmp;
bdev_name->name = strdup(name);
if (bdev_name->name == NULL) {
SPDK_ERRLOG("Unable to allocate bdev name\n");
return -ENOMEM;
}
bdev_name->bdev = bdev;
pthread_mutex_lock(&g_bdev_mgr.mutex);
tmp = RB_INSERT(bdev_name_tree, &g_bdev_mgr.bdev_names, bdev_name);
pthread_mutex_unlock(&g_bdev_mgr.mutex);
if (tmp != NULL) {
SPDK_ERRLOG("Bdev name %s already exists\n", name);
free(bdev_name->name);
return -EEXIST;
}
return 0;
}
static void
bdev_name_del(struct spdk_bdev_name *bdev_name)
{
RB_REMOVE(bdev_name_tree, &g_bdev_mgr.bdev_names, bdev_name);
free(bdev_name->name);
}
int
spdk_bdev_alias_add(struct spdk_bdev *bdev, const char *alias)
{
struct spdk_bdev_alias *tmp;
int ret;
if (alias == NULL) {
SPDK_ERRLOG("Empty alias passed\n");
return -EINVAL;
}
if (spdk_bdev_get_by_name(alias)) {
SPDK_ERRLOG("Bdev name/alias: %s already exists\n", alias);
return -EEXIST;
}
tmp = calloc(1, sizeof(*tmp));
if (tmp == NULL) {
SPDK_ERRLOG("Unable to allocate alias\n");
return -ENOMEM;
}
tmp->alias = strdup(alias);
if (tmp->alias == NULL) {
ret = bdev_name_add(&tmp->alias, bdev, alias);
if (ret != 0) {
free(tmp);
SPDK_ERRLOG("Unable to allocate alias\n");
return -ENOMEM;
return ret;
}
TAILQ_INSERT_TAIL(&bdev->aliases, tmp, tailq);
@ -3112,9 +3316,11 @@ spdk_bdev_alias_del(struct spdk_bdev *bdev, const char *alias)
struct spdk_bdev_alias *tmp;
TAILQ_FOREACH(tmp, &bdev->aliases, tailq) {
if (strcmp(alias, tmp->alias) == 0) {
if (strcmp(alias, tmp->alias.name) == 0) {
TAILQ_REMOVE(&bdev->aliases, tmp, tailq);
free(tmp->alias);
pthread_mutex_lock(&g_bdev_mgr.mutex);
bdev_name_del(&tmp->alias);
pthread_mutex_unlock(&g_bdev_mgr.mutex);
free(tmp);
return 0;
}
@ -3132,7 +3338,9 @@ spdk_bdev_alias_del_all(struct spdk_bdev *bdev)
TAILQ_FOREACH_SAFE(p, &bdev->aliases, tailq, tmp) {
TAILQ_REMOVE(&bdev->aliases, p, tailq);
free(p->alias);
pthread_mutex_lock(&g_bdev_mgr.mutex);
bdev_name_del(&p->alias);
pthread_mutex_unlock(&g_bdev_mgr.mutex);
free(p);
}
}
@ -3291,6 +3499,12 @@ spdk_bdev_get_data_block_size(const struct spdk_bdev *bdev)
}
}
uint32_t
spdk_bdev_get_physical_block_size(const struct spdk_bdev *bdev)
{
return bdev->phys_blocklen;
}
static uint32_t
_bdev_get_block_size_with_md(const struct spdk_bdev *bdev)
{
@ -3524,7 +3738,7 @@ _bdev_io_check_md_buf(const struct iovec *iovs, const void *md_buf)
static int
bdev_read_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, void *buf,
void *md_buf, int64_t offset_blocks, uint64_t num_blocks,
void *md_buf, uint64_t offset_blocks, uint64_t num_blocks,
spdk_bdev_io_completion_cb cb, void *cb_arg)
{
struct spdk_bdev *bdev = spdk_bdev_desc_get_bdev(desc);
@ -3581,7 +3795,7 @@ spdk_bdev_read_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
int
spdk_bdev_read_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
void *buf, void *md_buf, int64_t offset_blocks, uint64_t num_blocks,
void *buf, void *md_buf, uint64_t offset_blocks, uint64_t num_blocks,
spdk_bdev_io_completion_cb cb, void *cb_arg)
{
struct iovec iov = {
@ -4184,31 +4398,9 @@ spdk_bdev_comparev_and_writev_blocks(struct spdk_bdev_desc *desc, struct spdk_io
bdev_comparev_and_writev_blocks_locked, bdev_io);
}
static void
bdev_zcopy_get_buf(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bool success)
{
if (!success) {
/* Don't use spdk_bdev_io_complete here - this bdev_io was never actually submitted. */
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_NOMEM;
bdev_io->internal.cb(bdev_io, success, bdev_io->internal.caller_ctx);
return;
}
if (bdev_io->u.bdev.zcopy.populate) {
/* Read the real data into the buffer */
bdev_io->type = SPDK_BDEV_IO_TYPE_READ;
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_PENDING;
bdev_io_submit(bdev_io);
return;
}
/* Don't use spdk_bdev_io_complete here - this bdev_io was never actually submitted. */
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_SUCCESS;
bdev_io->internal.cb(bdev_io, success, bdev_io->internal.caller_ctx);
}
int
spdk_bdev_zcopy_start(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
struct iovec *iov, int iovcnt,
uint64_t offset_blocks, uint64_t num_blocks,
bool populate,
spdk_bdev_io_completion_cb cb, void *cb_arg)
@ -4239,21 +4431,15 @@ spdk_bdev_zcopy_start(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
bdev_io->type = SPDK_BDEV_IO_TYPE_ZCOPY;
bdev_io->u.bdev.num_blocks = num_blocks;
bdev_io->u.bdev.offset_blocks = offset_blocks;
bdev_io->u.bdev.iovs = NULL;
bdev_io->u.bdev.iovcnt = 0;
bdev_io->u.bdev.iovs = iov;
bdev_io->u.bdev.iovcnt = iovcnt;
bdev_io->u.bdev.md_buf = NULL;
bdev_io->u.bdev.zcopy.populate = populate ? 1 : 0;
bdev_io->u.bdev.zcopy.commit = 0;
bdev_io->u.bdev.zcopy.start = 1;
bdev_io_init(bdev_io, bdev, cb_arg, cb);
if (bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_ZCOPY)) {
bdev_io_submit(bdev_io);
} else {
/* Emulate zcopy by allocating a buffer */
spdk_bdev_io_get_buf(bdev_io, bdev_zcopy_get_buf,
bdev_io->u.bdev.num_blocks * bdev->blocklen);
}
bdev_io_submit(bdev_io);
return 0;
}
@ -4262,16 +4448,6 @@ int
spdk_bdev_zcopy_end(struct spdk_bdev_io *bdev_io, bool commit,
spdk_bdev_io_completion_cb cb, void *cb_arg)
{
struct spdk_bdev *bdev = bdev_io->bdev;
if (bdev_io->type == SPDK_BDEV_IO_TYPE_READ) {
/* This can happen if the zcopy was emulated in start */
if (bdev_io->u.bdev.zcopy.start != 1) {
return -EINVAL;
}
bdev_io->type = SPDK_BDEV_IO_TYPE_ZCOPY;
}
if (bdev_io->type != SPDK_BDEV_IO_TYPE_ZCOPY) {
return -EINVAL;
}
@ -4282,19 +4458,6 @@ spdk_bdev_zcopy_end(struct spdk_bdev_io *bdev_io, bool commit,
bdev_io->internal.cb = cb;
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_PENDING;
if (bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_ZCOPY)) {
bdev_io_submit(bdev_io);
return 0;
}
if (!bdev_io->u.bdev.zcopy.commit) {
/* Don't use spdk_bdev_io_complete here - this bdev_io was never actually submitted. */
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_SUCCESS;
bdev_io->internal.cb(bdev_io, true, bdev_io->internal.caller_ctx);
return 0;
}
bdev_io->type = SPDK_BDEV_IO_TYPE_WRITE;
bdev_io_submit(bdev_io);
return 0;
@ -5062,7 +5225,7 @@ bdev_io_complete(void *ctx)
tsc = spdk_get_ticks();
tsc_diff = tsc - bdev_io->internal.submit_tsc;
spdk_trace_record_tsc(tsc, TRACE_BDEV_IO_DONE, 0, 0, (uintptr_t)bdev_io, 0);
spdk_trace_record_tsc(tsc, TRACE_BDEV_IO_DONE, 0, 0, (uintptr_t)bdev_io);
TAILQ_REMOVE(&bdev_ch->io_submitted, bdev_io, internal.ch_link);
@ -5404,9 +5567,10 @@ spdk_bdev_io_get_io_channel(struct spdk_bdev_io *bdev_io)
}
static int
bdev_init(struct spdk_bdev *bdev)
bdev_register(struct spdk_bdev *bdev)
{
char *bdev_name;
int ret;
assert(bdev->module != NULL);
@ -5420,11 +5584,6 @@ bdev_init(struct spdk_bdev *bdev)
return -EINVAL;
}
if (spdk_bdev_get_by_name(bdev->name)) {
SPDK_ERRLOG("Bdev name:%s already exists\n", bdev->name);
return -EEXIST;
}
/* Users often register their own I/O devices using the bdev name. In
* order to avoid conflicts, prepend bdev_. */
bdev_name = spdk_sprintf_alloc("bdev_%s", bdev->name);
@ -5439,6 +5598,12 @@ bdev_init(struct spdk_bdev *bdev)
bdev->internal.qd_poller = NULL;
bdev->internal.qos = NULL;
ret = bdev_name_add(&bdev->internal.bdev_name, bdev, bdev->name);
if (ret != 0) {
free(bdev_name);
return ret;
}
/* If the user didn't specify a uuid, generate one. */
if (spdk_mem_all_zero(&bdev->uuid, sizeof(bdev->uuid))) {
spdk_uuid_generate(&bdev->uuid);
@ -5464,6 +5629,10 @@ bdev_init(struct spdk_bdev *bdev)
bdev->acwu = 1;
}
if (bdev->phys_blocklen == 0) {
bdev->phys_blocklen = spdk_bdev_get_data_block_size(bdev);
}
TAILQ_INIT(&bdev->internal.open_descs);
TAILQ_INIT(&bdev->internal.locked_ranges);
TAILQ_INIT(&bdev->internal.pending_locked_ranges);
@ -5480,6 +5649,10 @@ bdev_init(struct spdk_bdev *bdev)
free(bdev_name);
pthread_mutex_init(&bdev->internal.mutex, NULL);
SPDK_DEBUGLOG(bdev, "Inserting bdev %s into list\n", bdev->name);
TAILQ_INSERT_TAIL(&g_bdev_mgr.bdevs, bdev, internal.link);
return 0;
}
@ -5508,32 +5681,23 @@ bdev_destroy_cb(void *io_device)
}
static void
bdev_start_finished(void *arg)
bdev_register_finished(void *arg)
{
struct spdk_bdev *bdev = arg;
spdk_notify_send("bdev_register", spdk_bdev_get_name(bdev));
}
static void
bdev_start(struct spdk_bdev *bdev)
{
SPDK_DEBUGLOG(bdev, "Inserting bdev %s into list\n", bdev->name);
TAILQ_INSERT_TAIL(&g_bdev_mgr.bdevs, bdev, internal.link);
/* Examine configuration before initializing I/O */
bdev_examine(bdev);
spdk_bdev_wait_for_examine(bdev_start_finished, bdev);
}
int
spdk_bdev_register(struct spdk_bdev *bdev)
{
int rc = bdev_init(bdev);
int rc = bdev_register(bdev);
if (rc == 0) {
bdev_start(bdev);
/* Examine configuration before initializing I/O */
bdev_examine(bdev);
spdk_bdev_wait_for_examine(bdev_register_finished, bdev);
}
return rc;
@ -5599,6 +5763,7 @@ bdev_unregister_unsafe(struct spdk_bdev *bdev)
if (rc == 0) {
TAILQ_REMOVE(&g_bdev_mgr.bdevs, bdev, internal.link);
SPDK_DEBUGLOG(bdev, "Removing bdev %s from list done\n", bdev->name);
bdev_name_del(&bdev->internal.bdev_name);
spdk_notify_send("bdev_unregister", spdk_bdev_get_name(bdev));
}
@ -5729,7 +5894,7 @@ spdk_bdev_open_ext(const char *bdev_name, bool write, spdk_bdev_event_cb_t event
pthread_mutex_lock(&g_bdev_mgr.mutex);
bdev = spdk_bdev_get_by_name(bdev_name);
bdev = bdev_get_by_name(bdev_name);
if (bdev == NULL) {
SPDK_NOTICELOG("Currently unable to find bdev with name: %s\n", bdev_name);
@ -5793,6 +5958,7 @@ spdk_bdev_close(struct spdk_bdev_desc *desc)
spdk_poller_unregister(&desc->io_timeout_poller);
pthread_mutex_lock(&g_bdev_mgr.mutex);
pthread_mutex_lock(&bdev->internal.mutex);
pthread_mutex_lock(&desc->mutex);
@ -5825,12 +5991,14 @@ spdk_bdev_close(struct spdk_bdev_desc *desc)
if (bdev->internal.status == SPDK_BDEV_STATUS_REMOVING && TAILQ_EMPTY(&bdev->internal.open_descs)) {
rc = bdev_unregister_unsafe(bdev);
pthread_mutex_unlock(&bdev->internal.mutex);
pthread_mutex_unlock(&g_bdev_mgr.mutex);
if (rc == 0) {
spdk_io_device_unregister(__bdev_to_io_dev(bdev), bdev_destroy_cb);
}
} else {
pthread_mutex_unlock(&bdev->internal.mutex);
pthread_mutex_unlock(&g_bdev_mgr.mutex);
}
}
@ -6637,7 +6805,7 @@ bdev_lock_lba_range_get_channel(struct spdk_io_channel_iter *i)
static void
bdev_lock_lba_range_ctx(struct spdk_bdev *bdev, struct locked_lba_range_ctx *ctx)
{
assert(spdk_get_thread() == ctx->range.owner_ch->channel->thread);
assert(spdk_get_thread() == spdk_io_channel_get_thread(ctx->range.owner_ch->channel));
/* We will add a copy of this range to each channel now. */
spdk_for_each_channel(__bdev_to_io_dev(bdev), bdev_lock_lba_range_get_channel, ctx,
@ -6728,7 +6896,7 @@ bdev_unlock_lba_range_cb(struct spdk_io_channel_iter *i, int status)
TAILQ_REMOVE(&bdev->internal.pending_locked_ranges, range, tailq);
pending_ctx = SPDK_CONTAINEROF(range, struct locked_lba_range_ctx, range);
TAILQ_INSERT_TAIL(&bdev->internal.locked_ranges, range, tailq);
spdk_thread_send_msg(pending_ctx->range.owner_ch->channel->thread,
spdk_thread_send_msg(spdk_io_channel_get_thread(pending_ctx->range.owner_ch->channel),
bdev_lock_lba_range_ctx_msg, pending_ctx);
}
}
@ -6846,7 +7014,9 @@ SPDK_TRACE_REGISTER_FN(bdev_trace, "bdev", TRACE_GROUP_BDEV)
spdk_trace_register_owner(OWNER_BDEV, 'b');
spdk_trace_register_object(OBJECT_BDEV_IO, 'i');
spdk_trace_register_description("BDEV_IO_START", TRACE_BDEV_IO_START, OWNER_BDEV,
OBJECT_BDEV_IO, 1, 0, "type: ");
OBJECT_BDEV_IO, 1,
SPDK_TRACE_ARG_TYPE_INT, "type");
spdk_trace_register_description("BDEV_IO_DONE", TRACE_BDEV_IO_DONE, OWNER_BDEV,
OBJECT_BDEV_IO, 0, 0, "");
OBJECT_BDEV_IO, 0,
SPDK_TRACE_ARG_TYPE_INT, "");
}

Some files were not shown because too many files have changed in this diff Show More