Commit Graph

10877 Commits

Author SHA1 Message Date
dongx.yi
3cf37bbfbc vhost: Inline the calculation of vhost session memory region.
There are for loops to do these calculations for vhost session memory region.
we can inline these for both in vhost_session_mem_register and
vhost_session_mem_unregister.

It not only removed the duplicated codes but also reduced the stack consumption.

Signed-off-by: dongx.yi <dongx.yi@intel.com>
Change-Id: Idb9f5ea13e09aef6b24fa27a2bb809b15ece50e2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478820
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-07 12:17:55 +00:00
Vitaliy Mysak
1a5d78e32e iscsi: replace fprintf by SPDK_LOG
Replace usage of fprintf(err, *MSG*) by SPDK_ERRLOG(*MSG*)
since in SPDK we always prefer later

Change-Id: I3e2b5c12caa572b32236f5ede01b754b2e1e2a53
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478940
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:17:19 +00:00
Tomasz Zawadzki
20c74e0c71 lib/blob: do not zero out cluster map for snapshot blob
Always when creating a snapshot, new blob is created.
That blob is explcitly set as thin provisioned with size of
the original blob in _spdk_bs_snapshot_origblob_open_cpl().

Thus it should always contain empty cluster map,
as API user has to interaction with it yet.

As sanity check for debug builds, verification if all clusters
are 0's is added.

This empty cluster map is later swapped into the original blob
in _spdk_bs_snapshot_swap_cluster_maps().

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I4b935c0cf08917e9ad7b9bbedac4781890626eec
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478974
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:43 +00:00
Tomasz Zawadzki
44502e4293 lib/blob: simplify loading snapshot completion
Refactor blob loading when snapshot is present.
All paths now go through _spdk_blob_load_final().

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ifc927de6800501cdf62dba8d73e950af2a46d568
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479143
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:43 +00:00
Tomasz Zawadzki
42432d49dd lib/blob: all error paths on blob load use _spdk_blob_load_final()
Since all error paths for blob load are now the same,
they can go through common function to handle
freeing and calling the original cb.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib3afc7e62b6f9c872bb1d5f72ef61170aee966d7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479142
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:43 +00:00
Tomasz Zawadzki
e7b3be98a6 lib/blob: always pass cb_arg on blob load failure
Originally the code was suposed to determine if
loading the blob succeeded, based on passing the
cb_arg.
This breaks the logic of always getting the cb_arg in
cb_fn, and basing the success on bserrno.

In order to fix this, cb_fn always gets the passed
cb_arg. Meanwhile the cb_fn (_spdk_bs_open_blob_cpl(),
now checks the bserrno to determine failure.

In addition since _spdk_bs_open_blob() was the original
caller allocating the blob structure,
the  _spdk_bs_open_blob_cpl() is now responsible for freeing it.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ic7eb09f05e04b08dc54fc43243fd576f493cbeb2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479141
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:43 +00:00
Tomasz Zawadzki
3225f86bc2 lib/blob: save the sequence much earlier into blob load
The sequence was saved into the load context much later
into the loading, instead of right when ctx is allocated.

This will come in handy in later patches that refer to
sequence earlier (in error paths).

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ibe513dbd919f36874fcde763fc96d46973b60446
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479140
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:43 +00:00
JinYu
ada795302a nvmf_example: add the acceptor poller
Add acceptor poller to handle all the connections.

Change-Id: I3228547d63a5812b90fe4394641cf124d9e64d12
Signed-off-by: JinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468660
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:05 +00:00
JinYu
095fef2f45 nvmf_example: start subsystems
Change-Id: Ic1aa1ad9c2cbd637fd1b6d5609a36a63f5f8a698
Signed-off-by: JinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468659
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:05 +00:00
JinYu
8d601b077f nvmf_example: create the poll groups
Create the poll groups of the nvmf target.

Change-Id: I56a7add994927245ef5984574fa6230821276b7f
Signed-off-by: JinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468658
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: GangCao <gang.cao@intel.com>
2020-01-07 12:16:05 +00:00
JinYu
b63e47f237 nvmf_example: construct the nvmf target
Construct nvmf target.

Change-Id: I126d2f6b9f96840975fbc8fb833d0d7bc03b35fd
Signed-off-by: JinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468657
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: GangCao <gang.cao@intel.com>
2020-01-07 12:16:05 +00:00
JinYu
c871ee40e6 nvmf_example: add the signal handler
Add the same handler for SIGINT and SIGTERM so that
the working thread can exit.

Change-Id: If1ce617ddd778e92bed6f95089c48caf841e256f
Signed-off-by: JinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468661
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:05 +00:00
Seth Howell
9db5eca6a8 test/ocf: use run_test framework directly.
Change-Id: I7363102aac4363e1d8cf8e68281ad869afb4269b
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476956
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2020-01-07 12:15:34 +00:00
Seth Howell
9f9f120cac test/iscsi: use run_test semantics in filesystem test.
Change-Id: Ie58dfb5e6147437d325439fca9bbcaebbb4ccebb
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476946
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2020-01-07 12:15:34 +00:00
Seth Howell
3e1393a795 test/nvme_opal: use run_test framework
Change-Id: I39a4a279c365114d52e103bbd2a08a16bfbb3b7c
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476942
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2020-01-07 12:15:34 +00:00
Seth Howell
e33f835484 test/event: follow test_run framework
Change-Id: I6159292441269819eebcf858a6b7447a95cbbc7c
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476941
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2020-01-07 12:15:34 +00:00
Seth Howell
543bb88c11 test/unit: organize unittests by directory/name
Change-Id: Ibe29b3a838426f968af2b5d50a2c6b63a86bd7a1
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478534
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2020-01-07 12:15:34 +00:00
Ben Walker
dd7cd80c6d env/dpdk: Detect DPDK's iova mode
Match DPDK's iova assignment strategy so there are never
any conflicts.

Change-Id: I3863487f9bd247c40edbf0d0d3a8c880bdad1708
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477362
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:14:56 +00:00
Shuhei Matsumoto
801e76d8bf bdevperf: Change g_run_failed to g_run_rc and use it correctly
Change bool g_run_failed to int g_run_rc.  If any error is detected
during bdevperf running, negative return code is directly set to
g_run_rc. Then g_run_rc is passed to rpc_perform_tests_cb() or
bdevperf_fini().

Besides, we had updated g_run_failed even after spdk_app_start()
returned.  However return code of spdk_app_start() might not be of
bdevperf_run().  Hence change main() to return the return code of
spdk_app_start() simply without updating g_run_failed.

Additionally, even if g_target_count becomes zero in
spdk_bdevperf_shutdown_cb(), g_run_rc may indicate error.  So,
change spdk_bdevperf_shutdown_cb() to pass g_run_rc to
bdevperf_fini().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia85680679087c3106ba687d7e58027ae8ff4a5c7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478833
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
5412468f87 bdevperf: Use negative errno to pass bdevperf_fini() or rpc_perform_tests_cb()
bdevperf_fini() had expected to get one but rpc_perform_tests_cb()
had expected to get negative errno for any error. Using negative
errno will be reasonable and change the code accordingly.

The next patch will unify local rc variables and the global g_run_failed
by changing g_run_failed to g_run_errno.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia43da0793f8e77a5d5491758589e9b77f4cf86e7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478832
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
c3aad41fb1 bdevperf: Factor out free targets and call app_stop() into bdevperf_fini()
This is a preparation to subsequent patches. They will make start
and stop of bdevperf asynchronous. Encapsulating free targets and
call app_stop() will be helpful for them.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1a86d787614be048cec66e5d5fcfeb85de843ad5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478817
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
e7a300e096 bdevperf: Free all targets before exiting bdevperf application
We will use SPDK application framework (SPDK thread, IO channel, and
etc) to manage IO target groups, and will need to free IO target
groups before exiting bdevperf application.  As a preparation,
move bdevperf_free_targets() before returning from spdk_app_start().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id695a88107f87a9573c281f7f7d26d91d3a307b5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478778
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
f4e536cb57 bdevperf: Use rpc_perform_tests_cb to remove duplicated code
Due to the last patch, we can use rpc_perform_tests_cb() in
rpc_perform_tests() simply and remove the duplicated code.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id56da12fb5c52b6d178912f2f6cc7ead8a9cc36e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478761
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
15cc012336 bdevperf: Move g_target_count check into bdevperf_test()
Subsequent patches will make bdevperf_construct_targets() asynchronous
and call bdevperf_test() as its callback. Moving g_target_count
check into bdevperf_test() will make the change easier.

As a result of this move, rpc_perform_test() is simplified a little.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I308ab472a0021278af1a1f5aa65268126a60673f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478760
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
fd9c6a3d66 bdevperf: Use SPDK event to call bdevperf_target_gone() on the correct core
Fix the issue that target->run_timer and target->reset_timer needed to
be called on the core which runs the target.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia36681ac51a46f272e5738d0ae63838939e71e28
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478712
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
aa3df27439 bdevperf: Call put_io_channel on the core which called get_io_channel
spdk_put_io_channel() sends message if the core on which it is
called is different from the core which called spdk_get_io_channel().

However, ch->ref is guarded by mutex at free and we should call
spdk_put_io_channel() on the core which called spdk_get_io_channel()
as possible as we can.

Hence move spdk_put_io_channel() from end_run() to bdevperf_complete().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8816b28625869662c6b9124036b619b76bf96a3c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478709
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
1d0048097d bdevperf: Change io_target_groups from array to linked list
This patch changes io_target_group from array to linked list
and removes g_coremap.

In particular, change how to choose io_target_group for each
target, and reverse if condition in performance_dump(). These
changes will the code clearer.

Besides, remove blockdev_heads_destroy() because it just calls
bdevperf_free_targets() now.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I170a1c58fe2df9a11902224dd8634462a9af6123
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478565
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
333fd3ee32 bdevperf: Delete g_coremap and use lcore of io_target_group instead
The role done by the variables has been replaced by lcore of
struct io_target_group. So we can delete them safely.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2ed856c8ccfda1d72b3fc97677fecaf295df37af
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478706
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
f20617066e bdevperf: Hold associated core ID in struct io_target_group
Hold associated core ID in io_target_group and use it later.
This simplifies event calls in bdevperf because we don't need
to get core ID from io_target.

The next patch will delete g_coremap safely because io_target_group
manages lcore correctly now. lcore of the struct io_target will
be deleted too but it will be more later.

The subsequent patches will move bdevperf from core based to
thread based and the added core ID will be removed eventually in
this patch series. However these changes are helpful even so.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia763a79bc3810a15485285aebb9fc15a8d48332f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478705
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
bc08958b6a bdevperf: Add io_target_group and chain associated io_targets to it
Add struct io_target_group and chain associated io_targets to it.

Particularly, replace current target->next pointer by TAILQ, pass
not the head io_target pointer but the io_target_group pointer to
event call, and use TAILQ_INSERT_HEAD() in bdevperf_construct_target()
to keep the current ordering.

Besides, add pointer to the queued io_target_group to struct
io_target to use it later.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib37db825a863f7795c55c19fae0d38efd80c607e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478563
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-03 15:07:58 +00:00
Shuhei Matsumoto
25c5e3f59d lib/event: Rename context switch monitoring APIs to be concise
spdk_reactor_enable_framework_monitor_context_switch and
spdk_reactor_framework_monitor_context_switch_enabled had been
a little long and not easy to get the meaning.

spdk_framework_enable_context_switch_monitor and
spdk_framework_context_switch_monitor_enabled will be a little
more concise, and hence change the names accordingly.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5f1d50e8b62846cbd0f91b94f94cbaf16fefa39b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478538
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
43d7867243 lib/thread: Update comment for spdk_thread_poll about thread exiting
Remove the description "return -1 if thread has exited" and add
the description "If the thread has exited, return immediately" instead.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If4b4b565dc7aa1261fa7c3fdfb73cfc814e38d5d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478385
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
876fdf2a59 event/rpc: Add framework_get_reactors RPC
Add an new RPC `framework_get_reactors` to retrieve list of all
reactors.  Running threads on each reactor are included
in the output.  Update jsonrpc.md and CHANGELOG accordingly.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I985d087dd41afe3033b7678af141ec8e5a2a822e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478027
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
abbd6ed864 lib/event: Make spdk_reactor_get public in SPDK internal
Following the last patch, this is also a preparation to add
reactor_get_stats RPC.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I18c260bb10bdf1c7aa5e00aa81a171f2ff50c7d5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478026
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
653dbcb185 lib/event: Make reactor structure public in SPDK internal
Following the last patch, this is also a preparation to add
reactor_get_stats RPC.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia6dc29f591f7112512be8a67b180b056150f467b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478025
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
60eb6da8b7 lib/event: Add spdk_for_each_reactor to process event for each reactor
This API will be used in the upcoming reactor_get_stats RPC first.
This API is not public but internal in SPDK. Add necessary unit test
together.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I761ffe3c8d6d8da4594c0d728b479f9f40275fc9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478024
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
368be3b199 ut/event: Add test case for reactor's thread schedule
Test if spdk_reactor_schedule_thread() scheduled thread correctly
to one of the allowed cores.  Use thread library and expect
spdk_reactor_schedule_thread() is called at the end of
spdk_thread_create().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibb536d16849c29081fb63341f5dbe1a4c0db1d18
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478157
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
16ea979d71 lib/event: Check if reactor scheduled thread to the correct core
Add check if reactor scheduled the thread to one of the allowed
cores correctly to _schedule_thread().

This check will be useful in the next patch and may be helpful
when we schedule SPDK thread dynamically.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibea8e8315187ae8a3a421007d8865bbee2d7e037
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478156
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
c697cbfd9e ut/event: Add test case for SPDK event call
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4977d1e438b1187411d1e20c392708520780fb3f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478155
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
5940e9cd63 ut/event: Add test case for reactor initialization
Use the newly added mocks for CPU core operations.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If90bba6fd68c29c83cdb3c201a2a9fbdb40f6755
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478154
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
f74107fb85 test/common: Mock CPU core operations for unit tests
Mock DPDK lcore operations for unit tests. Remove duplicated stup
from unit tests for NVMe-oF FC transport. The next patch will use
them.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4f6fbd8f45942ca13fcf10ba1740a9fe8e573063
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478153
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
0bc0463e3e test/bdevio: Use local instance of cpuset in test_main()
bdevio test tool is not critical but change it to use instance
of cpuset to spread statically allocation of cpuset throughout.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9722d491cb6ec3202312285013105f7b6aeb1f15
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478581
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>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-03 08:32:38 +00:00
Shuhei Matsumoto
040339550c lib/event: Use local cpuset instance in spdk_app_start()
Following the recent effort, use local instance of cpuset instead
of using cpuset pointer and allocating dynamically to it in
spdk_app_start().  This change will avoid potential out of memory
failure for application startup too.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I22b529da13e893db16296167f2d8d4c296dec31f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478580
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>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-03 08:32:38 +00:00
Shuhei Matsumoto
87a4630b96 lib/vhost: Allocate cpumask statically for poll group assignment
Following the recent effort and the last patch, allocate g_tmp_cpuset
statically in lib/vhost/vhost.c.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5ed6179f9d5942cd868be008c3be6c35d755b455
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478579
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>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-03 08:32:38 +00:00
Shuhei Matsumoto
1a1cbdf303 lib/vhost: Allocate cpumask statically for struct spdk_vhost_dev
Following the recent effort, allocate struct spdk_cpuset statically
for struct spdk_vhost_dev. In vhost_dev_register(), a dynamically
allocated  cpumask had been set to spdk_vhost_dev, but change it
to spdk_cpuset_copy().  So use local cpuset instance in vhost_dev_register()
accordingly.

To reduce the size of patch, this patch doesn't include the change
for g_tmp_cpuset. This will be done by the next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic97753d1f470cbfd9ae7fc7f2af8ced5a31c8477
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478578
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>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-03 08:32:38 +00:00
Jacek Kalwas
5b87daa92f nvmf/tcp: remove redundant memset
Minor optimisation done by code analysis, both cmd and dif are
overridden in TCP_REQUEST_STATE_NEW.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I6bae4ddae175035d029c0693f7e4351b95a296ab
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478604
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-03 08:31:52 +00:00
GangCao
66af6221a0 bdev: check whether memory allocated already
In the case of bdev initialization, the memory could
not be allocated. When cleaning up, it needs to check
whether the memory pointer is valid or not before
touching the address of the pointer.

This is to fix below issue:
https://github.com/spdk/spdk/issues/1126

Change-Id: Iec0e2c5a40ad153a96fb939414a15ac3b9112a01
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478849
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <box.b.chen@intel.com>
Reviewed-by: yidong0635 <dongx.yi@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-12-30 11:49:54 +00:00
Jin Yu
cbc9d34362 test: add the UT of the timeout IO in mt
Extend the unit test of the timeout IO to multi-thread.

Change-Id: I6cd19b629a5f1e473f69685f495fa067a5f5da25
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476052
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2019-12-30 11:49:04 +00:00
Jin Yu
cb8621eb95 nvmf: add keep alive cmd in discovery subsystem
The discovery target support the keep alive timeout so
it should also support the keep alive cmd.

Change-Id: I08bd3312c17962c97c96fdd1469246fe97d5e8e7
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478016
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: yidong0635 <dongx.yi@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-12-30 11:48:44 +00:00
Shuhei Matsumoto
df8992dfb1 bdevperf: Change break to continue in some for loops
Number of entries of the array g_head is spdk_env_get_core_count(),
and hence we did not need to break from some for loops.  For them,
continue to the next iteration will be more appropriate and do the
changes in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6e97099622d58f44d92482beaf24ca61de4ca038
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478756
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-12-30 11:46:51 +00:00