This adds tsc statistics (busy, idle or unknown) to the reactor.
It will help measure actual time we are busy vs. idle during
an event run or whenever a poller kicks in.
Change-Id: Ife556a27a30dab842488bacb5fbee0d4297745c3
Signed-off-by: Vishal Verma <vishal4.verma@intel.com>
Reviewed-on: https://review.gerrithub.io/412695
Tested-by: 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>
Change-Id: I6babd4cf990bf19b510db88bdfb0ca81e29d9252
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/414700
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Madhu Pai <mpai@netapp.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This removes checks for timer poll iterations
within a reactor.
Change-Id: Id8eea26dab201064123575998b3b24e1f609ac5a
Signed-off-by: Vishal Verma <vishal4.verma@intel.com>
Reviewed-on: https://review.gerrithub.io/412694
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
See previous patch for some background.
rte_mempool uses the following formula for its ring allocation size:
```
count = rte_align32pow2(mp->size + 1);
sz = sizeof(struct rte_ring) + count * sizeof(void *);
sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE);
```
With count==262144, rte_mempool was trying to allocate
(2MB + sizeof(struct rte_ring) physically contiguous memory.
Change-Id: I69e8cdcbcaaaa8a053540588afa6eb2fd36c525b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/408926
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
The following assumes we use env_dpdk underneath.
rte_mempools use rte_rings internally. When creating
a mempool with capacity N, we internally try to create
a ring with least N+1 size. That's because rte_rings
need one extra empty element to differentiate between
the full and empty state. To make it worse, the ring
size has to be a power of two, so rte_mempools use
`rte_align32pow2(mp->size + 1)` for the size calculation.
And rte_ring memory has to be physically contiguous.
Allocating a mempool of capacity 262144 requires at
least (2 * 262144) * sizeof(void *) = 4MB memory. This
made us require at least 2 physically contiguous
2MB hugepages.
Change-Id: Iabc984a29a60c0b2cf5309a78cd1bcce28ac7b3d
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/408925
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib438db398f899946ef7d2f1be3d4c7424ed2fbcf
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/408252
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 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>
There are two separate function pointer types declared in io_channel.h:
spdk_thread_fn for cross-thread messages, and spdk_poller_fn for
pollers. They currently have the same signature, but this will be
changing in an upcoming patch, so we need to fix the poller-related
functions to use the correct type (a few were using spdk_thread_fn by
mistake).
Change-Id: I0f0d8f1eea9905395125fc91e0355a49e65be99e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403598
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>
Modifies behavior of spdk_app_start() and spdk_app_parse_args()
such that they return on failure instead of terminating with
exit().
Change-Id: I82566417f04e1ae2e3ca60a00c72e664db26c9e4
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/401243
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>
Automatically detect more whitespace errors.
All existing cases are fixed; only whitespace change (verify with
diff -w) except for one comment style fixup in include/spdk/nvme.h.
Change-Id: If750e54b9c8e3421ea6feda5f20184a31431631e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/402360
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>
Fixes github issue #218.
This patch introduces spdk_cpuset object to store and manipulate
the set of individual CPUs. The main objective of this object is
to replace cpumask declared as uint64_t and extend the limitation
of supported CPUs (lcores) above 64 CPUs.
spdk_cpuset is always allocated dynamically and accessed by opaque
pointer, what makes it easier to extend in the future without
breaking API/ABI.
This patch also extends parsing function allowing to set cpumask
using a list of cpus e.g. "[0-4,10,12]" sets mask of 0,1,2,3,4,10,12
as well as hexadecimal string with and without "0x" prefix.
Change-Id: I475c3ba7fab629021a22e03176e57e400dd24a49
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/390794
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
SPDK reactor is one per cpu and SPDK_MAX_REACTORS is used as the
maximum number of cpus locally in the file.
When the maximum number of cpus is changed, SPDK_MAX_REACTORS is likely
to fail to be changed.
Adopting two improvements for iSCSI by Ziye to the reactor will be safer
than now for the reactor.
- iscsi/conn: remove rte_config.h header
- env: export spdk_env_get_last_core function
Change-Id: I4941454ffdb704fa7799549e1f190c9bae3a4421
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/392911
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>
There existing an overflow for the large value of sleeping time
for the poller and the actual time may be incorrect setting due
to this overflow. Update the calculation here.
Change-Id: I14fe21d3f0e1abaa9d13d3d6254aff254d2dfcc3
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/392127
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
there are still several printf statements in app.c but those occur
before the call to spdk_log_open
Change-Id: If017c4d658ca45f34b97500bb1a3db5ab1f0675e
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/391888
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Disambiguate the log components from the trace functionality
(include/spdk/trace.h).
The internal spdk_trace_flag structure and related functions will be
renamed in a later commit - this is just a find and replace on
SPDK_TRACE_* and SPDK_LOG_REGISTER_TRACE_FLAG().
Change-Id: I617bd5a9fbe35ffb44ae6020b292658c094a0ad6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/376421
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Make this generic and not directly dependent on
the event framework. That way our libraries can
register pollers without adding a dependency.
Change-Id: I7ad7a7ddc131596ca1791a7b0f43dabfda050f5f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387690
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Change-Id: I8ea8c59a0c67176c0c0c39abf807afad61ff3828
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387689
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Change-Id: I864cd8a6c206dfbe62fcb3f72275c1ae51aa4ed7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387688
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
There may have the situation that associated socket does
not have enough memory for the event pool and the related
ring buffer. As the event pool will be created at any
available socket, this will be same for the ring.
The basic idea is to first allocate the memory for the
core associated socket and then try other available sockects
before terminating.
Change-Id: I52c240289899c136b607629c12c0250ad859c8ac
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/385972
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
First this change moves spdk_subsystem_fini() to trigger on
spdk_app_stop(). This ensures that spdk_subsystem_fini() is called
before reactors are stopped in spdk_reactors_stop().
Finish paths for subsystems, bdevs and copy engine is now
asynchronous.
Each of those three mentioned have to make sure they are
asynchronous as well.
Only bdev that currently has requirement for asynchronous finish
are logical volume.
Thus the change in vbdev_lvol.c making it move to next bdev module
only after all lvol stores were unloaded.
Fio_plugin finish of bdev and copy_engine was removed for now.
Next patch in series adds it back with async support.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I80ee2d084f3d82c50bf1329e08996604ae61b1b3
Reviewed-on: https://review.gerrithub.io/381536
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>
spdk_app_fini() changed to void, as no operation within it
can fail with meaningful return code.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If77cbf745a8e3fcba4ea24411aa1816f3910cde7
Reviewed-on: https://review.gerrithub.io/381537
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This allows the user to enable/disable getrusage() monitoring at
runtime.
Also change the log level to INFO and enable the monitoring in all
builds, not just #ifdef DEBUG.
Change-Id: I2f5c3bc8cd83dcb2a72dc7078bf2cb43aa28827c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/376473
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This matches the name to the behavior and prepares for addition of a new
log macro for "info" log level.
Change-Id: I94ccd49face4309d3368e399528776ab140748c4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375833
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This moves the thread name setting code into the generic SPDK thread
setup code, so now all spdk_threads can be named, not just ones created
by the event framework.
Change-Id: I6c824cf4bcf12fe64a8e2fc7cdc2d6c949021e40
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375220
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This patch Log a message in the reactor if any context switches occur.
Change-Id: I5306a5d29bce57ee9383d3ffdc9a0f7916a5b813
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/374560
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This is just a convenience and replaces the common practice
of passing -1.
Change-Id: Id96734307ebf52ef0ee7dba0e7ac89602b2b5b1a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/374520
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>
We don't actually need the socket mask.
Change-Id: Icec9e571e31f1955644b32c919e3f5a699338f0b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/370722
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This is required for using the event framework
in multi-process mode since they must be unique
across the group of processes..
Currently the stub app calls into the env layer
directly, bypassing the event framework, so this
issue would only be seen with multiple secondary
processes using the app framework. Some future
changes will change the stub app to use the event
framework which necessitates this change immediately.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I5e1acc95380a20a0204c327906c7ef83a82d7fac
Reviewed-on: https://review.gerrithub.io/366647
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
In this patch, spdk_app_init will be merged into
spdk_app_start.
Due to this change, we need to change event_perf
to use spdk_app_start, since we cannot use spdk_app_init
anymore. So the related changes for event_perf is to
make it work with reactor framework.
Change-Id: Id67edf209fd628cca361a499068c93aeedfe6167
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/364153
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>
Change-Id: I38dc084783859851f70a3b0c78e3546c5dff1872
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/363609
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Change-Id: Ia20284118077e49f2988f30469c3e3f4100ebdf0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/363607
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
The stricter warning levels (-Wimplicit-fallthrough=4) require all-caps
FALLTHROUGH, so update the existing comments to match.
Change-Id: I5f8608101cad31d8ea8e84d48604397f98400e87
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/363491
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
When a thread is registered, the user must provide
a function pointer that can pass a message to that thread.
Change-Id: I743b5e0d6e3b5118c0a68d2fcedbccdd6fb237f9
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362067
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
It is unused an misleading.
Change-Id: Idb2e3c1b244dfb4aa99bcecee8a3dba6efbc33aa
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/362335
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Fix up the existing comment blocks misaligned in the first column.
Also add line numbers to the comment checks.
Change-Id: I9d28c365271df36e7013d74cbb02d0023ab4f581
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The DPDK mask and the reactor mask are always the same.
Change-Id: I83d3ab87cdfb405574f6472cfc222d3f311abdb1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Avoid division by zero in the event mempool cache size calculation.
Change-Id: Ic117ef2dc3a798fb0a57572f1178233e83e73849
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
If we do not do a bounds check, this can run off the end
of an array.
Change-Id: I43cc4848fca7d68218e507db20e33823f8b550e4
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Avoid a runtime check for the rte_ring type - we know that the event
ring is multi-producer/single-consumer at compile time.
Change-Id: I5d42aee9c635db86e545b661361a68818d80961d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The work item queueing code was replaced with the current reactor/event
model, but the block comment above _spdk_reactor_run() wasn't updated to
match. Replace the pseudo-code with something resembling the current
behavior, and delete the outdated paragraph below it.
Change-Id: If0686c6a5d063f56d8ea3df9bf3a1e98eef40207
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Instead, check them every 5 iterations by default.
Change-Id: I9c42922868f8e965a0c801109e59e06aff5adf62
Signed-off-by: Ben Walker <benjamin.walker@intel.com>