according to commit:
bdev: add spdk_bdev_queue_io_wait
This patch will make io_wait to support vhost_blk
Change-Id: I529001fc74427adda63d0d41901a98229364175d
Signed-off-by: Ni Xun <nixun@baidu.com>
Signed-off-by: Li Lin <lilin24@baidu.com>
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Reviewed-on: https://review.gerrithub.io/425479
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Sun Zhenyuan <sunzhenyuan@baidu.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>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
spdk_rpc_get_vhost_controllers() forgot to free memory of w when ctx
allocation failed. Defering the invoke of spdk_jsonrpc_begin_result(),
so we can handle the failure conveniently.
Change-Id: I223f5b9a918b068922d5a68c8d688331ebf90e42
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/425358
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@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: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This is in response to a Scan-build issue reported on Clang 6.
Change-Id: I2edc853145762998db818cbbe0e9ca0d9b8c123d
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/424139
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
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>
On hot remove, before closing bdev, put its IO channel.
If we don't do this bdev won't be destroyed until controller
is removed.
This fixes GitHub issue #401.
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I92600c2f7136f56afd6593f663f2d2cf468a37dc
Reviewed-on: https://review.gerrithub.io/422258
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I7716f1748803872cac85e296d60747752ca046f4
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/422273
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: Changpeng Liu <changpeng.liu@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
QEMU will send SET_VRING_ADDR when perform live migration,
it's not correct to update the memory table while the device
is running.
Change-Id: I899d3a996355ab6aa69835d90da14a86f93240fa
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/420944
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
We need these errno to make outputs more clear and make
spdk_vhost_blk_construct() conforms to it's declaration.
Change-Id: I1936e7393494a0344d97c8a920f3d719dee27002
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/421859
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: Jim Harris <james.r.harris@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
irq_delay must be not less than zero.
Change-Id: I22d8a7df453f07a44a32582d8e880949824bf868
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/421685
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This fixes queue handling for QEMU 2.12 which is sending new memory
table but resetting only some queues
Fixes#339
Change-Id: Ic971725261720d7459e49a4f14bc15c2f2a77b1a
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/420372
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Chen Wang <chenx.wang@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This also save CWD on init so socket path is no longer relative.
Change-Id: I303401fe0340f0bc2ea5e4ba468361f68ea84c3d
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/419067
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-by: Paweł Niedźwiecki <pawelx.niedzwiecki@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>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Print an error message instead. The driver can still do
a manual rescan if it wants to see the new SCSI target.
Change-Id: Ieb76ada8625bf00ad068a791b860e4b08ad5cb83
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/417268
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I6babd4cf990bf19b510db88bdfb0ca81e29d9252
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/414700
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Madhu Pai <mpai@netapp.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
As of NVMe 1.3b, there is only one command set. But pipe
this through the driver per-spec anyway.
Change-Id: I4faf8596f5ce638e5e2a500b424e00ceb6e89edc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/412102
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
"Dev" was deprecated since v18.01, now we have released v18.04,
so remove the "Dev" support from existing code.
Change-Id: I54c4cf83f78d3b0fdb13e625936c889d7bfaeba9
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/409989
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Fix the memory leaks when construct the vhost nvme dev
using the error number of io queues.
Change-Id: Ie63e048b355d8a3d602e0da415dca279c0515a8b
Signed-off-by: Chen Wang <chenx.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/410547
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Liang Yan <liang.z.yan@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This clarifies the bdev_io completion callbacks, since they can now
assume that they always have a valid bdev_io. All call sites that
originally passed NULL for bdev_io now set an appropriate status code in
the task and complete it with the new spdk_vhost_nvme_task_complete()
function.
Change-Id: Id74aafb28e83e135bbb0a410ff9766dc1b9ece50
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/410080
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Currently Get/Set features vhost messages use 4096 data buffer, but
it does need this buffer for real usage scenario.
Change-Id: If84f795209d771670449283cef3143f3019baee0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/409613
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Previously after IO is finished, we will put completion entry and
irq event notice at the same IO completion callback, for performance
consideration, move the irq event routine into IO poller context, this
can be used to implement interrupt coalescing feature in future.
Change-Id: Ic20b50af47b73ffcb91938802e18b316c07a4d11
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/408943
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
For namespace we need to use array of objects. Remove useless check for
bdev != NULL as this is already guarded by ns_active.
As we are here also switch to new JSON named API.
Change-Id: If8ab15c63ea015731829276e06e5cb5a801620d2
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/409025
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Add state_mask to each RPC method and state to RPC server, respectively.
State mask of RPC method is set at registration. State of RPC server
is changed according to the state of the SPDK.
When any RPC method is recieved, if the bit of the RPC server is on in
the state mask of the RPC method, it is allowed. Otherwise, it is
rejected.
When any RPC is rejected by state_mask control, the new error code
is returned to describe the error clearly.
Change-Id: I84e52b8725a286e9329d61c56f498aa2c8664ec1
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/407397
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
__rte_always_inline was added in DPDK 17.05; replace the single use with
a regular 'inline' to restore compatibility with older DPDK versions.
Change-Id: Ia8a0f729cc4c39a9aaab0700f3c827a9766d1dd0
Fixes: e30595fbe3 ("rte_vhost: introduce safe API for GPA translation")
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/409077
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
The existing code was using sizeof() on a calculation that already
returned the right size, so this would originally just memset() 4 bytes
instead of the whole region.
The spec requires the doorbell buffer to be exactly one physical memory
page, and our controller emulation chooses MPS so that only 4096-byte
pages are supported, so just zero out the page and drop the calculation
entirely.
Change-Id: I71db1bebf0a4d5dbe55fd411786e19a8d6802c20
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/408730
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
If the user requests an invalid QID or CQID in Create I/O Completion
Queue or Create I/O Submission Queue, we need to return an error of
Invalid Queue Identifier as indicated by the spec.
Change-Id: I7467aa04da9e374bb596731f4e4174967d44cffb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/408767
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Replace the hard-coded 64 and 16 constants, which are the size of the
submission queue entry and completion queue entry, with equivalent
sizeof expressions.
Change-Id: I5a9d8fc1ab98276312445f0699aae3d86beee705
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/408762
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
These assert() calls were all checking guest-provided data; it should
not be possible for a guest to trigger an assert(), so replace them with
actual runtime error checks (which won't get removed in release builds).
Change-Id: I0692dae0e8f6157fc04e88a3ed8087cce9367fe2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/408761
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Currently QEMU vhost-nvme driver hasn't been pushed to QEMU community,
for vhost-user socket messages, QEMU can pick the opcode at any time,
QEMU 2.12 already picked 27-30 for other driver, for the purpose to
mitigate rebase work in future, while here, we reserve a bigger value
so that it will not conflict with QEMU for very long time.
Change-Id: Ic404bb14330c4acc484aa9c86983030803a31e77
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/408771
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Now that spdk_vhost_gpa_to_vva() is used in place of
rte_vhost_gpa_to_vva(), we can directly use the void * return value
instead of casting it via uintptr_t.
Change-Id: Ie063439def1eeeebc7a949ff67f14a80bfce6cd7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/408760
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
One call to spdk_vhost_gpa_to_vva() was missing a return code check.
Change-Id: I3581ade98f7fbf72419f8216718a17de50bac4b7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/408759
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
QEMU added a protocol feature bit to indicate the slave
target can support GET/SET config messages, while here,
add it to SPDK vhost target so that it can work with
QEMU 2.12.
Change-Id: I41a813ef23fba4d3fdf7bb3e3617a9feb4209509
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/408416
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
DPDK will deprecate the old API soon.
Change-Id: I0522d47d9cc0b80fb0e2ceb9cc47c45ff51a5077
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/408722
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This patch ensures that all the address range is mapped
when translating addresses from master's addresses
(e.g. QEMU host addressess) to process VAs.
Change-Id: If141670951064a8d2b4b7343bf4cc9ca93fe2e6d
Reported-by: Yongji Xie <xieyongji@baidu.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/408721
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This new rte_vhost_va_from_guest_pa API takes an extra len parameter,
used to specify the size of the range to be mapped.
Effective mapped range is returned via len parameter.
Change-Id: Ib3830e1da9e0cb477d99860a03684c665bb3f6ec
Reported-by: Yongji Xie <xieyongji@baidu.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/408720
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I215bc269dee704e60a167023e2a6c24d3ae1fab0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/395404
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
task must be non-NULL in blk_unmap_complete_cb - it is retrieved from
child->parent, which is always set to a known good task in the only
call site.
Change-Id: I28dce62d4cb586311dc87f988c01aa0e03665e4d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/408393
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
If basename was the string "", with length 0, it would have
resulted in accessing index -1 in dev_dirname.
Change-Id: Ib389f8fe220f5335a54f6a155a20fcca35b94e3e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/408253
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Change-Id: I4bec75ee2965394edb294a163818925e6a26fb0c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/408239
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I929e2a668189c36a8837ce8cb8731e394bcb6d9a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/408238
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This fixes two flagged Klocwork issues.
Change-Id: I98ac136995ebcdc89aa94c76fec095573e102674
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/408237
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Moved it to the DPDK thread, so that we don't stress
SPDK I/O reactors on device start/stop. This is mandatory
if we want to maintain hundreds of simultaneous connections.
This patch also fixes various memory registrations leaks
in cases where further device initiation fails.
Change-Id: I435062108fe96d7e67e2a078a3547acb1f73ad11
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/406960
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
rte_vhost_driver_start() can start a new posix thread
that polls for incoming socket connections and calls
backend->start/stop_device. Soon we're going to put
more work on this thread, so we need to make sure it
doesn't collide with SPDK reactors.
This patch also fixes vdev memory leaks in case the
rte_vhost_driver_start() fails.
Change-Id: I16fdff228176a245c478251b39aa244a49bd124b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/406959
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ib77a219e02a5cde69293eb1f7002507cf4930ae3
Fixes: 90c0e24410 ("vhost_user_nvme: add vhost user nvme target to SPDK")
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/407193
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Due to the check on line 153 in t_nvme_dev, Klocwork
thinks nvme can be null. Therefore, we must check that
it isn't null before dereferencing it. We can either
solve this the way I have here, or remove check
that causes to_nvme_dev to return null.
Change-Id: I86d4939664704ff1117a7c1b7dada7e1ae479c6f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/406992
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
SPDK_NOTICELOG should only be used for significant but non-warning/error
messages, such as notifications of deprecated config file sections.
Change-Id: I885dfe839c9cbc9eceabee234e4d0eb74c6910df
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/405923
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Similar with exist vhost scsi/blk target, this commit introduces
a new target: vhost nvme I/O slave target, QEMU will present an
emulated NVMe controller to VM, the SPDK I/O slave target will
process the I/Os sent from Guest VM.
Users can follow the example configuation file to evaluate this
feature, refer to etc/spdk/vhost.conf.in [VhostNvme].
Change-Id: Ia2a8a3f719573f3268177234812bd28ed0082d5c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/384213
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This will be used to track time used in pollers - each poller can now
indicate if it found any work to do or not.
For cases where it was obvious and the infrastructure was already in
place, existing pollers have been modified to return 0 or a positive
value to indicate whether work was done. Other pollers have been
modified to return -1 by default, indicating that the poller isn't
indicating anything about whether work was performed. This will allow
us to find un-annotated pollers easily in the future and fix them
incrementally.
Change-Id: Ifebfa56604a38434fac5c76ba7263267574ff199
Signed-off-by: Roman Sudarikov <roman.sudarikov@intel.com>
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/391042
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
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>
This allows vhost initialization to be fully handled in the event
framework subsystem.
Change-Id: Ic0ff11f3765cc553b7ca183027209fb6dd131364
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403226
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This lets us drop the basename parameter from spdk_vhost_startup(),
which is a step toward making vhost initialization happen as part of the
event subsystem instead of in the spdk_app_start() callback.
Change-Id: I4fe18c4c3f12b706e73ae74500be58f1582110fd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403225
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
spdk_vhost_dev_has_feature() is internal function so we can move it's
declaration to header file. This remove function call overhead.
Change-Id: I1704e8279cd6720177047a1ae8818f68982998db
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/400241
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Patch 808a2b05 [1] fixed overflow of avail entries count,
also fixing indirect descriptors support. Without indirect
descriptors, we usually didn't manage to fill entire queue
- there were always a couple of descriptors left. A couple,
but not enough to form a vhost-scsi descriptor. Indirect
descriptors, however, are 1-descriptor long. They have higher
possibility to fill entire avail queue, and that's why they
used to fail more often. But we can safely reenable them now.
[1] 808a2b05 ("vhost: fix overflow of avail entries count")
Change-Id: Idec8568cdfc1255fb578e5d18f5c476a4c034d2d
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/396805
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
The cpuset API is const-aware, so we can safely
return const cpuset here. This will simplify
future usages of this function - for now it remains
unused.
Change-Id: If849ed49056a54035fb7a6eccde84121630f9974
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/399457
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This doesn't really fix anything as rte_vhost
logging functions are extremely poorly designed
and do smp_wmb() by themselves - but only if
logging is enabled...
Let's move the barrier in our vhost.c. This
doesn't change any behavior, but makes the code
more readable. It surely looked weird to update
the ring, log it, and then do smp_wmb().
Change-Id: I90827b14292b60bd5641a48d546e7249a0496a4b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/398326
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This feature is not particularly useful for storage.
It forces us to read additional vq memory on each
I/O completion and that's quite expensive.
Quoting VIRTIO 1.0:
```
VIRTIO_F_NOTIFY_ON_EMPTY (24)
If this feature has been negotiated by driver, the device MUST issue an
interrupt if the device runs out of available descriptors on a
virtqueue, even though interrupts are suppressed using the
VIRTQ_AVAIL_F_NO_INTERRUPT flag or the used_event field.
```
Later on:
```
Note: An example of a driver using this feature is the legacy networking
driver: it doesn’t need to know every time a packet is transmitted, but
it does need to free the transmitted packets a finite time after they
are transmitted. It can avoid using a timer if the device interrupts it
when all the packets are transmitted.
```
Change-Id: I7f53293bf811a4cd5ae8e42e18f35042ea6f4ba8
Suggested-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/398325
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This is required only for event index,
which we don't support for now. The whole
NOTIFY_ON_EMPTY feature is about to be removed
soon. See subsequent patches for details. If
necessary, this should be re-implemented in a
different way.
Change-Id: Idd0c1ab929eef46e692834ffdc62472fa0f6fb74
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/398324
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Drop max vhost initiators limitation in SPDK (64).
We're still limited by rte_vhost limits, but
they're set to 1024 at the moment.
Change-Id: Ia1ad25665d6e798bc22709cdd43b72d60f1f4cf0
Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/389811
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This must've been overlooked in patch 601bcbcf.
Fixes: 601bcbcf66 ("util: extend cpumask to hold more than 64 cpus")
Change-Id: Ia7e06fcacba5cd99770b81542678550e9fbc3ca2
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/399455
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This internal function was now being used in one
place only. Inlined it so there's less code.
Change-Id: Ide52494d0e0f9563ce35ef7bf9166f62734a8309
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/399440
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Added vdev->id field and refactored the hot
vhost external event code operating on
g_spdk_vhost_devices array, so that we will
be able to switch from that array to a linked
list with unlimited capacity more easily.
This patch does not change any functionality
on its own.
We would very willingly reuse vdev->vid here,
but it's available only on devices with active
connections.
Change-Id: Ife911a6ca1531aade374b99ef4502cf77f691fa2
Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/389071
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Doing a manual vhost module fini followed
by an spdk_app_stop is wrong, as the app_stop
will trigger the vhost module fini again.
This will potentially free the g_num_ctrlrs
twice. Doing just spdk_app_stop is enough.
Fixes#238
Fixes: 3fb4bc717b ("vhost: move app fini to the vhost subsystem")
Change-Id: I70f886f6792ffc5c499a8d8cb0b6ab01855f7e9b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/399129
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
QEMU overrides this value anyway, but other
virtio implementation may not. Setting
blkcfg->num_queues to its target value
won't break anything, and will help out
SPDK virtio-blk driver implementation.
For equivalent field in virtio-scsi, the
Virtio 1.0 spec says:
```
num_queues
is the total number of request virtqueues exposed by the device. The
driver MAY use only one request queue, or it can use more to achieve
better performance.
```
Multiqueue for virtio-blk is oficially still
unsupported, so the blkcfg->num_queues remains
undocumented. Let's implement it adequately
to the virtio-scsi spec.
Change-Id: Ief520385997bb7e745ed17501a972c55955346d2
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/399121
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
New vhost user messages GET_CONFIG/SET_CONFIG can be used for
vhost-blk for the purpose to get configuration parameter such
as: Capacity and block size. This commit enable this feature,
users don't need to append capacity any more when started
QEMU. Also event notifier is added for the purpose to change
capacity of block device while QEMU is running.
Also re-enable the vhost-blk tests.
Change-Id: I06ef697984eeea3abbbd655bdcaccaa3b7aa72d7
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/386546
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tree-wide cleanup of all instances of printf()-style functions where a
format string contains a space before a newline character.
Change-Id: Ib5b5861e97bed9e9d62db03875547e3f771f4769
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/397031
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
This field was only required to check
if we can safely upcast vdev object.
We can just as well check vdev->backend
instead. The vdev->type is not needed here.
Change-Id: I525350957406d4299151e0557b9025ca7bea5371
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/396584
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
When a target is removed, spdk_scsi_dev_destruct
removes its luns, consequently closing bdev descriptors
and in vhost case - triggering target hotremove again.
This doesn't really have any negative consequences, as
the second hotremove just fails silently. But let's
cleanup this for sanity.
Change-Id: I47c76814696b49905b9fb00667e9529db3f58c12
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/396575
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Instead of:
* spdk_vhost_scsi_dev_remove(vdev)
* spdk_vhost_blk_dev_remove(vdev)
we now have
* spdk_vhost_dev_remove(vdev)
All the logic is already handled internally. This patch only
changes the API. Also, previous vhost_dev_construct()/remove()
functions have been renamed to vhost_dev_register()/unregister()
because that's what they really do.
Change-Id: I7dd0d77bc5b633bec075e0a71345ddbed62697b4
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/396574
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
We already have a vhost subsystem and have to do
its fini anyway, so let's remove application fini.
Technically, any SPDK app can use vhost library
and create vhost devices, so we need to delete them
on shutdown in all cases - in module fini.
Change-Id: I013b45b4e73fd19288b9c10bc995dc24894ecf35
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/396573
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
This patch adds support for live migration for vhost-scsi and vhost-blk
backends.
Change-Id: Ibfc8a713dbba14ba8cb38377a71e28fd340b1487
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/394203
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
QEMU always set offset to 0 but for sanity we should take the offset
into account.
Change-Id: I36213cd8fbeb85862b6de59c60bd6bcee7f9d1b2
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/395740
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Some messages like SET_FEATURES, SET_VRING_ADDR etc will change internal
state of VQ or device. To prevent race vs thread polling those queues
stop the device.
Change-Id: I15caf9da0decbaa660e9773c93d45ff148e5e9a8
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/395739
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
See comment in vhost.c file for more details why this fix is needed.
Change-Id: I782119768fb200ad36f9253e704cc08a3be36ae6
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/395514
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Virtio 1.0 says that the effective capacity of vrings
is equal to the virtqueue size. When avail ring was full,
we detected it as empty.
Change-Id: I72f5d45cdc14db6b934ce7780e603a3de3131594
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/396804
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Ensure the used->idx changes are visible to
the guest at the time of interrupt.
Change-Id: I245b91c7fbe2e21600aa94d8314271ea5b987343
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/396929
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Fixes github issue #218.
This patch introduces spdk_cpuset object to store and manipulate
the set of individual CPUs. The main objective of this object is
to replace cpumask declared as uint64_t and extend the limitation
of supported CPUs (lcores) above 64 CPUs.
spdk_cpuset is always allocated dynamically and accessed by opaque
pointer, what makes it easier to extend in the future without
breaking API/ABI.
This patch also extends parsing function allowing to set cpumask
using a list of cpus e.g. "[0-4,10,12]" sets mask of 0,1,2,3,4,10,12
as well as hexadecimal string with and without "0x" prefix.
Change-Id: I475c3ba7fab629021a22e03176e57e400dd24a49
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/390794
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Also move the test plan file to a more appropiate location.
Change-Id: I462058279d4d2dc03790657b82b3cfeb00c8a93a
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/394180
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
New added vhost user messages: GET_CONFIG/SET_CONFIG are
used for get/set virtio device's configuration space, this
commit enable the new added vhost messages.
Change-Id: I5c3e3f8fb6ed55e99299323c39658765b1724bb8
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/386545
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
vhost I/O only need to be split on 2MB boundaries if
there is a break in the VM's memtable at that 2MB
boundary.
This should drastically reduce (if not eliminate)
the intermittent test pool failures seen recently.
virtio limits number of segments to 128, but this
2MB splitting could introduce additional segment
breaks which we do not allocate IOVs for. In almost
all cases, there are no memtable breaks except at
low 2MB, so most of the extra segment breaks we are
adding are unnecessary.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I12d85c289ad80c7bb65e3d2030a2405092b19deb
Reviewed-on: https://review.gerrithub.io/396058
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Currently we test up to 512KB I/O sizes, and this I/O
size could fragment to 129 IOVs if split on 4KB
boundaries if the buffer start is not 4KB aligned.
This is likely the cause of a recent slew of failures
in the test pool which coincide with updating to
fio 3.3.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I189157af578e75e025ca8e3420712739e604fca7
Reviewed-on: https://review.gerrithub.io/395872
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
There is no need to keep a lun name anymore - we always
use the bdev name as the lun name so it is not providing any
additional value. This also keeps us from associating
the same bdev with different LUNs on different iSCSI target
nodes or vhost-scsi controllers.
Side effect of this change is:
1) Use "bdev_name" across the APIs to make it more clear
what these names refer to.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3d42fde22087352ce1d5dc80178bd8c5cac8cb7c
Reviewed-on: https://review.gerrithub.io/390843
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This `len` field describes the amount of bytes
*written* by the device. It is used to prevent
the driver from reading buffer memory that wasn't
really written to - it could contain either
leftover values from previous requests or even
be completely unitialized.
In a couple of invalid-request error conditions
we still write the VIRTIO_BLK_S_UNSUPP response while
returning used_len == 0, but that's fine. A properly
written driver will likely handle both of these cases
the same way.
Change-Id: I8e9f3a8051561096e2ee755122d534b4ffd94db1
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/393963
Reviewed-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This `len` field describes the amount of bytes
*written* by the device. It is used to prevent
the driver from reading buffer memory that wasn't
really written to - it could contain either
leftover values from previous requests or even
be completely unitialized.
Change-Id: I67aee5c8b9455fc86cdeb600ea3a051a7737c66f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/393962
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
The same check is done inside
spdk_vhost_vring_desc_to_iov.
Change-Id: Id93a05848ed69b8dd048ac490df2432b4252c6e0
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/394088
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
The SCSI layer no longer needs to know about the parent/subtask
relationship maintained by iSCSI.
Change-Id: Ia6f7c5367c5b656bd7521ed1abb6d0f713a0500b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393697
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
This patch remove need for additional buffer when translating error code
to string.
Change-Id: Iaa60088b5c450581d3cdddbb425119b17d55a44b
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/386114
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
LUN hotremove callback can be triggered when
it's vhost-scsi controller is not started
yet. In such case it is not necessary to check
against HOTPLUG flag (if the controller doesn't
have any driver connected yet, there might be
no negotiated flags whatsoever).
Change-Id: Ic7c78e3bdf45fa4d5628cd19c4c5ad723699e45f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/371864
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
The SCSI task transfer_len field is only distinct from length in iSCSI;
vhost should always have length == transfer_len.
Change-Id: I37faec26f0f49c27019a965c1f1f48903ca54b58
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393203
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
pthread_create() returns error codes via its return value, not errno.
Change-Id: Iac0f2380dd4daf15dc48829a3b9b0a75aedd87d1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/392984
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Adopt two improvements for iSCSI by Ziye to VHOST.
- iscsi/conn: remove rte_config.h header
- env: export spdk_env_get_last_core function
Change-Id: I8f067093d593c8d483c52587669f8b0b706f497f
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/392910
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
The latest patch for the iSCSI connection is applied to the vhost
too.
RTE_MAX_LCORE in the for loop is removed and the for loop is
replaced by SPDK_ENV_FOREACH_CORE().
When the cpumask is unexpectedly 0, not 0 but the first core is
returned.
Change-Id: I39cfc2219a3532eccc8c0ce59712102b947a76d7
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/392588
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
The latest change for the portal group is applied to the vhost.
The following comment is quoted from it.
Currently the cpumask must be a subset of the reactor mask.
However, this is different from sched_setaffinity() function
and taskset command of FreeBSD and Linux. The latter will
be familier for more people. Hence the later is adopted.
The following is quoted from the FreeBSD Man Page of taskset:
The CPU affinity is represented as a bitmask, with the lowest
order bit corresponding to the first logical CPU and the
highest order bit corresponding to the last logical CPU.
Not all CPUs may exist on a given system but a mask may specify
more CPUs than are present.
A retrieved mask will reflect only the bits that correspond to
CPUs physically on the system.
If an invalid mask is given (i.e., one that corresponds to no
valid CPUs on the current system) an error is returned.
The masks are typically given in hexadecimal.
Change-Id: Idcd72a12ef52e4ccec8476e7d54fab82867cf936
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/392587
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
For normal exit logic, such as Ctrl+C, vhost blk will not
shutdown the backend device, e.g: NVMe controller.
Change-Id: I7fdf8687a2cfa6a8cc6a61428d722debfa9a2180
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/391348
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
get_vhost_controllers was printing only one device of vhost
scsi controller with multiple devices
Change-Id: I392fc393d9e8f3d20c28139724d83b79d800456a
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/391593
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
We used to sprintf the path from
directory and socket name, while
the complete path was already held
in vdev->path.
Change-Id: I27bc71be52a805b39e083eb4f76947587c36a4ad
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/390411
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Require braces around all conditional statements, e.g.:
if (cond)
statement();
becomes:
if (cond) {
statement();
}
This is the style used through most of the SPDK code, but several
exceptions crept in over time. Add the astyle option to make sure we
are consistent.
Change-Id: I5a71980147fe8dfb471ff42e8bc06db2124a1a7f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/390914
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Added new keyword 'Target' that will replace 'Dev'.
'Dev' is still usable, but deprecated and will be removed.
Change-Id: Iafd6114ef2cc5b2f8d58497e9fb454a3a237ed16
Signed-off-by: Sebastian Basierski <sebastianx.basierski@intel.com>
Reviewed-on: https://review.gerrithub.io/388568
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Disambiguate the log components from the trace functionality
(include/spdk/trace.h).
The internal spdk_trace_flag structure and related functions will be
renamed in a later commit - this is just a find and replace on
SPDK_TRACE_* and SPDK_LOG_REGISTER_TRACE_FLAG().
Change-Id: I617bd5a9fbe35ffb44ae6020b292658c094a0ad6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/376421
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Althrough the two functions are empty now, but they are not
vhost_scsi specific.
Change-Id: I331a455374f7dd92fd76cab255a43072baceb0dd
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/389477
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Make this generic and not directly dependent on
the event framework. That way our libraries can
register pollers without adding a dependency.
Change-Id: I7ad7a7ddc131596ca1791a7b0f43dabfda050f5f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387690
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Change-Id: I8ea8c59a0c67176c0c0c39abf807afad61ff3828
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387689
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Change-Id: I864cd8a6c206dfbe62fcb3f72275c1ae51aa4ed7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387688
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
DPDK 17.11 removed all rte_config.h includes
from rte_*.h headers, meaning we should either
use gcc param -include rte_config.h (just
like DPDK does), or include this file before
each other rte_*.h include. Since we're using
the latter approach in many places already,
I decided to follow it.
While here, also removed rte_vdev.h dependency
from rte_virtio/virtio_user.c. It's not used
anyway.
Change-Id: I865ee9f828211c03a60fd0446f7a418d5dddd140
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/387653
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
There are two separate abstraction layers:
* vsocket - which represents a unix domain socket
* virtio_net - which represents a vsocket connection
There can be many connections
on the same socket. vsocket
provides an API to enable/disable
particular virtio features on
the fly, but it's the virtio_net
that uses these features.
virtio_net used to rely on
vsocket->features during
feature negotiation, breaking
the layer encapsulation (and
yet causing a deadlock - two
locks were being locked in a
separate order). Now each
virtio_net device has it's own
copy of vsocket features, created
at the time of virtio_net creation.
vsocket->features have to be
still present, as features can be
enabled/disabled while no
virtio_net device has been
created yet.
Fixes#214
Change-Id: Ic4b2dd8cae6050813fc9a420b2ed30bc5ae60393
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/386294
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Virtio spec say that any IRQ requests are only hints. So try to limit
number of interrupts generated by vhost by defining minimum interval
between sending IRQ. Coalescing is disabled by default. Can be enabled
using RPC command 'set_vhost_controller_coalescing'.
Change-Id: I9b96014d004ea0ea022b4498c6b47d30d867091a
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/378130
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
The vhost connection can be closed
concurrently from 2 places:
* the connection thread itself
* rte_vhost_driver_unregister
The connection thread will terminate
the connection if any recv error
occured. The unregister function
will terminate the connection
together with the thread.
However, there is no sychronization
between those two. The connection
thread runs in the background
without any mutex.
The rte_vhost_driver_unregister
now signals the connection thread
to terminate itself and waits
until it's killed.
Change-Id: I012e97ebb8a79edcb2c17c28b2fc7e8041bf92b3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/383085
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Casting pointers without checking their length could
potentially lead to a crash
Change-Id: I7c61e5818ecfbf32bb363858965503341353c51e
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/382420
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Each virtqueue will now contain
it's own buffer for I/O tasks.
Some of the task struct fields
are now the same across subsequent
I/Os, so they can be now set
just once - at the vdev start/stop.
This simplifies the code, the
debugging process and also introduces
additional sanity check preventing
vhost from processing two requests
with the same id at the same time.
Change-Id: Idcf388e8bf7c92e5536199c35eb0eb6339c00d84
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/369114
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This enable storing SPDK specific stuff per queue. First use of
this will be event index feature.
Change-Id: Ieca6fa47a6f2e23bec73d2cda8b0ed8b9185bd28
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/376636
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Clarify some error messages
and simplify the code.
Change-Id: I586ea55a1d9fa10142d4a9d469b62f1b83076cd5
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/381925
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Some problems with indirect descriptors shown. Disable it for now to
have time to investigate it.
Change-Id: I8c6cfff94dc2159ab01f72986a8ae7d42c353e8b
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/382301
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Closing the framework has to go through all subsystems
without failure, so return codes are unnecessary.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I53c9b4df12d2357e641130869f398b18637e6ff7
Reviewed-on: https://review.gerrithub.io/381681
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
The task was being aborted before
setting it's free_cb. This
results in i.e. not allowing
vhost device to stop it's pollers,
as it would endlessly wait for
this task to finish.
Change-Id: I0de2d1f21da109db1045e433c07f153316e09997
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/381866
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Every descriptor may now contain
a separate descriptor table.
This increases the maximum number
of concurrent IO in a virtqueue
from about (vq->size / 3) to
(vq->size * SPDK_VHOST_IOVS_MAX).
Knowing that SPDK_VHOST_IOVS_MAX
is 128, and assuming that vq->size
is 128 (current hardcoded limit
for QEMU), this gives us over 16k
concurrent possible iovectors
on the fly
Change-Id: I0853d80f6f90d53f8774231972b430a5bf05460e
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/373703
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Also squashed function has_next_desc
into get_next_desc to simplify the
code.
We can't just mask indexes with
(desc_table_size - 1), since in
indirect descriptors case
desc_table_size might not be a
power of 2.
Change-Id: I8053b0e37c553548d76c7a9cfe6b4dbc11c28cfc
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/373744
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
A single timeout error message is printed on the
screen already, so the user knows about the
timeout. Instead of aborting the app here, wait
endlessly for the event to complete. User
can kill the app any time if he wants to.
Change-Id: Ie1853e27b277d654a8e1099866d120f7a51638ba
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/381075
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
One instance of strerror() was introduced after the spdk_strerror_r()
function was introduced in commit 4d43844f4d. Replace it with the
thread-safe version.
Change-Id: I83c6702f7965044ef5fa3577175f89a13dad833f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/381601
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This change allows for spdk_app_stop() to be executed on a DPDK lcore
instead outside of DPDK lcore range.
This is preparation for SPDK asynchronous finish, to assure
calling spdk_app_stop() from master core.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Iedc878346c74296b105f93507b2c858aedfbf16e
Reviewed-on: https://review.gerrithub.io/381535
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
A device without LUNs can't be used at all,
so remove it automatically
Change-Id: Iefea73916c83dfddf0229bbfac5dacb23590d920
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/371299
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
A vdev can change between the time the event
is enqueued and executed on proper reactor.
To detect this case, the event callback
was looking up vdev with the same name and
comparing it with old vdev pointer (from
the enqueue). This is now being simplified,
by looking up the current vdev just by
it's ID.
Change-Id: I33de03809b9d56840dd99caa8ccdf190a631ef31
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/380647
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This makes the async event body non-blocking
and also fixes potential deadlock scenario:
* call_external_event() enqueues vhost_event
* destroy_device() locks g_spdk_vhost_mutex
* destroy_device() enqueues it's vhost_event
* reactor dequeues events
* cb from call_external_event is dequeued first
* g_spdk_vhost_mutex is locked (deadlock)
* destroy_device() times out, abort()
Change-Id: If8f51ada3ee5c47ba126f74187a40a285c001c77
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/380634
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
replaced "remove_vhost_scsi_controller" and "remove_vhost_blk_controller"
with "remove_vhost_controller".
Change-Id: I6f4b180054c13f25aae992e9be50375d3750a376
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/377197
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Defer writing RPC response until after the device has been hotremoved.
Change-Id: I052280b205415e4a2ffa1421653cc49b8e3b1445
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/371119
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Devices can be added to a SCSI
vhost controller at any time now.
Change-Id: Ic5dd4b78465d3431479e0389b7ea902e1e25c337
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/371281
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This simplifies eventq API greatly. Since vhost supports only a single
LUN per device, lun parameter in eventq isn't required for now.
Change-Id: I1c41a3f509aca96f2de8de6563a3cac5c4dd1b8b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/371118
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Since we are calling eventq_enqueue only from inside of the controller
reactor, such ring is not needed. Eventq events will now be sent
immediately. This simplifies the whole process greatly.
The abstract vhost event layer is being replaced with much simpler and
less error-prone vhost external spdk_event API.
This reverts commit 542b5415 [1] together with vhost scsi device
hot-attach feature. Hot-attach shall be reintroduced in upcoming
patches.
[1] 542b541588 ("vhost_scsi: implemented abstract vhost event layer")
Change-Id: I39a427332d573c4e0be548d1c8caf0cf2858f6a5
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/371117
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Script for testing vhost using lvols as backends for
virtual machines. Option for using nested lvol stores and
nested lvol bdevs also provided.
Change-Id: Iad8a196c97f292881a8b424b4433ec281f12aec6
Signed-off-by: Lukasz <lukaszx.galka@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/365798
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Used vhost external event API to call RPC commands on
controller's reactor. RPC call get_vhost_scsi_controllers
has been left unchanged as it requires special *foreach*
external event API. See next patches for details.
Change-Id: I1fd77c9af2606bbcea45cd0089015dd890b6e328
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/371279
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Controller creation RPC can't be done on controller's reactor
(as there's obviously no controller yet...), so a special
set of vhost_mutex_lock/unlock() functions to has been added
to synchronise controller creation with the rest of
ctrlr-enumerating code.
Change-Id: Ib6e4b894a85ff1f70ebd047832c5a3568a00f1a7
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377651
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Continuation of patch 94afad5a [1].
That function could be called from outside of the vhost reactor,
causing data races and possible segfaults.
Now, after this patch, all ctrlr-changing functions take spdk_vhost_dev
parameter, meaning they should be called via external event API [1],
which soon will be the only way of obtaining spdk_vhost_dev pointer.
[1] 94afad5a ("vhost: added external API to call spdk_events on vdev reactor")
Change-Id: I40ea66ad09fb5c433dd897a4e22aedeb423f9b4b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/371013
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Added spdk_vhost_dev_backend_event_done function
that sets the return code for the callback and
transparently calls sem_post.
Change-Id: Iba27af780cd1753056c1607177c945e13c95c712
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377585
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
DPDK is now fully synchronized with the rest of vhost.
This patch also removes timed_event API from vhost_internal.h.
It should only be used internally in vhost.c under g_spdk_vhost_mutex.
Also, this patch temporarily gets rid of return codes for
vhost_scsi/blk dpdk callbacks. -1 will be returned if the
call timed out, 0 otherwise. A patch reenabling this
functionality is on the way
Change-Id: Ifd9566ceb55a3c6dbe4bac013cc3b7600c834d17
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/372687
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
The rte_malloc_socket() call just above that allocates vq is only
allocating sizeof(*vq), but the memcpy() would have tried to copy
sizeof(*vq) * 2.
This code is under #ifdef RTE_LIBRTE_VHOST_NUMA, so it was not normally
enabled with DPDK 17.05, but it breaks when DPDK 17.08 turns on libnuma
support by default.
Change-Id: I75c0c8666a9147346038d313fb419350988d8187
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/377596
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Some rte_vhost files use #ifdef RTE_LIBRTE_VHOST_NUMA, but they don't
explicitly include rte_config.h, which defines this macro. Instruct
the compiler to pre-include rte_config.h in the same way DPDK's build
system does.
Change-Id: Iddde76b8c3d0956ccd5f481956cede650d858586
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/377595
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This is a private function that is only called in one place, and cpumask
is always provided. Additionally, the code inside the mask == NULL ||
cpumask == NULL check always writes to *cpumask, so it was not possible
to pass NULL as cpumask anyway.
Change-Id: I2cde53dfeb07edc8a8f87f4ff485ec0c5c9ba7a8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/376685
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
The next step towards fixing synchronization issues between RPC and
vhost controller reactor.
The general idea is to hide spdk_vhost_dev_find declaration, so that
vdev-related functions can't be (incorrectly) called from outside of
the vhost controller reactor. The vdev pointer should only be acquired
via spdk_vhost_call_external_event.
Change-Id: I689226c2271f81624b2651bae3b960b7efb1c01b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/371098
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
The next step towards fixing synchronization issues between RPC and
vhost controller reactor.
This patch makes changes to already present vhost timed event API
to conform it to the upcoming external spdk_events API. The timed_event
API shall be removed from headers in future. See next patch for details.
Change-Id: I31b0d7c383b39c32326daa750663ebdeb4edd562
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377584
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This patch properly closes sockets on shutdown.
Previous rte_vhost_driver_unregister calls were returning
immediately due to inexistent sockets at given paths.
Change-Id: I5e4d64f04fc8b6bef914c2eb4c4d2220be9ca9ec
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377165
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
In preparation to make them static
Change-Id: I086868aa88fa4f6f9f1c24b15a2e3cd0a04caab1
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377096
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Removed leftover code.
spdk_vhost_timed_event struct has been stripped from
spdk_event and timeout fields. The first one was not
required since vhost_timed_events are not reusable
anymore. The latter has been removed to prepare
vhost_timed_event struct to be expanded to generic
- also non-timing out - vhost_event struct.
Change-Id: Ifd22f59b2748752f2776700676f07e70b45957ed
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377095
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Public API has been made smaller before refactoring timed_events
entirely.
Change-Id: Ie03bf5066582b6fd243229a9c8b1ceb77658dc2f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/372686
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Make use of new rte_vhost API.
vdev->vid is now set via new/destroy_connection(),
new/destroy_device sets vdev->lcore.
lcore != -1 implies vid != -1, hence some lcore checks have been
replaced with vid checks.
Change-Id: I08f4932ee7e6aeb3eba4874f2e94ad407764d9c2
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/372075
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Added new callbacks to notify about socket connection status.
As destroy_device is used for virtqueue processing *pause* as well as
connection close, the user has no distinction between those.
Consider the following scenario:
rte_vhost: received SET_VRING_BASE message,
calling destroy_device() as usual
user: end-user asks to remove the device (together with socket file),
OK, device is not *in use* - that's NOT the behavior we want
calling rte_vhost_driver_unregister() etc.
Instead of changing new_device/destroy_device callbacks and breaking
the ABI, a set of new functions new_connection/destroy_connection
has been added.
Change-Id: I50a8ca4035045892d6c658da7df58c0c97025ec3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/372074
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
If the IOMMU is enabled, automatically register memory
added by the user through spdk_mem_register().
Change-Id: Ie02c7bf445314da23e2efee9de9c187ed0773a9f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/375249
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2 locks are executed in 2 places in opposite orders.
Consider the following scenario, threads A and B:
(A)
* fdset_event_dispatch() start
* pfdentry->busy = 1; (lock #1)
* vhost_user_read_cb() start
* vhost_destroy_device() start
(B)
* rte_vhost_driver_unregister() start
* pthread_mutex_lock(&vsocket->conn_mutex); (lock #2)
* fdset_del()
* endless loop, waiting for pfdentry->busy == 0 (lock #1)
(A)
* vhost_destroy_device() end
* pthread_mutex_lock(&vsocket->conn_mutex); (lock #2)
(mutex already locked - deadlock at this point)
Thread B has locked vsocket->conn_mutex and is in while(1)
loop waiting for given fd to change it's busy flag to 0.
Thread A would have to finish vhost_user_read_cb() in order
to set busy flag back to 0, but that can't happen due to
the vsocket->conn_mutex lock.
This patch defers the fdset_del(), so that it's called outside of
vsocket->conn_mutex.
Change-Id: Ifb5d4699bdafe96a573444c11ad4eae3adc359f5
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/375910
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This reverts commit 6973898164.
This solution was incomplete, see the next patch which properly
fixes the deadlock issue.
Change-Id: Ib3cc609814276f1c48b05280379b8c2849ad831f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/375909
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Replace SPDK_TRACE_DEBUG with component-specific flags.
Change-Id: Iee7eafab5e6ac8713f247323a18552b5afb0e86a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375834
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This matches the name to the behavior and prepares for addition of a new
log macro for "info" log level.
Change-Id: I94ccd49face4309d3368e399528776ab140748c4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375833
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This function was unnecessarily exposed in public vhost headers.
Controller-constructing functions now take string cpumask param.
Change-Id: Ie97d218c525b1dfb11cfd7e7e13c1bf702b1a58d
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/373759
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
These headers are needed on systems that have old
kernels without virtio_scsi.h and virtio_types.h.
Move them out of the vhost directory and into include
so that they can be used by an upcoming virtio-scsi
initiator bdev module.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie6614b8845568729a38665c4c1a366b97978e315
Reviewed-on: https://review.gerrithub.io/374548
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Added mutex to synchronize vdev access from external threads.
This is the next step towards fixing synchronization issues
between vhost reactor, RPC, and DPDK.
Change-Id: Id4b52658e05d02c479618ae0e5b5e58af2f02789
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/371175
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
new/destroy_device implementations in particular backends now take
spdk_vhost_dev pointer.
This patch is a first step towards fixing synchronization issues between
RPC and vhost reactor. See the next patch which introduces generic
vhost mutex in vhost.c.
Change-Id: I448492330734726c21189f71ec7a9a8ed81c8195
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/372073
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Try to do the same as DPDK does: volatile write on used->idx and memory
barier before reading avail->flags.
Change-Id: Ibe4629a8228a02088913593ac9b32de56a60b062
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/373578
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
replaces all references to strerror in the spdk lib directory with
references to the thread safe strerror_r
Change-Id: I80d946cce3299007ee10500b93f7e1c8e503ee41
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/374012
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Added helper function to check if vhost controller supports given
feature.
Change-Id: If20883f5dd6d5fedf7fc253239961fdb55ca51fd
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/373702
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
A single warning message is printed instead.
This is required for VMs which have memory mapped virtual devices. (e.g
NVDIMM in Clear Containers). This memory won't ever be used by guest
kernel for IO processing.
Change-Id: Ie24501acbdb3ba0d67bd29b146a09b222451427d
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/373224
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9f2debc0a9404f4fc36ab307c73ead95a41cbd75
Reviewed-on: https://review.gerrithub.io/371021
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
A virtio descriptor may specify a buffer that spans
a huge page boundary or even a vhost memory region.
So modify spdk_vhost_vring_desc_to_iov() to take this
into account.
While here, also change spdk_vhost_vring_desc_to_iov
to return int instead of bool. int return with -1 is
most standard to indicate failure.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I71faefce0367dc9e44d70ea4429a28dd64f04c10
Reviewed-on: https://review.gerrithub.io/371756
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Randomly we loose some interrupts. This stop IO in guest till next
request is issued which is abort
Change-Id: I1a0b6391a324cabb0df17d2704126d161b1868f7
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/370248
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Update exisitng tests with vhost blk information
Add tests for scsi/blk hot-attach, hot-detach and hot-plug
Change-Id: I95dad5986d3795430fea304712a6491dfef712d0
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/369168
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
- task_data_setup() - value of 1 is no loger returned
- task_submit() -removed outdated comment
Change-Id: I523a465eba7af93535e2dc3a583abb315950f4b3
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/371154
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
blk_iovs_setup() error code was missinterpeted and no error returned for
IO that was directed to removed bdev.
Change-Id: Iec5ebef20734cca07f20f068b83b74b189cdcb66
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/370711
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Lukasz Galka <lukaszx.galka@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Implemented abstract vhost event layer on top of virtio eventq.
This allows us to defer virtio-event-related actions to be called from
the vhost poller thread. This is required for hot-attach, for which
io_channels have to be created on the I/O thread.
This adds full support for hot-attaching and hot-detaching vhost scsi
devices. They can be now attached to a controller via RPC at any time.
Change-Id: Icf353bfcf69c83ef16b8fc771ea4c487002094f9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/370016
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
-changed "cpu_mask" to "cpumask"
-changed "name" to "lun_name"
-changed "bdev" to "dev_name"
Change-Id: I52b77fa01384df8e6e725f236f23cb568b35f189
Signed-off-by: Paweł Niedźwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/368774
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This enables checking permissions - for example,
spdk_bdev_write will fail if the descriptor was not
created with write permissions.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I68b65a560f471f2e0f71a7f42cfa6689b911110f
Reviewed-on: https://review.gerrithub.io/369493
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Change-Id: I50203e0e02d2201fea5112789c1fd84b9a61417a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369283
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Virtio block doesn't know how to handle hot-remove so no way of
informing guest when that happen but at least we don't crash.
Change-Id: I54576bc0693c2e706ef3c45b0de313e9beb2a2c7
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/368789
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This variable was misleading and unnecessary. Replaced all it's
occurences with SPDK_SCSI_DEV_MAX_LUN.
Change-Id: Iaaf9ed5efb60f9a89585121d2fbec7b43c3723e9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/368115
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Renamed it to avoid misconceptions.
Struct rte_vhost_vring describes a virtqueue, not a vring.
Change-Id: I89b94c8d78052b1a4796a9b74653237e5f8b6f52
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/368720
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
struct spdk_vhost_task was renamed to spdk_vhost_scsi_task in commit
68f0c87e64, but this was rebased without
adjusting the spdk_vhost_task introduced by commit
05fd28399a.
Change-Id: I7046d04d3ce56d62fdfb1166f8b4c5676bc7397b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369080
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
We need MP MC ring for tasks. So instead implementing this add per
controller ring to avoid this issue.
Change-Id: I5926ad7866ab28251aeebd163917de2df2b44a22
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/368547
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
The function body uses VFIO_IOMMU_MAP_DMA which appears to be a
copy&paste mistake, make it VFIO_IOMMU_UNMAP_DMA because we are doing
the opposite of spdk_iommu_mem_register.
Change-Id: If9f3b188178e71ff71221c77c1680b679fec1df0
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-on: https://review.gerrithub.io/368551
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>