test/vhost: enable packed ring for BLK in performance tests

Enable Packed Ring option in performance tests. Only BLK
stack for now, as SCSI doesn't have this option yet.

Change-Id: Ie70642dd846ada35926e17204770ea2436089432
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2716
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Karol Latecki 2020-06-01 13:05:32 +02:00 committed by Tomasz Zawadzki
parent 2c7ba231d3
commit 262c35fc9a
2 changed files with 28 additions and 1 deletions

View File

@ -91,6 +91,13 @@ function notice() {
message "INFO" "$@" message "INFO" "$@"
} }
function check_qemu_packedring_support() {
qemu_version=$($QEMU_BIN -version | grep -Po "(?<=version )\d+.\d+.\d+")
if [[ "$qemu_version" < "4.2.0" ]]; then
error "This qemu binary does not support packed ring"
fi
}
function get_vhost_dir() { function get_vhost_dir() {
local vhost_name="$1" local vhost_name="$1"
@ -499,6 +506,7 @@ function vm_setup() {
local guest_memory=1024 local guest_memory=1024
local queue_number="" local queue_number=""
local vhost_dir local vhost_dir
local packed=false
vhost_dir="$(get_vhost_dir 0)" vhost_dir="$(get_vhost_dir 0)"
while getopts ':-:' optchar; do while getopts ':-:' optchar; do
case "$optchar" in case "$optchar" in
@ -518,6 +526,7 @@ function vm_setup() {
migrate-to=*) vm_migrate_to="${OPTARG#*=}" ;; migrate-to=*) vm_migrate_to="${OPTARG#*=}" ;;
vhost-name=*) vhost_dir="$(get_vhost_dir ${OPTARG#*=})" ;; vhost-name=*) vhost_dir="$(get_vhost_dir ${OPTARG#*=})" ;;
spdk-boot=*) local boot_from="${OPTARG#*=}" ;; spdk-boot=*) local boot_from="${OPTARG#*=}" ;;
packed) packed=true ;;
*) *)
error "unknown argument $OPTARG" error "unknown argument $OPTARG"
return 1 return 1
@ -722,6 +731,12 @@ function vm_setup() {
cmd[-1]+=,bootindex=0 cmd[-1]+=,bootindex=0
boot_disk_present=true boot_disk_present=true
fi fi
if $packed; then
check_qemu_packedring_support
notice "Enabling packed ring support for VM $vm_num, controller $vhost_dir/naa.$disk.$vm_num"
cmd[-1]+=,packed=on
fi
;; ;;
kernel_vhost) kernel_vhost)
if [[ -z $disk ]]; then if [[ -z $disk ]]; then

View File

@ -22,6 +22,7 @@ lvol_bdevs=()
split_bdevs=() split_bdevs=()
used_vms="" used_vms=""
wwpn_prefix="naa.5001405bc6498" wwpn_prefix="naa.5001405bc6498"
packed_ring=false
fio_iterations=1 fio_iterations=1
precond_fio_bin=$CONFIG_FIO_SOURCE_DIR/fio precond_fio_bin=$CONFIG_FIO_SOURCE_DIR/fio
@ -62,6 +63,7 @@ function usage() {
echo " spdk_vhost_blk - use spdk vhost block" echo " spdk_vhost_blk - use spdk vhost block"
echo " kernel_vhost - use kernel vhost scsi" echo " kernel_vhost - use kernel vhost scsi"
echo " Default: spdk_vhost_scsi" echo " Default: spdk_vhost_scsi"
echo " --packed-ring Use packed ring support. Requires Qemu 4.2.0 or greater. Default: disabled."
echo " --use-split Use split vbdevs instead of Logical Volumes" echo " --use-split Use split vbdevs instead of Logical Volumes"
echo " --limit-kernel-vhost=INT Limit kernel vhost to run only on a number of CPU cores." echo " --limit-kernel-vhost=INT Limit kernel vhost to run only on a number of CPU cores."
echo " --run-precondition Precondition lvols after creating. Default: true." echo " --run-precondition Precondition lvols after creating. Default: true."
@ -121,6 +123,11 @@ function create_vm() {
else else
setup_cmd+=" --disks=0" setup_cmd+=" --disks=0"
fi fi
if $packed_ring; then
setup_cmd+=" --packed"
fi
$setup_cmd $setup_cmd
used_vms+=" $vm_num" used_vms+=" $vm_num"
echo "Added to used vms" echo "Added to used vms"
@ -137,7 +144,11 @@ function create_spdk_controller() {
$rpc_py vhost_scsi_controller_add_target naa.0.$vm_num 0 $bdev $rpc_py vhost_scsi_controller_add_target naa.0.$vm_num 0 $bdev
notice "Added LUN 0/$bdev to controller naa.0.$vm_num" notice "Added LUN 0/$bdev to controller naa.0.$vm_num"
elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then
$rpc_py vhost_create_blk_controller naa.0.$vm_num $bdev if $packed_ring; then
p_opt="-p"
fi
$rpc_py vhost_create_blk_controller naa.0.$vm_num $bdev $p_opt
notice "Created vhost blk controller naa.0.$vm_num $bdev" notice "Created vhost blk controller naa.0.$vm_num $bdev"
fi fi
} }
@ -159,6 +170,7 @@ while getopts 'xh-:' optchar; do
sar-count=*) sar_count="${OPTARG#*=}" ;; sar-count=*) sar_count="${OPTARG#*=}" ;;
vm-throttle-iops=*) vm_throttle="${OPTARG#*=}" ;; vm-throttle-iops=*) vm_throttle="${OPTARG#*=}" ;;
ctrl-type=*) ctrl_type="${OPTARG#*=}" ;; ctrl-type=*) ctrl_type="${OPTARG#*=}" ;;
packed-ring) packed_ring=true ;;
use-split) use_split=true ;; use-split) use_split=true ;;
run-precondition) run_precondition=true ;; run-precondition) run_precondition=true ;;
precond-fio-bin=*) precond_fio_bin="${OPTARG#*=}" ;; precond-fio-bin=*) precond_fio_bin="${OPTARG#*=}" ;;