Commit Graph

21 Commits

Author SHA1 Message Date
Krzysztof Karas
0c4c32a928 bdevperf: avoid writing outside "out" array boundary
Currently variables "i" and "k" in config_filename_next()
function may increase at the same speed. When repeating
"for" loop at line 1862 both "i" and "k" are being incremented:
 + i by the for loop,
 + k by the "out[k++]" instruction.
This means that there may be a case, where for loop ends with
"i < BDEVPERF_CONFIG_MAX_FILENAME" condition, as value of "i"
is equal to BDEVPERF_CONFIG_MAX_FILENAME, and at the same time
value of "k" is also equal to BDEVPERF_CONFIG_MAX_FILENAME,
because after writing to out[BDEVPERF_CONFIG_MAX_FILENAME - 1]
element, we increment it one last time.
This results in writing "0" value at line 1873 to memory outside
"out" array boundary.
To amend this problem, compare k against
BDEVPERF_CONFIG_MAX_FILENAME, insted of i.

Change-Id: Ia45778c1f267d2b9dcd676cd9b6c662d09f6f94e
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17176
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-05-09 17:58:11 +08:00
Krzysztof Karas
8e8c360b53 bdevperf: free job->zipf
Currently we do not free the memory allocated
during spdk_zipf_create() call, when we exit
the for loop on line 1769 with error. Remedy
this problem by adding spdk_zipf_free() calls.

Change-Id: I1d593ad2375204b158a2c97b23e492e69f836f43
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17405
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-04-06 14:24:16 +00:00
Shuhei Matsumoto
8e373044bf bdevperf: Create and use per lcore thread pool
If bdevperf runs with -C option and two or more NVMe bdevs,
two or more poll groups are created on each CPU core because bdevperf
creates one SPDK thread per job per CPU core in this case.

However, generally SPDK application creates one SPDK thread per CPU
core. We want bdevperf to immitate closely generic SPDK application
pattern.

For this requirement, create a thread poll made of per core threads.
Then, each job gets one of the threads whose lcore matches instead of
creating a new thread.

This feature is available only if bdevperf's config file is not used
because bdevperf's config file can specify cpumap per job.

Fixes issue #2933

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I0bd5a72f9ee8deade6c4e8ca0cdea3c89ff2541f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16994
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-03-08 08:46:29 +00:00
Shuhei Matsumoto
72da547aa2 bdevperf: Use job->name instead of spdk_thread_get_name(job->thread)
The next patch will support a feature to share per lcore thread among
multiple jobs. Hence, spdk_thread_get_name(job->thread) will not be
usable. Currently job->name is equal with
spdk_thread_get_name(job->thread). Hence, we can do this replacement
simply.

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I9e086d18043cf6125e059c85044420138c0eeece
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16993
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2023-03-08 08:46:29 +00:00
Slawomir Ptak
d254a3b924 bdevperf: Random map for picking I/O offsets
Added a random map feature (-D command line option),
which enables offset tracking of every I/O
for random read, random write and random rw mix,
to make sure every offset is accessed the same
number of times.

Change-Id: I5a0a23718b9f0a94ca094f86175c036b3230fb8b
Signed-off-by: Slawomir Ptak <slawomir.ptak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16865
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-02-24 12:51:45 +00:00
Slawomir Ptak
652db802f1 bdevperf: Outstanding requests array size check
Change-Id: I7bbdff40b23c3d28ae9483690d427f3c4639b651
Signed-off-by: Slawomir Ptak <slawomir.ptak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16877
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-02-23 13:36:01 +00:00
Jim Harris
0d11cf939b bdevperf: use rand_r() twice to get 64-bit values
rand_r() only returns up to RAND_MAX which is
INT32_MAX.  This means that on sufficiently large
bdevs, especially with smaller block sizes, bdevperf
may not be issuing I/O across the full range of the
bdev.

Found while investigating issue #2908.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I16db684a57a96f138e709008bded4471428944b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16768
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2023-02-14 09:04:20 +00:00
Shuhei Matsumoto
5647948681 bdevperf: Replace spdk_bdev_first/next_leaf() by spdk_for_each_bdev_leaf()
Replace all spdk_bdev_first/next_leaf() calls by spdk_for_each_bdev_leaf().

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I61e8302346a70b0dc219fff29b06158b542dd87f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16537
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-01-31 10:30:52 +00:00
Shuhei Matsumoto
9ef9d4bd23 bdevperf: Factor out creating multithread job config into helper function
The next patch will replace spdk_bdev_first/next_leaf() calls by
spdk_for_each_bdev(). As a preparation, factor out creating multithread
job config for a bdev into a helper function.

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: Ib4df53af8b1bba5b012e93ff9d00c4089cca774e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16536
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2023-01-31 10:30:52 +00:00
GangCao
60fd5c554d examples/bdevperf: check the successful status before dereferencing the pointer
Issue here is that the status could be negative due to NULL pointer and in the
callback, the status is not checked before dereferencing the pointer which is
NULL here.

Change-Id: I7240fa91d1a640556e1f27b8295921c7dd1fb57f
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16176
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 <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
2023-01-10 13:11:18 +00:00
GangCao
ed4b89aaab examples/bdevperf: reset the performance period for next run
In the case of running by below commands:

./examples/bdev/bdevperf/bdevperf.py perform_tests

This value needs to be reset in each run, otherwise, it shows
wrong IOPS in the periodical way with -S parameter.

Change-Id: Ib8de7611aa06675d4a16fc3aa130d99b508b7605
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15960
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2022-12-21 09:34:12 +00:00
Alexey Marchuk
e58885f949 bdevperf: Limit queue depth for verify job with big IO
By design verify payload, uses a bit array to find
an offset of IO request. The bit array's size is
calculated as bdev_num_blocks / (io_size/block_size),
if bdev is small, queue depth requested by the user
might be bigger than the bit array size and in that
case bdevperf won't find a free bit for IO request
offset.

To fix that issue, limit queue_depth of such bdevs
by "size_in_ios" value

Signed-off-by: Alexey Marchuk <alexeymar@nvidia.com>
Change-Id: I3117f5af7ae3ea18219c25982f33db936dd24c0b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15777
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
2022-12-14 08:02:55 +00:00
Alexey Marchuk
893aaacccb bdevperf: Check current_queue_depth when job starts draining
During debug of some issue, it was found that
current_queue_depth might be 0 when job timer expires,
in that case we won't trigger the job end flow and
bdevperf may hang.

Signed-off-by: Alexey Marchuk <alexeymar@nvidia.com>
Change-Id: Ia49ce6905d329f3ef40216c277bf095782ac9b2d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15776
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2022-12-14 08:02:55 +00:00
Michal Berger
483d34ad03 bdev/bdevperf: Fix spdk_bdev_channel_get_histogram() arguments
Don't pass bdev argument as it was completely removed from the
function via:

https://review.spdk.io/gerrit/c/spdk/spdk/+/15837

Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: Icbc1265a516e9fd21820b2f433ced4d4522b46b9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15893
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2022-12-13 11:51:25 +00:00
Richael Zhuang
045c781d47 bdevperf: use SPDK_SEC_TO_USEC for unit conversion
Use SPDK_SEC_TO_USEC instead of '1000 * 1000' or '1000000' for
unit conversion.

Change-Id: Ie9fb016b51ef3346ec640297941408f6c643b9b8
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15784
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-12-13 09:24:53 +00:00
Richael Zhuang
723dd06eb8 bdevperf: support latency info in bdevperf output
Get latency info from bdev histogram and print latency info in
bdevperf output.
print min/max/average latency info by default;
print summarized histogram info if run bdevperf with '-l';
print detailed histogram info if run bdevperf with '-ll'.

Change-Id: I3261574a12c038acde81a58727e9942c0f8c57b2
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14640
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-12-13 09:24:53 +00:00
GangCao
ef9168dcaa examples/bdevperf: fix potential memory leak of allocated config
Change-Id: Idd9d9bec5df0fbb74bb1f2a8af61c408a150d1aa
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15536
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2022-11-23 08:22:53 +00:00
Jim Harris
081b190b5f bdevperf: call spdk_thread_exit on job threads
Note: we can only exit a job thread after all
jobs are done executing.  This is because some bdevs
like Ceph send messages to a main thread, so we need
to make sure a main thread doesn't exit before another
thread that is sending messages to it.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaa51f13f3bc659f6eda7fcefff82c127e095ce29
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15516
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: wanghailiang <hailiangx.e.wang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2022-11-23 08:22:04 +00:00
Jim Harris
dcb296a32b bdevperf: add bdevperf_job_free() function
Introduce a helper function to properly free everything
associated with a job structure, and then use that
in all of the various error paths to reduce the
number of changes required if/when new strings are
added to the job structure.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I05280371326ce9582e8452a7753a7990072f25b7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15506
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2022-11-23 08:22:04 +00:00
Jim Harris
7aa2cc29c0 bdevperf: simplify freeing of 'outstanding' bit array
spdk_bit_array_free(NULL) is fine, so we can avoid the
check.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I989797d5dce0339efb18a7e47e8d974d4ac5abf7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15505
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2022-11-23 08:22:04 +00:00
Krzysztof Karas
29784f35cd bdevperf: promote bdevperf from test to example application
bdevperf application is utilized in multiple test scenarios
and most prominently in SPDK performance reports.
Similar to perf and fio_plugins, it is used to measure performance.
It is intended to represent the expected behavior of users
application that use SPDK bdev layer.

Applications under --enable-tests are intended for specific test
scenarios and user interaction is usually via a test scripts.
Meanwhile --enable-examples are used more broadly to teach and
show usage of SPDK libraries.

As an added benefit with this patch, its possible to compile
bdevperf without need to satisfy additional requirements to
compile all the test applications.

Change-Id: I9aaec1f9d729a1cdee89b5fdc365d61c19b03f82
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14558
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2022-11-16 09:52:41 +00:00