Commit Graph

56 Commits

Author SHA1 Message Date
Seth Howell
8a2527836d log: remove old-style errlog entries.
SPDK_ERRLOG lists the function name, so remove old references that
assume it doesn't and reprint the function name.

Change-Id: I69da6ca0a25bf0eda07d8dad52bcfadf964ac715
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469487
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-09-26 16:15:11 +00:00
Shuhei Matsumoto
752fa1ca27 thread: Assign not pointer but instance of spdk_cpuset in struct spdk_thread
This will reduce potential malloc failures.

Change-Id: Ie67554fec877e33bbd1044fc61eb4d79df306168
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459717
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-04 00:30:22 +00:00
Shuhei Matsumoto
3d1995c35b thread: Use not malloc'ed but fixed size string for IO device name
256 bytes will be enough but not too large for the name of SPDK IO
device. Use fixed size string for the name of SPDK IO device and
reduce the potential malloc failure. If the length of passed name
is longer then 256, it will be cut off without error.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I618b82a1d07769df7c775280fbf364cbcfdde403
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459721
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2019-07-02 07:04:58 +00:00
Shuhei Matsumoto
09013306c3 thread: Use not malloc'ed but fixed size string for thread name
256 bytes will be enough but not too large for the name of SPDK
thread. Use fixed size string for the name of SPDK thread and
reduce the potential malloc failure. If the length of passed name
is longer then 256, it will be cut off without error.

Change-Id: I13a24997a73a8365c8bf5e093f2bd78861ba6660
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459720
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-02 07:04:58 +00:00
Shuhei Matsumoto
1554a344c9 env: Add free_space parameter to spdk_ring_enqueue
DPDK rte_ring_enqueue_bulk() has free_space parameter to return
the amount of space in the ring after enqueue operation has finished.
This parameter can be used to wait when the ring is almost full and
wake up when there is enough space available in the ring.

Hence we add free_space to spdk_ring_enqueue() and spdk_ring_enqueue()
passes it to rte_ring_enqueue_bulk() simply.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9b9d6a5a097cf6dc4b97dfda7442f2c4b0aed4d3
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456734
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-05 05:23:58 +00:00
Ben Walker
e036215fe9 thread: Add a mechanism to exit a lightweight thread
Lightweight threads may now be exited by calling
spdk_thread_exit() within the thread. The framework
polling the thread can release the resources associated
with that lightweight thread by calling
spdk_thread_destroy().

Change-Id: I6586b9d22556b3874fb113ce5402c6b1f371786e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455319
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-05-22 04:23:17 +00:00
Ben Walker
f658a867f9 thread: Remove unknown_tsc tracking
This was actually always 0.

Change-Id: I33a14a9f213e8c7159f00f57c88f12cfdf1d3d60
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455318
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-05-22 04:23:17 +00:00
Ben Walker
dcb8ba7b8e thread: Add a cleanup function for threads
This reduces some repeated code. I could have made both paths
call spdk_thread_exit(), but I want to add some stronger checks
around the tls_thread there eventually that wouldn't be valid
in the other path.

Change-Id: I61e1484536d8aef05f120d9ed394312b41f8445a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453575
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-05-09 04:35:10 +00:00
Ben Walker
835d21a2d0 thread: Allow thread schedule callback to fail
Change-Id: Id391c2c03804dda0ad354d98dfe0a75fb4d3d324
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453012
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-08 21:56:59 +00:00
Darek Stojaczyk
7b3f411063 thread: fix deadlock in spdk_for_each_thread error handling
We could return from spdk_for_each_thread() without
unlocking the global threading mutex, rendering the
entire SPDK application useless.

Change-Id: I641c7b36db996f9a36310332279648014579de83
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452087
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-01 18:46:34 +00:00
Darek Stojaczyk
57706d1824 thread: add spdk_thread_get_cpumask()
Change-Id: I2811bdbbecb28c83403ebe94834afd9a808f12a4
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452203
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-05-01 17:36:44 +00:00
Tomasz Zawadzki
bbc49ab42f lib/thread: free cpumask on spdk_thread_create() failure
Change-Id: I2e814aa3188639edff47b6bb3f56609417e6c034
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451791
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-04-24 15:07:02 +00:00
Shuhei Matsumoto
38527b0786 lib/thread: Fix wrong posix thread name by SPDK thread scheduler
Before enabling SPDK thread scheduler,
each POSIX thread name was reactor_% (% was the core number).

After enabling SPDK thread scheduler, the name of the master POSIX
thread is reactor_% (% is the max core number), and the name of the
slave posix threads are lcore-slave-% (% is the current core number).

SPDK threads are light-weight threads - sometimes also called
green threads or fibers, and so are independent from posix
threads.

But reactor is tied to the POSIX thread in the SPDK event library.

So SPDK thread doesn't rename the POSIX thread at its creation
but reactor renames the POSIX thread at start instead.

This change makes POSIX thread name compatible between before and
after enabling SPDK thread scheduler.

Change-Id: I26e8dabc73e163c9f74e18b3640cf54954603b1f
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451712
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-24 07:40:30 +00:00
Ben Walker
5d0b5e2ce9 thread: Add cpumask parameter to spdk_thread_create
Allow users to optionally specify an affinity mask when
creating a thread. This isn't currently used, but we want
the API to be in its final form for the next release.

Change-Id: I7bd05e921ece6d8d5f61775bd14286f6a58f267f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451683
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 20:22:55 +00:00
Tomasz Zawadzki
154eb3399a thread: add spdk_thread_is_idle()
This function add possibility to check if there are any scheduled operations
on particular thread.

Return from spdk_thread_poll() will be used as a way to load-balance and
signify if any work was performed during the single iteration.
A poller could return 0, but still be registered.

This helps especially in fio_plugin that only checked active_pollers or
messages via spdk_thread_poll().

Change-Id: Id6237278eb3b4bd4922b2abaa3c8ebd5e434d45d
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/445915
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-03-01 21:38:02 +00:00
Tomasz Zawadzki
7173e9bd02 thread: add spdk_thread_has_pollers()
This function add possibility to check if there are registered pollers
on particular thread.

Change-Id: I80af06a10c5c1b54fed5bb28a3aa769a52d8a206
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/446624
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-03-01 21:38:02 +00:00
Ben Walker
4e7bb83e78 thread: Add a function to get the thread from a context
This is the inverse of spdk_thread_get_ctx.

Change-Id: I81541ff1687cfea358cb7046caf69982c38f6a38
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/444455
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-02-14 14:58:56 +00:00
Ben Walker
9810431431 thread: Allow for an extra region of memory allocated on each thread
Schedulers can use this region to store required information.

Change-Id: I93efb44f1a534596f6285bbe014579311fe011e7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/444454
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-02-14 14:58:56 +00:00
Ben Walker
836356f2d5 thread: Run all pollers on each spdk_thread_poll call
This prevents issues where spdk_thread_poll may report
that it did not useful work (for the one poller it ran),
causing the system thread to go to sleep.

Change-Id: I7a4842d5e399758c19268aee343a001ccfc88a3a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440598
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-02-13 09:55:17 +00:00
Ben Walker
8abfb06e31 thread: Optionally allow the current time to be passed to
spdk_thread_poll()

This is an optimization if the calling function already knows the
current time.

Change-Id: I1645e08e7475ba6345a44e0f9d4b297a79f6c3c2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/443634
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-02-11 22:58:45 +00:00
Ben Walker
15d3631064 thread: Move stats to thread
Change-Id: I351626355c45d0a3e66fec2688191429781e5952
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/443633
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-02-11 22:58:45 +00:00
Ben Walker
2446c5c6f3 thread: Keep caches of message objects on the thread object.
Change-Id: I2b34d0c44fb2c4d3ec5d9e4b3c22bfce53543ea1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/442774
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-02-05 06:49:30 +00:00
Ben Walker
13586cd82d thread: Allow nested spdk_thread_poll calls
This wasn't allowed at first to make debugging these
thread changes easier. Now they're mostly solid, so
let's allow this behavior.

Change-Id: Ida689c738ed550ec46c3cb6cab6788a651c6088b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/441159
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2019-01-21 13:54:46 +00:00
Ben Walker
9cba82b955 thread: Rename spdk_free_thread to spdk_thread_exit
This name more closely resembles pthread_exit, which is a
closer analogy to how the new threading library works.

Change-Id: I68b04509f3ff8e94b8688804a7e5661155a3ecd1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440597
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2019-01-17 11:24:38 +00:00
Ben Walker
b1c79d722b thread: Rename spdk_allocate_thread to spdk_thread_create
This mirrors pthread_create, which works more closely
to the new style where SPDK libraries can spawn their
own threads.

Change-Id: Ic524c4c35bcf7c1611e4f261ebb64b98ac5a5a1b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440596
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-01-17 11:24:38 +00:00
Ben Walker
1068e22da5 thread: spdk_free_thread now takes a thread parameter
Instead of implicitly grabbing the thread from the thread
local variable, make it explicit.

Change-Id: I733fad06181439e12b1e71a4829b84e7b64e2468
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440595
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2019-01-17 11:24:38 +00:00
Ben Walker
aaa9a27851 thread: Add a notification callback when threads are created
Nothing implements the callback just yet, but it will be used for
dynamic thread creation.

Change-Id: I088f2bc40e1405cd5b9973b9110608f49c8abd68
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440594
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-01-17 11:24:38 +00:00
Ben Walker
7ff602a660 thread: Allow spdk_allocate_thread to be called from an SPDK thread
The user can now spawn SPDK threads within the context of another
SPDK thread, opening up the possibility of spawning threads from
within SPDK libraries.

Change-Id: I308eebc3f1d6f51da7236621ef2f67817f04ce8b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440760
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-01-17 11:24:38 +00:00
Ben Walker
6728c4f4c0 thread: Eliminate function pointers in spdk_allocate_thread
These are no longer used by anything.

Change-Id: I0db6bc88e4dc945ff4f64df2ac410e1d00a669c1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/437601
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-01-17 11:24:38 +00:00
Ben Walker
5977aad8f7 thread: Eliminate use of pthread_self and thread_ids
SPDK threads are no longer mapped 1:1 to system threads. They are
instead identified by the memory address of the spdk_thread object.

Change-Id: I417f8376cebd2ee94f624f4436e6394b51486063
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/437999
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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-01-15 16:53:12 +00:00
Konrad Sztyber
22c1a00fa8 fio_plugin: use pollers' expiration for timedwait
Check next poller's expiration time to calculate the timeout for
pthread_cond_timedwait.

Change-Id: I96f81bab917c1bc628d94bba3c58d25066d4209a
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/437309
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2018-12-23 00:58:20 +00:00
Ben Walker
7b94053827 thread: Rename spdk_thread_msg to spdk_msg_fn
This is the callback type used for message passing. The
old name is easy to confuse with the callback to pass
a message to a thread or the upcoming callback to
spawn a thread.

Change-Id: I5fd63b57c4be2a4262a197850e6de4901be03ee7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/435941
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-12-18 23:31:08 +00:00
Ben Walker
978725c020 thread: Minimize scope of internal locking
Now that the thread is stored in a thread local
variable, the scope of the locking can be greatly
reduced.

Change-Id: Ic44934fff352be0fa5d54746226ef707aceae7b5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/435940
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-12-18 23:31:08 +00:00
Ben Walker
605e530a4e thread: Use TLS to accelerate thread look up
Change-Id: I8136db265c9cb8d61de4845ce6eaff2351b5b597
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/435939
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2018-12-14 18:54:03 +00:00
Ben Walker
f50d7325f8 thread: Fix check that prevented a debug log from printing
Change-Id: I4947c8fae27e9f5fcd282d0ef89accf6aba238da
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/436396
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-12-07 17:13:10 +00:00
Tomasz Zawadzki
c49786722a lib/thread: check for NULL return on _get_thread()
In addition UT were changed to set_thread() before registering
io device.

Change-Id: I959dbc800db9c1f50564274a73d71e05e843d8c9
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/433611
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>
2018-11-20 15:03:17 +00:00
Ben Walker
e1ec5c60ca event: Use a single event pool instead of one per socket
Previously, a pool of events per socket was created for NUMA
locality. However, when passing a message between threads,
the event would be taken from one pool and put back into another,
resulting in imbalances.

At this time, I do not see an efficient way to allocate the events
so that they remain NUMA local. We'll work on that over time.
However, for correctness right now, go down to a single global
pool of events.

Change-Id: I09f8b0c5c928777e8274c53c6dce21b9c346e2a5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/433519
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-11-20 10:39:38 +00:00
Ben Walker
d761ddbf57 thread: Message passing now handled internally within a thread
Move the message ring and the polling into the thread
itself.

Change-Id: I5bc53c68bb1314fd69ed80cc98c5b86ce8be880f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/423768
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-11-15 18:17:34 +00:00
Jim Harris
f3d7215681 thread: print dev->name in error messages
All io_devices now have an associated name - so add
that name to relevant error messages to help with
debugging.

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

Reviewed-on: https://review.gerrithub.io/433203
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-11-15 17:49:51 +00:00
Jim Harris
61385feeac thread: print error for io_devices at lib fini
All io_devices should be unregistered before the
application exits.  If not, print an error message
for each io_device that still exists.

Eventually we may want to assert() if any io_devices
are found, but for now we'll just stick with the
error message.

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

Reviewed-on: https://review.gerrithub.io/433202
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-11-14 20:29:14 +00:00
Jim Harris
c6d403e92d thread: print error if channels exist on thread free
Eventually we may want to assert if any channels still
exist when the thread is freed, but for now we'll just
stick with the error message.

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

Reviewed-on: https://review.gerrithub.io/433201
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2018-11-14 20:29:14 +00:00
Ben Walker
08d36a55f9 thread: Make the thread internally manage pollers
The user of the thread library is now only responsible for
periodically calling spdk_thread_poll. Pollers are handled
internally.

In order to avoid changing all of the unit tests, the ability
to provide function pointers to change the behavior of
the  poller registration is still in the code. This should
only be used from tests until they are all converted.

Change-Id: Ie2c00ce1d57ca3710ed2c469cd711924768e23ef
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/417784
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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-13 14:26:37 +00:00
yidong0635
bb2486a468 nvmf: change the return type of calloc failed
1.nvmf: change the return type of calloc failed to -ENOMEM and
keep consistency in this file.
2.thread: revise rc condition to ( rc!= 0),to deal with
all abnormal return.

Change-Id: I7cccb548f30448eaa1bac1a5904c3edcad9c1208
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/431459
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: Jim Harris <james.r.harris@intel.com>
2018-11-02 17:56:40 +00:00
Liang Yan
c9118cae57 thread: add the missing newline character
Change-Id: Ie122f37ea93d431b5e35cf46e56f53aa6795ef2c
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
Reviewed-on: https://review.gerrithub.io/429568
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-10-18 16:17:39 +00:00
Ben Walker
399a38a541 thread: Fix issue where a channel would be destroyed twice
The scenario is as follows:

spdk_get_io_channel(...)
spdk_put_io_channel(...) <- sends a message to do the release
spdk_get_io_channel(...)
spdk_put_io_channel(...) <- sends a message to do the release again
_spdk_put_io_channel(...)
_spdk_put_io_channel(...) <- boom

Change-Id: I86a66c68a525964e0d2dcd9cac2c292dc8b43136
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/424141
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: 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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-09-05 16:00:54 +00:00
Ben Walker
c94020001a thread: Add a name parameter to spdk_register_io_device
This is a string name used for debugging only.

Change-Id: I9827f0e6c83be7bc13951c7b5f0951ce6c2a1ece
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/424127
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-09-05 16:00:54 +00:00
Ben Walker
ec571793d4 thread: Add debug logging
This makes it easier to debug failures.

Change-Id: Ic1099ec08308d5e50dd9fe03798dc0873579f2cc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/423961
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-09-04 16:57:03 +00:00
Ben Walker
603a6de8d5 thread: Add spdk_thread_lib_init and fini
These don't do anything yet.

Change-Id: I718c6fb19c059a39bc5cb360c3da47ec05bfa416
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/423767
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-09-04 16:57:03 +00:00
Ben Walker
4eb7c48d75 thread: Align members of structs
Change-Id: Iaf339b4a09d3e5d84f64ddda47eaa1dd09d8e268
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/423962
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2018-08-31 05:12:01 +00:00
Ed rodriguez
3181857bc7 util: Remove usage of abort from library code
Change-Id: Ie03b29907f152dc2d0072b84b32a1f5d58818c74
Signed-off-by: Ed rodriguez <edwinr@netapp.com>
Signed-off-by: John Meneghini <johnm@netapp.com>
Reviewed-on: https://review.gerrithub.io/419285
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-07-17 17:40:11 +00:00