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>