bdev/malloc: report accel sequence support
This actually allows malloc bdev to chain multiple accel operations together. And, since the last operation will always be a copy, accel should remove that copy by modifying previous operation's dst/src. On my system, it improved bdevperf performance (single core, qd=4, bs=128k, bdev_crypto on top of bdev_malloc, crypto_sw): randread: 5668M/s -> 8201M/s randwrite: 5148M/s -> 7856M/s Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: I5b9173fa70a42ee56f56c496a34037d46d2f420f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17202 Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
9276019077
commit
97ce07c261
@ -534,13 +534,32 @@ bdev_malloc_get_memory_domains(void *ctx, struct spdk_memory_domain **domains, i
|
||||
return num_domains;
|
||||
}
|
||||
|
||||
static bool
|
||||
bdev_malloc_accel_sequence_supported(void *ctx, enum spdk_bdev_io_type type)
|
||||
{
|
||||
struct malloc_disk *malloc_disk = ctx;
|
||||
|
||||
if (malloc_disk->disk.dif_type != SPDK_DIF_DISABLE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case SPDK_BDEV_IO_TYPE_READ:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct spdk_bdev_fn_table malloc_fn_table = {
|
||||
.destruct = bdev_malloc_destruct,
|
||||
.submit_request = bdev_malloc_submit_request,
|
||||
.io_type_supported = bdev_malloc_io_type_supported,
|
||||
.get_io_channel = bdev_malloc_get_io_channel,
|
||||
.write_config_json = bdev_malloc_write_json_config,
|
||||
.get_memory_domains = bdev_malloc_get_memory_domains,
|
||||
.destruct = bdev_malloc_destruct,
|
||||
.submit_request = bdev_malloc_submit_request,
|
||||
.io_type_supported = bdev_malloc_io_type_supported,
|
||||
.get_io_channel = bdev_malloc_get_io_channel,
|
||||
.write_config_json = bdev_malloc_write_json_config,
|
||||
.get_memory_domains = bdev_malloc_get_memory_domains,
|
||||
.accel_sequence_supported = bdev_malloc_accel_sequence_supported,
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -79,38 +79,39 @@ update_stats
|
||||
# Write a single 64K request and check the stats
|
||||
dd if=/dev/urandom of="$input" bs=1K count=64
|
||||
spdk_dd --if "$input" --ob Nvme0n1 --bs $((64 * 1024)) --count 1
|
||||
(($(get_stat sequence_executed) == stats[sequence_executed] + 2))
|
||||
(($(get_stat sequence_executed) == stats[sequence_executed] + 1))
|
||||
(($(get_stat executed encrypt) == stats[encrypt_executed] + 2))
|
||||
(($(get_stat executed decrypt) == stats[decrypt_executed]))
|
||||
# There's still one copy performed by the malloc bdev
|
||||
(($(get_stat executed copy) == stats[copy_executed] + 1))
|
||||
# No copies should be done - the copy from the malloc should translate to changing encrypt's
|
||||
# destination buffer
|
||||
(($(get_stat executed copy) == stats[copy_executed]))
|
||||
update_stats
|
||||
|
||||
# Now read that 64K, verify the stats and check that it matches what was written
|
||||
spdk_dd --of "$output" --ib Nvme0n1 --bs $((64 * 1024)) --count 1
|
||||
(($(get_stat sequence_executed) == stats[sequence_executed] + 2))
|
||||
(($(get_stat sequence_executed) == stats[sequence_executed] + 1))
|
||||
(($(get_stat executed encrypt) == stats[encrypt_executed]))
|
||||
(($(get_stat executed decrypt) == stats[decrypt_executed] + 2))
|
||||
(($(get_stat executed copy) == stats[copy_executed] + 1))
|
||||
(($(get_stat executed copy) == stats[copy_executed]))
|
||||
cmp "$input" "$output"
|
||||
spdk_dd --if /dev/zero --ob Nvme0n1 --bs $((64 * 1024)) --count 1
|
||||
update_stats
|
||||
|
||||
# Now do the same using 4K requests
|
||||
spdk_dd --if "$input" --ob Nvme0n1 --bs 4096 --count 16
|
||||
(($(get_stat sequence_executed) == stats[sequence_executed] + 32))
|
||||
(($(get_stat sequence_executed) == stats[sequence_executed] + 16))
|
||||
(($(get_stat executed encrypt) == stats[encrypt_executed] + 32))
|
||||
(($(get_stat executed decrypt) == stats[decrypt_executed]))
|
||||
(($(get_stat executed copy) == stats[copy_executed] + 16))
|
||||
(($(get_stat executed copy) == stats[copy_executed]))
|
||||
update_stats
|
||||
|
||||
# Check the reads
|
||||
: > "$output"
|
||||
spdk_dd --of "$output" --ib Nvme0n1 --bs 4096 --count 16
|
||||
(($(get_stat sequence_executed) == stats[sequence_executed] + 32))
|
||||
(($(get_stat sequence_executed) == stats[sequence_executed] + 16))
|
||||
(($(get_stat executed encrypt) == stats[encrypt_executed]))
|
||||
(($(get_stat executed decrypt) == stats[decrypt_executed] + 32))
|
||||
(($(get_stat executed copy) == stats[copy_executed] + 16))
|
||||
(($(get_stat executed copy) == stats[copy_executed]))
|
||||
cmp "$input" "$output"
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
|
Loading…
Reference in New Issue
Block a user