Commit Graph

10193 Commits

Author SHA1 Message Date
Konrad Sztyber
9beb6b163c bdev: fix completion for unsubmitted IOs
If an IO is completed, before submitting it to a module, it isn't put on
the io_submitted list, so we can't use bdev_io_complete() to complete
it, as it'll break that list.  To avoid that, a new function was added,
bdev_io_complete_unsubmitted(), that will safely complete the IOs in
such case.  For now, it's equivalent to executing user's completion
callback, but it'll serve as a good place to release any resources that
should be freed before an IO is completed.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I1442ead9d272d9210553803bed1d1c989a2bf761
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16970
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-03-13 21:02:27 +00:00
Konrad Sztyber
7b71fdc28c accel: move spdk_accel_get_memory_domain() to accel.h
This function can be useful in places other than accel modules (e.g. to
check if a buffer belongs to accel), so it needs to be declared in
accel.h.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I8fdd58b2ed40dc4a4acce2a8d3e1c5f76944c929
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16969
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-03-13 21:02:27 +00:00
Konrad Sztyber
4832235759 accel: re-enable iobuf thread caches
They were disabled before the v23.01 release, because none of the other
libraries were using the new spdk_accel_append_* API.  But now, they
will be used in the bdev layer and bdev modules, so they need to be
re-enabled.  We're using the same values as we do in the bdev layer.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ibda86ca5619e4104e107048ce0965171501fdc5a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16968
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-03-13 21:02:27 +00:00
zhipeng Lu
216991edec vhost_rpc:add sessions information for vhost_get_controllers
we can get sessions information by vhost_get_controllers

Signed-off-by: zhipeng Lu <luzhipeng@cestc.cn>
Change-Id: I8e63aea64d02b3467a62f30a712e1dcbf6fb8854
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16315
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
2023-03-13 07:59:08 +00:00
Mike Gerdts
a4a73fec9c blob: pass bs context with esnap_bs_dev_create
When a blobstore consumer creates or loads a blobstore, it should be
able to set a per-blobstore context pointer that will be passed back to
the consumer via bs->esnap_bs_dev_create().

Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Change-Id: I59c0ebe21eaf65c3d79a4ac3469715283f56313a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14970
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2023-03-13 07:57:24 +00:00
Tomasz Zawadzki
1e39a6df17 lib/nvme_rdma: return negated error from nvme_rdma_parse_addr
All paths in nvme_rdma_parse_addr(), except the one in this patch
already returned negated error values, so fix it.

Change-Id: I615956e4139f70bfc171bcab94e6e89f60e62ac3
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17098
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-03-10 16:44:37 +00:00
Tomasz Zawadzki
f6866117ac freebsd: return negated error from getaddrinfo()
On FreeBSD getaddrinfo() report positive error code
values, meanwhile Linux does it with negative ones.

Make sure that regardless of the system used,
error codes with same sign are reported.
This can be observed in the log reported in #2936.

Besides the above, in some instances replaced EINVAL
with the actual return value.

Change-Id: I7f88c314bdf5c3a03f8661c2213e33b2fc276ef7
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17097
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-03-10 16:44:37 +00:00
Tomasz Zawadzki
f92411c4da lib/nvme_tcp: check destination port before parsing address
nvme_tcp_parse_addr() uses getaddrinfo() to parse the address.
Depending on the system behavior of this function differs.
On FreeBSD the port is verified not to be exceeding 65535
for IPv4, meanwhile Linux does not check it at this point.

test_nvme_tcp_qpair_connect_sock() UT was attempting to
test the code path that is moved in this patch, but
on FreeBSD was encountering failure during getaddrinfo()
with different error code.

This patch moves the destination port check before
parsing addresses to take the same path regardless of
the system used.

Fixes #2936

Change-Id: I271e8c32e07a15dcf0e0ee7e90dd174c96b18858
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17095
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-03-10 16:44:37 +00:00
Alexey Marchuk
ada9333423 nvme/tcp: Report correct max sge
NVME TCP driver supports up to 16 sge elements
while only 1 sge is reported - that leads to
unnecessary requests split which degrades perf.
Also pass correct iovcnt to nvme_tcp_build_iovs -
it should be 32. Otherwise, pdu header consumes
1 iov and data is written partially.
Add a check that at least data_len bytes were
appended to the socket iovs and fail request
otherwise.

Signed-off-by: Alexey Marchuk <alexeymar@nvidia.com>
Change-Id: Ie83c807dd3fec2c7e7cbcda1e493d6fd74ebe599
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17006
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
2023-03-10 11:43:40 +00:00
Krzysztof Karas
a8f7d7cf0a trace: update description of tracepoint number
Make it clear that number of entries might not be equal
to the number of recorded traces, as some of the latter
might occupy two entries due to their length.

Change-Id: I3099cfb719c38bdee48fbe20fccef3ef43e820a3
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16916
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
2023-03-10 11:42:23 +00:00
Shuhei Matsumoto
7413e1e497 nvme: Initialize cpl->sqid when aborting requests for RDMA and TCP
nvme_rdma_qpair_abort_reqs() and nvme_tcp_qpair_abort_reqs() did not
initialize cpl->sqid. Hence, unexpected message was printed by
spdk_nvme_print_completion(). Fix the bugs in this patch.

Fixes #2930

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I8b41166e58b26ce22c453ab85794b46dbe3dd3a2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17067
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-03-09 23:31:15 +00:00
Shuhei Matsumoto
a475aed55d nvme_pcie: Call transport_ctrlr_disconnect_qpair_done() if ctrlr_disable_poll() failed
nvme_ctrlr_disable_poll() continued to be called until it returned 0.
However, if the corresponding drive was unresponsive, the continuous
calls consumed CPU and affected other operations.

If the corresponding drive is unresponsive, we cannot complete disabling
the controller. Hence, call nvme_transport_ctrlr_disconnect_qpair_done()
if nvme_ctrlr_disable_poll() returned any value other than -EAGAIN.

Even before this patch, nvme_ctrlr_disable_poll() collected an error log
if it failed. Hence, we do not have to add more error logs.

Fixes issue #2931

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I26cabb94e5744e3a2d975670adbf2e4e48d5bd7a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17002
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-03-09 23:31:15 +00:00
Shuhei Matsumoto
cb2a73304b nvme_pcie: Fix nvme_qpair_abort_all_queued_reqs() to be called for adminq
By the patch 736b9da034
nvme_qpair_abort_all_queued_reqs() was changed to be called after the
adminq is actually disconnected.

However, the patch ac31590b37
unexpectedly disabled to call nvme_qpair_abort_all_queued_reqs() for
adminq because qpair->active_proc is NULL for adminq.

Add one more condition to nvme_transport_ctrlr_disconnect_qpair_done().

Fixes issue #2928

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: Ic65f4cd952e6e89275788ff4b86ceca050f624d5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17001
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-03-09 23:31:15 +00:00
Ankit Kumar
eb37d519b8 lib/nvme: include dword 13 field to extendable command structure
Add command dword 13 field to the extendable structure
spdk_nvme_ns_cmd_ext_io_opts. This now enables us to pass dspec
and dsm fields.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Change-Id: Id4d3dac14fdbf0e2a57e0bf287551dfd827dd503
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16945
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Community-CI: Mellanox Build Bot
2023-03-09 23:22:41 +00:00
Swapnil Ingle
1afb1effc4 nvmf/vfio_user: simplify cq_is_full()
Made cq_is_full() as wrapper around cq_free_slots()

Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Change-Id: I392f62e959c7e23b4360e77759027ea55c2398b9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16789
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: John Levon <levon@movementarian.org>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2023-03-08 08:45:00 +00:00
Swapnil Ingle
23b518a013 nvmf/vfio_user: mitigate cq full race
Linux host nvme driver processes all pending cqe's in one batch along with
completing backing blk_mq req's and later rings cq_doorbell once for all
processed cqes.
As blk_mq req's are completed there is room for more submissions
before ringing cq_doorbell.

This may race with vfio_user cq_is_full() which uses cq_doorbell to make final
decision and as host has not updated cq_doorbell we fail with cq_full error.

To mitigate this only process commands from sq which have free cq slot.

Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Change-Id: I0cefb41df8099eb71de25923d05a9fcb28e4d124
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16788
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2023-03-08 08:45:00 +00:00
Rui Chang
8613654074 bdev: Add default copy command support in bdev
Add default copy command support in bdev layer for backing devices that
does not support copy command.

Signed-off-by: Rui Chang <rui.chang@arm.com>
Change-Id: I5632e25544e95ac0c53ff91c4cd135dac53323ae
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16638
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2023-03-07 11:52:45 +00:00
sijie.sun
e44d631724 nvme_rdma: handle DEVICE_REMOVAL event in RDMA initiator
When IBV_EVENT_DEVICE_FATAL & RDMA_CM_EVENT_DEVICE_REMOVAL occurs,
destroy qpair immediately and do no assume that no successful WQE will
be received after rdma_disconnect.

Signed-off-by: sijie.sun <sijie.sun@smartx.com>
Change-Id: I23e44dd32c8adea301e5251659b1be519f5dfdf7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16314
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
2023-03-07 11:50:05 +00:00
sijie.sun
549be9ad81 nvmf/rdma: Recreate resources and listeners after IB device is hotplugged
IB device may be unplugged & hotplugged when modifying slaves of bonding
IB devices. This patch will try to recreate ibv device contexts, poller
and listeners after IB devices come back.

Signed-off-by: sijie.sun <sijie.sun@smartx.com>
Change-Id: I3288174bad847edc2d9859cb34aa93c6af8c673b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15616
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
2023-03-07 11:50:05 +00:00
sijie.sun
8ddc5cd4a7 nvmf/rdma: Destroy all related resources after IB device removed
When IBV_EVENT_DEVICE_FATAL & RDMA_CM_EVENT_DEVICE_REMOVAL occurs,
destory all userspace resources such as qp, poller and ibv_context.

Signed-off-by: sijie.sun <sijie.sun@smartx.com>
Change-Id: Ie4832e4804eb572d6ec3bdc44fb7f9339f443d7e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15615
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-03-07 11:50:05 +00:00
Jim Harris
584d295245 nvmf/fc: fix memleaks
Submitted by @udayawati via GitHub comment on
issue #2872.

Fixes issue #2872.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16932
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2023-03-06 13:21:38 +00:00
Mike Gerdts
ce67e0c787 blob: clones of external snapshots
This is the beginning of support for external snapshots. An external
snapshot is a read-only blobstore device (struct spdk_bs_dev) that can
be used as a blob's back device. Normally a blob will have no back
device (a normal blob), a zeroes back device (a thin provisioned blob),
or a blob back device (a clone blob). When a blob has an external
snapshot ("esnap") as its back device, it is called an esnap clone.

With this patch, esnap clones can be created but they are not yet
useful. Subsequent patches in the series will plumb the IO path, enable
various features, and allow lvol bdevs to be esnap clones.

Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Change-Id: I29206b628a2b03b6386a88532565e228df988e0e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14969
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-03-03 11:25:35 +00:00
Marcin Spiewak
fa272c9bc6 lib/idxd: Removed SPDK_IDXD_FLAG_PERSISTENT flag
Removed SPDK_IDXD_FLAG_PERSISTENT flag and associated code.

Change-Id: Ib4e038794792ae9866bdf344f1ec58dd04dbd483
Signed-off-by: Marcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16986
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>
2023-03-03 11:20:03 +00:00
Marcin Spiewak
27d5b38523 lib/accel: remove PMEM support from accel library
This patch removes references to deprecated PMEM from accel library.
The code that was executed when ACCEL_FLAG_PERSISTENT flag is set,
is no longer needed and is removed.

_sw_accel_copy() function is removed and replaced with memcpy(), as
after PMEM removal its functionality is the same as memcpy().

_sw_accel_dualcast() is no longer needed, replaced with direct calls
to memcpy()

Removed 'flags' parameter - it is no longer needed

accel_ut.c: removed references to PMDK

deprecation.md updated

ACCEL_FLAG_PERSISTENT flag will be removed in next patch.

Change-Id: I86130466fe7a5f6ee547df1517b803035ff41a7a
Signed-off-by: Marcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16899
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
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>
2023-03-03 11:20:03 +00:00
Konrad Sztyber
e6a8401a1d accel: execute accel sequences using a driver
If a driver is registered and selected, it'll now be used to execute
sequences of accel operations.  The driver has priority over accel
modules, so the modules will only be used to execute operations that the
driver cannot perform.

Once driver completes a task (or a number of tasks), it notifies accel
using standard spdk_accel_task_complete().  To let accel continue
processing a sequence, driver can call spdk_accel_sequence_continue().
This can be done when the driver executes all tasks (1), an error occurs
(2), or the driver doesn't know how to execute a given opcode (3).  In
case of (3), that operation will be executed using appropriate accel
module and, while the rest of the sequence will be sent back to the
driver.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: If414c02073ffc731454e03d25c7ee02bef58463b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16548
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2023-03-01 09:46:40 +00:00
Richael Zhuang
fed358a0e7 util: fix misaligned load for uint64_t type
The following error was reported when running gpt_ut which is related
to crc32_update().
"load of misaligned address 0x001ffeff78cc for type 'const uint64_t',
which requires 8 byte alignment".

This patch preprocesses the first several bytes to make the buf address
passed to __crc32_d or__crc32_cd is 8 byte aligned. And finally process
the trailing bytes.

For function spdk_crc32c_update in crc32c.c, memcpy was used to avoid
misaligned load problem. Update it with above solution to reduce extra
overhead.

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: I7c7aaa41e1c042a96668158818b06729fb3ceec6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16801
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>
2023-03-01 08:56:01 +00:00
Sebastian Brzezinka
57bd108ad7 lib/blob: notify user when bs_create_blob fail
This patch fix issue: #2346

Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Change-Id: Ibbc95bcf47300653066a85769536853e7608f213
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16758
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-03-01 08:55:43 +00:00
Jacek Kalwas
019cbb9335 nvmf: disable data buf mempool cache
Depending on the number of cores there are sporadic issues getting
elements of that pool although free elements are there during poll
group creation. Operation returns -ENOBUF. It results in odd notice
msg.

"nvmf_transport_poll_group_create: *NOTICE*: Unable to reserve the
full number of buffers for the pg buffer cache. Decrease the number of
cached buffers from 455 to 1366"

In this case 1366 is the actual number of available elements in the
pool. Few poll groups suceeds and few are ending up with the buffer
cache size set to 0.

Issue has been rootcaused as bug or behaviour change in DPDK v22.01.

Consider example:
We create DPDK mempool with 4K buffers, cache of 256. When first poll
group requests 512 buffers, DPDK mempool first looks in its per-core
cache, sees no buffers (mempool buffer cache doesn't get prepopulated)
and then requests 512 + 256 buffers from the backing pool. It returns
512 of the buffers to the user, and puts the other 256 buffers in the
cache ...it should only request 512 buffers total. For 8 cores and 512
buffers requested only 5 cores will get their buffers.

Disabling mempool cache seems to workaround the issue. More effective
cache is already implemented on nvmf generic layer.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I3149dea95a4f24a75dd0074eda9468c4856d901d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16913
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>
2023-02-28 08:57:23 +00:00
Krzysztof Karas
b9298bf908 core locks: add error checking to unclaiming
Add error check to unclaim mechanism. Issue #2920
showed that unclaiming CPU locks might fail and
we should catch errors to determine the cause.

Change-Id: Ifdfb7db2595d73f8bae13418ef145ad80e1d07ef
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16958
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>
2023-02-28 08:57:13 +00:00
Krzysztof Karas
7e88ff9e99 uuid: add spdk_uuid_generate_sha1()
Add implementation of uuid_generate_sha1() for systems
that do not have this function in their system libraries.

Use uuid_generate_sha1 from uuid.h inside a new function
spdk_uuid_generate_sha1(). The reason for this addition
is to prepare for UUID generation correction to conform
to standards.

First part of series addressing #2788.

Change-Id: Ib357aa1ee832e886288d176d8a47efdaa326f537
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16414
Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@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
2023-02-28 08:57:01 +00:00
Ben Walker
07ca24ec59 thread: Add spdk_thread_get_interrupt_fd_group that returns spdk_fd_group
Return the real spdk_fd_group object so it can later be nested.

Change-Id: I84c8a174c7d177799fa484b350269082c61b18a5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15474
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: John Levon <levon@movementarian.org>
2023-02-28 08:52:27 +00:00
Ben Walker
059073c4d9 thread: In interrupt mode, exit thread by sending a message
Don't assume spdk_thread_poll() will ever get called. Instead, send
a message to process the exit.

Change-Id: Idd98e7e8164c5efebd0d7c9287e62731e7cbc998
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15551
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>
Reviewed-by: John Levon <levon@movementarian.org>
2023-02-28 08:52:27 +00:00
Ben Walker
5ecfb22192 thread: In interrupt mode, remove pollers by sending a message
Move away from relying on spdk_thread_poll() to do clean up in interrupt
mode. In the future, we don't want to have spdk_thread_poll() called at
all.

Change-Id: I5318a7889601a3d3463e35419918b7305f68ee8d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15550
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: John Levon <levon@movementarian.org>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-02-28 08:52:27 +00:00
Ben Walker
f3c1b59a29 thread: Always wrap interrupt handlers to set the thread correctly
Eventually, we want to allow merging of spdk_fd_groups, removing a level
of indirection. That means that some interrupt handlers won't
necessarily fire with the spdk_thread context already set. Set it in the
wrappers to ensure it's right.

Change-Id: Ief18d58cf3ee005c2969a9c0ee132b34b24cbd61
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15476
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>
Reviewed-by: John Levon <levon@movementarian.org>
2023-02-28 08:52:27 +00:00
Ben Walker
01dca5ed72 thread: Pollers now register spdk_interrupts, unifying the code paths
This unifies the poller fds with the interrupt mechanism internally.

Change-Id: I57a270260981ff54670365dddb33a1d9bdb56781
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15754
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-02-28 08:52:27 +00:00
Marcin Spiewak
ba20950a53 lib/idxd: Fixed compilation issue (gcc 12.2.1)
Added initialization of	the prev_crc variable to avoid compilation error:

idxd.c: In function ?spdk_idxd_submit_copy_crc32c?:
idxd.c:1138:51: error: ?prev_crc? may be used uninitialized [-Werror=maybe-uninitialized]
 1138 |                                 desc->crc32c.addr = prev_crc;
      |                                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
idxd.c:1081:18: note: ?prev_crc? was declared here
 1081 |         uint64_t prev_crc;
      |                  ^~~~~~~~

Change-Id: I6b93d5d85b52e20f8a2c313c41b740f66eebe1c7
Signed-off-by: Marcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16900
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-02-28 08:15:40 +00:00
Artur Paszkiewicz
fd7641d575 bdev/lvol: retry lvol open if it fails due to insufficient resources
Fixes: #2910
Change-Id: Id28b5c4e7e002fe81fea774d989d1507d933133e
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16875
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>
2023-02-24 21:01:11 +00:00
Ankit Kumar
82c61e0678 lib/nvme: 0 based numd for reservation report
Fix for number of dwords which is 0 based as per spec.
Use bitwise operators instead of division and modulus.

Change-Id: Ib315bf9394ef599317f41429742e7b8054069549
Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16814
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>
2023-02-24 12:46:40 +00:00
Ziv Hirsch
a67da4e64c thread: use spdk_thread_get_app_thread instead of _spdk_get_app_thread
Signed-off-by: Ziv Hirsch <zivhirsch13@gmail.com>
Change-Id: I68754dcd9c87e9f9a595f134de345d42e7d09e70
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16783
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>
2023-02-24 12:46:27 +00:00
Konrad Sztyber
0473a78165 accel: clear out domain/step_cb pointers in encrypt/decrypt
They  aren't cleared before a task is submitted and might store pointers
from a previous operation.  This can lead to issues if the previous
operation was using memory domains and we submit the task to a module
also supporting memory domains.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Icafb924c2e936ee6a83d921ae48e953b98f00841
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16848
Community-CI: Mellanox Build Bot
Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-02-21 13:13:10 +00:00
Artur Paszkiewicz
b41efae2c6 accel: add support for xor
Change-Id: I3c7461a7abfc64402929c0bb24f8458814d9c706
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16394
Community-CI: Mellanox Build Bot
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>
2023-02-21 08:33:18 +00:00
Artur Paszkiewicz
19572e5b20 util/uuid: use libc uuid functions on freebsd
Remove libuuid usage on FreeBSD and add dedicated implementation of
spdk_uuid API using functions from the standard library.

Fixes: #2878
Change-Id: Ie49ccb2842acad6064bffd789e4f64b7365b6e5c
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16558
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
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>
2023-02-17 10:15:18 +00:00
Jacek Kalwas
96073478de nvmf: introduce async transport create
An example of async operation which can be handled on specific
transport layer could be creation of spdk thread followed by
a poller registration.

This change also aligns with transport destroy which is already
async operation.

Current transport create function is marked deprecated and is meant
for transports supporting sync create only to maintain backward
compatibility. Async version supports both create operations.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I1f5a477819e58f30983d26f81a1416bed1279ecf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16463
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2023-02-16 16:45:08 +00:00
Konrad Sztyber
55f9479333 bdev: remove spdk_bdev_ext_io_opts from spdk_bdev_io
The spdk_bdev_ext_io_opts structure is used to pass extra options when
submitting a bdev IO request, without having to modify/add functions to
handle new options.  Additionally, the structure has a size field to
allow adding new fields without breaking the ABI (and thus having to
bump up the major version of a library).

It is also a part of spdk_bdev_io and there are several reasons for
removing it from that structure:

  1. The size field only makes sense in structures that are passed
     through pointers.  And spdk_bdev_ext_io_opts is indeed passed as a
     pointer to spdk_bdev_{readv,writev}_blocks_ext(), however it is
     also embedded in spdk_bdev_io (internal.ext_opts_copy), which is
     also part of the API.  It means that each time a new field is added
     to spdk_bdev_ext_io_opts, the size of spdk_bdev_io will also
     change, so we will need to bump the major version of libspdk_bdev
     anyway, thus making spdk_bdev_ext_io_opts.size useless.
  2. The size field also makes internal.ext_opts cumbersome to use, as
     each time one of its fields is accessed, we need to check the size.
     Currently the code doesn't do that, because all of the existing
     spdk_bdev_ext_io_opts fields were present when this structure was
     initially introduced, but we'd need to do check the size before
     accessing any new fields.
  3. spdk_bdev_ext_io_opts has a metadata field, while spdk_bdev_io
     already has u.bdev.md_buf, which means that we store the same thing
     in several different places in spdk_bdev_io (u.bdev.md_buf,
     u.bdev.ext_opts->metadata, internal.ext_opts->metadata).

Therefore, this patch removes all references to spdk_bdev_ext_io_opts
from spdk_bdev_io and replaces them with fields (memory_domain,
memory_domain_ctx) that were missing in spdk_bdev_io.  Unfortunately,
this change breaks the API and requires changes in bdev modules that
supported spdk_bdev_io.u.bdev.ext_opts.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I49b7524eb84d1d4d7f12b7ab025fec36da1ee01f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16773
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-02-16 10:09:35 +00:00
Ankit Kumar
9a1457ff1e lib/nvme: Add support for IO management commands
TP4146 introduced support for two new IO commands,
IO management receive and send.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Change-Id: Iaf37310b84e278df043dcf71a0c2ef912c2fca8e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16520
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-02-15 10:37:56 +00:00
Ankit Kumar
cc7736c968 include/nvme_spec.h: add changes for fdp log pages
TP4146 added support for 4 new log pages.
These are FDP configurations, reclaim unit handle usage,
FDP statistics and FDP events.

Updated the identify example file accordingly.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Change-Id: I5a20b728605257774d72bc184b50bc5008e142ea
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16518
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-02-15 10:37:56 +00:00
Ankit Kumar
7bbeb80a31 nvme: support 64 LBA formats for NVM and ZNS command set
Format LBA size (FLBAS) is updated to have:
Bit 3:0 as least significant 4 bits for format index
Bit 6:5 as most significant 2 bits for format index

NVMe format command fields are updated accordingly.

Add a new helper function to fetch the correct format index.
Update examples and unit test files accordingly.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Change-Id: I2d6d9045b9d65ae91cb18843ca75b59cc27ed2f2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16515
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-02-15 10:37:56 +00:00
Konrad Sztyber
4970cd36df bdev: remove ch parameter from bdev_io_split()
It isn't used in this function and the callers always pass NULL.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I07baa13a25b1e4e0b8832a093a53250392b10f10
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16682
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
2023-02-15 10:37:31 +00:00
MengjinWu
2db14b40ec nvme-tcp: nvme-tcp does not depend on lib/thread
Signed-off-by: MengjinWu <mengjin.wu@intel.com>
Change-Id: I44d5107292e5f335148ffccf1980741eb356d628
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16680
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-02-14 09:04:29 +00:00
Konrad Sztyber
45b7fb23b1 accel: assert that we never modify seq's ERROR state
This should help catching bugs when a failed sequence gets cleared its
failed state.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I9389a2610e94e766aaf4185445c36442c4d4a1f7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16545
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-02-13 13:52:06 +00:00
Konrad Sztyber
914007c1c6 accel: functions to iterate over tasks in a sequence
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I97f011b7eaa7db7e9a9df583aff23321d60bb72f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16378
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-02-13 13:52:06 +00:00
Konrad Sztyber
02e8b81bb6 accel: expose method for allocating accel buffers
This will allow a platform driver to allocate a buffer in case it cannot
execute the whole sequence and the destination buffer of the last
operation is a "virtual" accel buffer.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ia947cf553619828a170c5d0563b4c355d7b5ead5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16377
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-02-13 13:52:06 +00:00
Konrad Sztyber
efcae1bdee accel: method for getting accel memory domain
This will allow drivers to check if a task is using buffers from accel
domain.  This is just a helper, since the same can be achieved by
calling `spdk_memory_domain_get_first("SPDK_ACCEL_DMA_DEVICE")`, but
there's only a single accel domain and it is a bit special, so it makes
sense to have a dedicated helper function for getting it.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I07db7445ed9b109e66ecdbc0483a6a158a551070
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16376
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2023-02-13 13:52:06 +00:00
Konrad Sztyber
b2454dfbcc accel: introduce platform drivers
The goal of a platform driver is to execute chained accel operations in
the most efficient way possible.  A driver is aware of the hardware
available on a platform and can execute several operations as a single
one.  For instance, if we want to do DMA and then encrypt the data, the
driver can do both at the same time, if the hardware is capable of doing
that.

Platform drivers aren't required to support all operations.  If a given
operation cannot be executed, the driver should notify accel to continue
processing a sequence, via spdk_accel_sequence_continue(), and that
operation will processed by a module assigned to its opcode.

It is required however, that all platform drivers support memory
domains, including the "virtual" accel domain.  A method for allocating
those buffers will be added in the following patches.

This patch only adds methods to register and select platorm drivers, but
doesn't change the way a sequnce is executed (i.e. it doesn't use the
driver to execute it).

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I97a0b07e264601ab3cf980735319fe8cea54d38e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16375
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2023-02-13 13:52:06 +00:00
John Levon
11e67d93ff lib/nvmf: sanity check req->iovcnt
If req->data is set, with all the previous changes, then req->iovcnt
should also be more than zero.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I29b5f45541c9dba2dd896109dd43d2b5321ec467
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16274
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2023-02-13 13:50:51 +00:00
John Levon
70a82d9a95 nvmf: add spdk_nvmf_request_copy_*_buf()
Also deprecate the existing spdk_nvmf_request_data() API, which is
incompatible with iovecs.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I44df8ff30a431873a0c2f34b0cdb58df858fd7e3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16200
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-02-13 13:50:51 +00:00
John Levon
cc3184b8b4 nvmf: handle iovecs in reservation handling
Use req->iov instead of req->data in reservation handling code.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I6d79711d03f45bd5e118c6324d22decad887a788
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16199
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.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>
2023-02-13 13:50:51 +00:00
Konrad Sztyber
7db282dc26 tcp: add note about default case in qpair_abort_request()
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I2f3741596be2f06b36894306203214a4ef096d1a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16694
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-02-13 13:50:15 +00:00
Konrad Sztyber
ac94b60b54 nvme/tcp: fail qpair when spdk_sock_flush() fails
If spdk_sock_flush() returns an error, there's no reason not to
disconnect the qpair, as it usually means that that socket's connection
has been terminated.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I54e9bebc38e2a24a3baf69eb18ec3c654b210318
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16644
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-02-13 13:50:15 +00:00
Konrad Sztyber
739c6d7c5a nvme/tcp: check for EAGAIN when flushing socket
The bahavior of spdk_sock_flush() was changed in 5433004ec to return the
number of flushed bytes and -1 with errno set to EAGAIN in case nothing
has been flushed (instead of returning 0).  Therefore, we shouldn't
treat EAGAIN as an error in nvme_tcp_qpair_process_completions().

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I5473488b5b408cdc739921046f1a0cc2c98f98de
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16643
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-02-13 13:50:15 +00:00
Konrad Sztyber
25b0c20c0a tcp: remove abort handling for reqs in ZCOPY_START_COMPLETED
This never happens, as requests in this state are always immediately
transitioned to other states.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I0408ed9d8003d364bc38c86a9a50312721ab1284
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16642
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-02-13 13:50:15 +00:00
Konrad Sztyber
b12419a231 tcp: don't abort requests waiting for R2T ACK
It is possible for requests waiting for R2T ACK to receive H2C PDU
before receiving the ACK.  Therefore, the following sequence:

1. Host sends a write request to the target.
2. Target sends R2T PDU to the host and sets request's state to
   AWAITING_R2T_ACK.
3. Host sends H2C PDU to the target, but it doesn't reach the target
   yet.
3. Host sends an abort command to abort that request.  Request's state
   is changed to READY_TO_COMPLETE.
4. Target receives the H2C PDU, sees that request's state is
   READY_TO_COMPLETE, which is unexpected, and terminates the
   connection.

will cause the target to terminate the connection, which is obviously
incorrect.

So, to avoid that, we can treat AWAITING_R2T_ACK state in the same way
as TRANSFERRING_HOST_TO_CONTROLLER and register a poller waiting for the
state to be changed.

Fixes #2789.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Idddc627050000b74663dba397dc14d10aa0e284f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16641
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-02-13 13:50:15 +00:00
Changpeng Liu
56f238488e lib/virtio_vfio_user: use VIRTIO_PCI_VRING_ALIGN aligned vring address
We don't need to allocate 2MiB aligned memory address for
vrings, this will waste memory and may invoke dynamic
memory allocation in DPDK sometimes.

Fix issue #2846.

Change-Id: I6410d417f92623b44c375359d5e2b5ec8ed815c0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16651
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-02-09 11:31:39 +00:00
Mike Gerdts
3e7394af6a bdev: remove bdev_register_examine_thread deprecation
Starting in SPDK 23.01, calling spdk_bdev_register() and
spdk_bdev_examine() from a thread other than the app thread was
deprecated. This commit removes the deprecation and as such calling
these functions from a thread other than the app thread is an error.

As a side effect of this commit, all bdev module examine_config() and
examine_disk() callbacks will be called on the app thread.

Change-Id: Idaae06608101e2a513d9312ac5544ffe94effe4a
Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15826
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
2023-02-09 11:20:34 +00:00
Mike Gerdts
86bbcdb8f6 bdev: call examine_disk() for all claim holders
If multiple claims exist on a bdev, examine_disk() is called for each of
them.

Change-Id: I0a6dc3e4bd1da20bbcbddf97a16e04c62c82354c
Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15290
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
2023-02-09 11:20:34 +00:00
Mike Gerdts
47bb651cd5 bdev: refactor bdev_examine before claims v2
This commit has no functional change. It refactors an if statement into
a case statement in preparation for supporting claims v2.

Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Change-Id: I1862428c91a7066ad9079878d4c1b690a5ef631c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15289
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-02-09 11:20:34 +00:00
Mike Gerdts
a7eb6187e5 bdev: implement claims v2
This implements the v2 claims API. Compared to the original v1 claims,
v2 claims:

- Support read-write-once, read-write-many, and read-only-many claims.
- Are claimed with spdk_bdev_module_claim_desc().
- Are associated with a bdev descriptor that is passed to
  spdk_bdev_module_claim_bdev_desc().
- Are released upon close of the bdev descriptor used to obain the
  claim.
- Cannot be taken when a descriptor other than the one passed to
  spdk_bdev_module_claim_bdev_desc() has write access.

Later commits in this series are needed to fully integrate them with the
bdev subsystem.

Change-Id: I39a356f5893aa45ac346623ec9ce0ec659b38975
Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15288
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2023-02-09 11:20:34 +00:00
Mike Gerdts
0d8235f388 bdev: generic already claimed error message
As new claim types are introduced, printing error messages about who
holds a claim will get more complicated. This refactors the error
message code into a function to prevent code duplication.

Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Change-Id: Icdc5332214f3974e75baf11ba5ea02172c4275e1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15287
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-02-09 11:20:34 +00:00
Liu Xiaodong
120eb84454 ublk: update func ublk_try_close_dev
Merge function _ublk_try_close_dev() directly into
function ublk_try_close_dev.

Change-Id: Ib4df28f1d69f56d72e3eeaeb2220eb15f5c37440
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16417
Reviewed-by: <yifan.bian@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-02-08 15:26:00 +00:00
Liu Xiaodong
0f2f145963 ublk: rename g_ublk_bdevs to g_ublk_devs
bdev is not proper to describe ublk devices

Change-Id: Ic6784b3062b770dce1c77dc409ba1ee3704bdef2
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16418
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>
2023-02-08 15:26:00 +00:00
Jim Harris
3052809a3d ublk: add comment clarifying use of SQPOLL for ctrl ring
We need to use SQPOLL on the ctrl ring for now, due to
a bug in kernels <= 6.1.  This ring is used very
infrequently, so the workaround has no real effect
on performance.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia5e65a6edb7b1b6c4c945ebda8941f98c2bcdb07
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16620
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2023-02-07 08:18:54 +00:00
Jim Harris
addc545773 util: get SPDK_HAVE_* values for crc32.c
crc32.c uses SPDK_HAVE_ARM_CRC to use __crc32
intrinsics when available, but it isn't including
anything that would actually define SPDK_HAVE_ARM_CRC.

Only crc32c.c tried to define this previously, that
all got moved to crc_internal.h now, so we can just
include that here.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic5c2e6908508e32d2f3784304c5b58d3acd4c965
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16688
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>
2023-02-06 08:34:08 +00:00
Jim Harris
500ce16976 util add crc_internal.h
The preprocessor code will be needed in another
crc-related .c file in an upcoming patch.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Icc5e6f0d81f76093dfc973a9c1fe56271baf1ed8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16687
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>
2023-02-06 08:34:08 +00:00
Shuhei Matsumoto
a6b0b5b072 bdev: Use error_response() rather than bool_response(false) for JSON RPC
For JSON RPC, boolean response with false value may not be regarded as error.
Previously many cases were replaced to use
spdk_jsonrpc_send_error_response() explicitly. Replace one of the remaining
cases in this patch.

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I1b4ffe015c2b2e28d411faf7763c2baca81f66f5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16623
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-01-31 21:40:09 +00:00
Shuhei Matsumoto
0bac3197b8 iscsi: Use error_response() rather than bool_response(false) for JSON RPC
For JSON RPC, boolean response with false value may not be regarded as error.
Previously many cases were replaced to use
spdk_jsonrpc_send_error_response() explicitly. Replace one of the remaining
cases in this patch.

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: Ibfcb8c53662238b7ba8f08ecd1678953af8dc202
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16622
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-01-31 21:40:09 +00:00
Shuhei Matsumoto
ee1f124801 bdev: Use event_notify abstraction for media management notification
Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Change-Id: Ib775ab6bcbf3af61806f389e88944a4d827b6e82
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16578
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-01-31 15:28:37 +00:00
Shuhei Matsumoto
3522d43a95 bdev: Unify _resize_notify() and _remove_notify()
The next patch will improve media mgmt notifications but it will be
almost same as _resize_notify() and _remove_notify().

On the other hand, there are a few differences between _resize_notify()
and _remove_notify(). _remove_notify() will be better.

To avoid duplication, unify _resize_notify() and _remove_notify() by
adding abstraction event_notify() and _event_notify().

Add unit tests for the complex race conditions.

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Change-Id: Ibe2478479c61459c0da0db8d28c7273f05275e0f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16577
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-01-31 15:28:37 +00:00
GangCao
b5497ac213 lib/accel: correct the optional parameter of RPC commands
The relatd RPC commands are:
1. accel_crypto_keys_get (parameter is optional)
2. accel_crypto_key_destory (parameter is required)

Change-Id: I580c6e32bddf8242d0c26be988e2c151f47f2548
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16627
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-01-31 10:53:33 +00:00
Jacek Kalwas
37b5d87b19 env: expose function to get main core
Main core can be different than first core (default behavior) as it
can be specified by application argument. It can be useful to
determine if given thread is matching main core.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I25292a91ad677806eaf19ad68acdda0f28da6cfb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16596
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-01-31 10:31:04 +00:00
plestk
96dca1676b nvmf: Fix new line at the end of log message
Signed-off-by: plestk <plestringant@kalray.eu>
Change-Id: I24c59d0d5b7a889e03d77a40b14ac95f6fe42afe
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16102
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2023-01-30 16:29:49 +00:00
John Levon
6b206e3110 nvmf: sanity check passthru handlers
These routines can only handle a single buffer; double check that is the
case, and fail if not.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I136482c27c73655887c49405f747b8ed073f7b69
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16198
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@nvidia.com>
2023-01-30 16:28:35 +00:00
John Levon
e1413e9197 nvmf/rdma: use req->iov consistently
Use req->iov as needed, to make it easier to remove req->data later.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: Ie625f374e846f7e6afd6a5d143a5174d27d419b4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16256
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@nvidia.com>
2023-01-30 16:28:35 +00:00
John Levon
fd05a2ff47 nvmf/tcp: use req->iov consistently
Use req->iov as needed, to make it easier to remove req->data later.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I4095e3c4089b730db123705d0168cd409375cc43
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16196
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-01-30 16:28:35 +00:00
John Levon
c0ddb423e0 nvmf/vfio-user: use req->iov consistently
Use req->iov as needed, to make it easier to remove req->data later.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: Id23c4ef8018d6a7aad42c3d5054fa9addcf16f0a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16195
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-01-30 16:28:35 +00:00
John Levon
49c0d28ab1 nvmf: drop req->data usage in ctrlr.c
Refer to req->iov instead of req->data. As the queue connection code
already presumes a single data buffer, add some sanity checking for
this.

We also need to fix vfio_user.c as a result to correctly set ->iovcnt.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: Ib1e4ef3885200ffc5194f00b4e3fe20ab1934fd7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16194
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-01-30 16:28:35 +00:00
John Levon
ecc80dfcfb util: add spdk_iov_xfer_*() API
Add a new API for incremental copying in or out of an iovec, and replace
current code to use the new API.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I088b784aef821310699478989e61411952066c18
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16193
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2023-01-30 16:28:35 +00:00
Jim Harris
6dc9dbe5ca env_dpdk: don't call remove_rte_dev from secondary proc
During secondary process shutdown, when nvme device
would get detached, it would trigger env_dpdk to
send rte_eal_hotplug_remove event for the corresponding
BDF.  But this isn't valid from a secondary process -
we can only attach/detach from the primary process.

Usually this would just result in a bunch of annoying
print messages as the secondary and primary process
sent rte messages between each other.  But occasionally
one of the response messages from the primary process
could arrive just as the secondary process was going
through rte_eal_cleanup.  The message would get
kicked to the DPDK intr thread, we would do bus_cleanup
which frees all of the PCI state, and then the message
would execute on the intr thread causing seg faults,
use-after-free or some other violation.

It's possible some kind of cleanup should be
implemented in DPDK, but for now, let's just not
induce incorrect behavior from SPDK, and don't send
the hotplug_remove messages from a secondary
process.

Fixes issue #2651.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16553
Reviewed-by: Michal Berger <michal.berger@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-01-27 08:46:05 +00:00
Jim Harris
cf64422ad7 bdev: call unregister callback on correct thread
We should always called the unregister callback on
the same thread that spdk_bdev_unregister() was
originally called.  So save the thread pointer and
use an spdk_thread_send_msg() to make sure it gets
called on the correct thread when the unregister
finishes.

Also add unit test that reproduces the original
issue.

Fixes issue #2883.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16554
Reviewed-by: Mike Gerdts <mgerdts@nvidia.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-01-27 08:45:28 +00:00
Liu Xiaodong
b2b1e8d76a ublk: turn ublk_start_disk in async
Since ublk_start_disk internally runs ublk_ctrl_cmd
asynchorously, the result should be returned after the
whole process of ublk_start_disk is completed.
Add a callback into ublk_start_disk parameter, and change
rpc_ublk_start_disk to send response in callback.

Change-Id: Icc0d9e8cb81f2b67bf99fdead423bfe8159714bc
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16500
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-01-26 17:22:04 +00:00
Liu Xiaodong
0d01a22b67 ublk: fix error case in ublk_finish_start
Use ublk_close_dev_done to release obtained resource
after UBLK_CMD_ADD_DEV is executed in the ublk device
start process.
Rename ublk_delete_dev to ublk_free_dev,
and ublk_close_dev_done to ublk_delete_dev

Also using the correct way -- io_uring_queue_exit()
to release uring in ublk instead of just closing uring fd.

Change-Id: I46a1ddea162adeb6dfe8c9b45082ed2f93f4b309
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16460
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>
2023-01-26 17:22:04 +00:00
Liu Xiaodong
4c0a39b1d4 ublk: fix error case in ublk_start_disk
Obtained resource can be directly released in error
handling of ublk_start_disk.
Fix the improper usage of _ublk_try_close_dev to release
resource in ublk_start_disk.

Change-Id: I291bbfb179b9df4deb8f3d346b2d660e6d17fdc1
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16459
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: Ben Walker <benjamin.walker@intel.com>
2023-01-26 17:22:04 +00:00
Tomasz Zawadzki
23196506da deprecation: Remove support for PMDK
Support for PMDK is winding down, see:
https://pmem.io/blog/2022/11/update-on-pmdk-and-our-long-term-support-strategy/

Change-Id: I8999a31137aa372e757472cfb7d4bf4edf9d2fb6
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16393
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-01-26 15:16:19 +00:00
Liu Xiaodong
827a01135c ublk: fix the memory release of ublk_io
Add function named ublk_ios_fini() to release memories
allocated in ublk_ios_init().
Fix the incorrect memory release for the failure inside
ublk_ios_init() by ublk_ios_fini().
Also move the memory release of ublk_io into function
ublk_delete_dev() instead of ublk_close_dev_done(). This
will be used by next patch.

Change-Id: I5c3fc31a4d7114e17fb86fc6facc8cccea27d6e7
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16442
Reviewed-by: Konrad Sztyber <konrad.sztyber@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>
2023-01-26 02:41:06 +00:00
Jim Harris
93f09b1627 ublk: add UBLK_DEBUG macro
This will help with debugging more complex
ublk configurations - needed especially knowing
that ublk kernel driver is still a bit flaky.

Create a new LOG flag "ublk_io" for the existing
per-IO debug logs, and use the existing "ublk"
flag for ctrl-related debug logs.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic019c1e837b04dbf5d210c46a98cfbed732278a0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16457
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-01-25 10:52:36 +00:00
Jim Harris
b48730d95f ublk: queue ublk when there are no ctrl sqes available
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I55a5a5111aa334807e22c9c622e33c69f0405a39
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16456
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-01-25 10:52:36 +00:00
Jim Harris
2db4a55381 ublk: sort cmd_op case statements in ublk_ctrl_cmd
Sort the case statements by the normal order in which
the commands are submitted.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I203a70045cd48d30d1229c754ddb57e7e31460af
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16455
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-01-25 10:52:36 +00:00
Jim Harris
525dcf4935 ublk: add ublk->next_state_fn
Instead of having the poller check the last
ctrl_cmd_op to determine which function to call,
just have ublk_ctrl_cmd store that function pointer
in the ublk itself.  This keeps all of the
cmd_op-specific logic in one place rather than
splitting it between the submit and poller
functions.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I59f333d38a0d89cc4c50082177ff818135bcad37
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16454
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-01-25 10:52:36 +00:00
Jim Harris
5b81c4bb9f ublk: remove some unneeded breakout functions
Some functions such as ublk_start_kernel,
ublk_stop_kernel and _ublk_start_disk were only
calling ublk_ctrl_cmd.  Just call ublk_ctrl_cmd
directly and avoid the extra function indirections.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic7d211b9b730af816f7747e031bdaef865ece433
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16453
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-01-25 10:52:36 +00:00
Jim Harris
4fd4f6367f ublk: remove ublk_ctrl_cmd args parameter
We don't need this parameter - it is simpler to
just determine the argument data (if any) in the
function itself based on the opcode.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic8df8f9ec569c10ebb565efc7268fba1d50bcdf5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16452
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-01-25 10:52:36 +00:00
Liu Xiaodong
cde0c555ab ublk: close queue based on queue's io info
Every queue should be closed based on only its own
I/O information, not the whole device.
Remove function ublk_is_ready_to_stop().

Change-Id: Iec5a260f68d6f84c0af4c8e0b5380272049b1f5d
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16416
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>
2023-01-25 10:52:36 +00:00