runtime: Allow to specify properties for accelerator
PATCH v3 1/1 runtime: Allow to specify properties for accelerator
There are extra properties for accelerators to enable the specific features. For example, the dirty ring for KVM accelerator can be enabled by "-accel kvm,dirty-ring-sizee536". Unfortuntely, the extra properties for the accelerators aren't supported. It makes it's impossible to test the combination of KVM and dirty ring as the following error message indicates.
# cd /home/gavin/sandbox/kvm-unit-tests/tests
# QEMU=/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \
ACCEL=kvm,dirty-ring-sizee536 ./its-migration
:
BUILD_HEAD/ffb37e
timeout -k 1s --foreground 90s /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \
-nodefaults -machine virt -accel kvm,dirty-ring-sizee536 -cpu cortex-a57 \
-device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd \
-device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 160 \
-machine gic-version=3 -append its-pending-migration # -initrd /tmp/tmp.gfDLa1EtWk
qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argumentAllow to specify extra properties for accelerators. With this, the "its-migration" can be tested for the combination of KVM and dirty ring.
---
v3: Split $ACCEL to $ACCEL and $ACCEL_PROPS in get_qemu_accelerator()
and don't print them as output, suggested by Drew.
--- arm/run | 12 ++++-------- powerpc/run | 5 ++--- s390x/run | 5 ++--- scripts/arch-run.bash | 21 +++++++++++++-------- x86/run | 5 ++--- 5 files changed, 23 insertions(+), 25 deletions(-)
arm/run +4 -8
@@ -10,10 +10,8 @@ if [ -z "$KUT_STANDALONE" ]; then fi processor="$PROCESSOR" -accel=$(get_qemu_accelerator) || - exit $? - -if [ "$accel" = "kvm" ]; then +get_qemu_accelerator || exit $? +if [ "$ACCEL" = "kvm" ]; then QEMU_ARCH=$HOST fi
@@ -23,11 +21,9 @@ qemu=$(search_qemu_binary) || if [ "$QEMU" ] && [ -z "$ACCEL" ] && [ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] && [ "$(basename $QEMU)" = "qemu-system-arm" ]; then - accel=tcg + ACCEL="tcg" fi -ACCEL=$accel - if ! $qemu -machine '?' | grep -q 'ARM Virtual Machine'; then echo "$qemu doesn't support mach-virt ('-machine virt'). Exiting." exit 2
@@ -72,7 +68,7 @@ if $qemu $M -device '?' | grep -q pci-testdev; then pci_testdev="-device pci-testdev" fi -A="-accel $ACCEL" +A="-accel $ACCEL$ACCEL_PROPS" command="$qemu -nodefaults $M $A -cpu $processor $chr_testdev $pci_testdev" command+=" -display none -serial stdio -kernel" command="$(migration_cmd) $(timeout_cmd) $command"
powerpc/run +2 -3
@@ -9,8 +9,7 @@ if [ -z "$KUT_STANDALONE" ]; then source scripts/arch-run.bash fi -ACCEL=$(get_qemu_accelerator) || - exit $? +get_qemu_accelerator || exit $? qemu=$(search_qemu_binary) || exit $?
@@ -21,7 +20,7 @@ if ! $qemu -machine '?' 2>&1 | grep 'pseries' > /dev/null; then fi M='-machine pseries' -M+=",accel=$ACCEL" +M+=",accel=$ACCEL$ACCEL_PROPS" command="$qemu -nodefaults $M -bios $FIRMWARE" command+=" -display none -serial stdio -kernel" command="$(migration_cmd) $(timeout_cmd) $command"
s390x/run +2 -3
@@ -9,8 +9,7 @@ if [ -z "$KUT_STANDALONE" ]; then source scripts/arch-run.bash fi -ACCEL=$(get_qemu_accelerator) || - exit $? +get_qemu_accelerator || exit $? qemu=$(search_qemu_binary) || exit $?
@@ -26,7 +25,7 @@ if [ "${1: -7}" = ".pv.bin" ] || [ "${TESTNAME: -3}" = "_PV" ] && [ "$MIGRATION" fi M='-machine s390-ccw-virtio' -M+=",accel=$ACCEL" +M+=",accel=$ACCEL$ACCEL_PROPS" command="$qemu -nodefaults -nographic $M" command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0" command+=" -kernel"
scripts/arch-run.bash +13 -8
@@ -412,6 +412,9 @@ hvf_available () get_qemu_accelerator () { + ACCEL_PROPS=${ACCEL#"${ACCEL%%,*}"} + ACCEL=${ACCEL%%,*} + if [ "$ACCEL" = "kvm" ] && ! kvm_available; then echo "KVM is needed, but not available on this host" >&2 return 2
@@ -421,13 +424,15 @@ get_qemu_accelerator () return 2 fi - if [ "$ACCEL" ]; then - echo $ACCEL - elif kvm_available; then - echo kvm - elif hvf_available; then - echo hvf - else - echo tcg + if [ -z "$ACCEL" ]; then + if kvm_available; then + ACCEL="kvm" + elif hvf_available; then + ACCEL="hvf" + else + ACCEL="tcg" + fi fi + + return 0 }
x86/run +2 -3
@@ -9,8 +9,7 @@ if [ -z "$KUT_STANDALONE" ]; then source scripts/arch-run.bash fi -ACCEL=$(get_qemu_accelerator) || - exit $? +get_qemu_accelerator || exit $? qemu=$(search_qemu_binary) || exit $?
@@ -38,7 +37,7 @@ else fi command="${qemu} --no-reboot -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev" -command+=" -machine accel=$ACCEL" +command+=" -machine accel=$ACCEL$ACCEL_PROPS" if [ "${CONFIG_EFI}" != y ]; then command+=" -kernel" fi
Signature · 1 line
2.40.1
Quoting Gavin Shan (2023-06-15 08:21:48)
Quoted 19 lines
There are extra properties for accelerators to enable the specific features. For example, the dirty ring for KVM accelerator can be enabled by "-accel kvm,dirty-ring-size=65536". Unfortuntely, the extra properties for the accelerators aren't supported. It makes it's impossible to test the combination of KVM and dirty ring as the following error message indicates.
# cd /home/gavin/sandbox/kvm-unit-tests/tests # QEMU=/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ ACCEL=kvm,dirty-ring-size=65536 ./its-migration : BUILD_HEAD=2fffb37e timeout -k 1s --foreground 90s /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ -nodefaults -machine virt -accel kvm,dirty-ring-size=65536 -cpu cortex-a57 \ -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd \ -device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 160 \ -machine gic-version=3 -append its-pending-migration # -initrd /tmp/tmp.gfDLa1EtWk qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argument
Quoted 5 lines
Allow to specify extra properties for accelerators. With this, the "its-migration" can be tested for the combination of KVM and dirty ring.
Signed-off-by Gavin Shan <[email protected]>
Maybe get_qemu_accelerator could be renamed now, since it doesn't actually "get" anything, so maybe check_qemu_accelerator?
In any case, I gave it a quick run on s390x with kvm and tcg and nothing seems to break, hence for the changes in s390x:
Hi Nico,
Quoted 26 lines · Nico Boehr
Quoting Gavin Shan (2023-06-15 08:21:48)
Quoted 19 lines
There are extra properties for accelerators to enable the specific features. For example, the dirty ring for KVM accelerator can be enabled by "-accel kvm,dirty-ring-sizee536". Unfortuntely, the extra properties for the accelerators aren't supported. It makes it's impossible to test the combination of KVM and dirty ring as the following error message indicates.
# cd /home/gavin/sandbox/kvm-unit-tests/tests # QEMU=/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ ACCEL=kvm,dirty-ring-sizee536 ./its-migration : BUILD_HEAD/ffb37e timeout -k 1s --foreground 90s /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ -nodefaults -machine virt -accel kvm,dirty-ring-sizee536 -cpu cortex-a57 \ -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd \ -device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 160 \ -machine gic-version=3 -append its-pending-migration # -initrd /tmp/tmp.gfDLa1EtWk qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argumentQuoted 5 lines
Allow to specify extra properties for accelerators. With this, the "its-migration" can be tested for the combination of KVM and dirty ring.
Signed-off-by Gavin Shan <[email protected]>
Quoted 9 lines
Maybe
get_qemu_acceleratorcould be renamed now, since it doesn't actually "get" anything, so maybecheck_qemu_accelerator?In any case, I gave it a quick run on s390x with kvm and tcg and nothing seems to break, hence for the changes in s390x:
Tested-by Nico Boehr <[email protected]>Acked-by Nico Boehr <[email protected]>
Thanks for a quick try and comment for this. I guess it's fine to keep the function name as get_qemu_accelator() because $ACCEL is split into $ACCEL and $ACCEL_PROPS inside it, even it don't print the accelerator name at return. However, I'm also fine with check_qemu_accelerator(). Lets see what's Drew's comment on this and I can post v4 to have the modified function name, or an followup patch to modify the function name.
Thanks,
Gavin
Quoted 39 lines · Gavin Shan
Hi Nico,
Quoted 26 lines · Nico Boehr
Quoting Gavin Shan (2023-06-15 08:21:48)
Quoted 19 lines
There are extra properties for accelerators to enable the specific features. For example, the dirty ring for KVM accelerator can be enabled by "-accel kvm,dirty-ring-sizee536". Unfortuntely, the extra properties for the accelerators aren't supported. It makes it's impossible to test the combination of KVM and dirty ring as the following error message indicates.
# cd /home/gavin/sandbox/kvm-unit-tests/tests # QEMU=/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ ACCEL=kvm,dirty-ring-sizee536 ./its-migration : BUILD_HEAD/ffb37e timeout -k 1s --foreground 90s /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ -nodefaults -machine virt -accel kvm,dirty-ring-sizee536 -cpu cortex-a57 \ -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd \ -device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 160 \ -machine gic-version=3 -append its-pending-migration # -initrd /tmp/tmp.gfDLa1EtWk qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argumentQuoted 5 lines
Allow to specify extra properties for accelerators. With this, the "its-migration" can be tested for the combination of KVM and dirty ring.
Signed-off-by Gavin Shan <[email protected]>Quoted 9 lines
Maybe
get_qemu_acceleratorcould be renamed now, since it doesn't actually "get" anything, so maybecheck_qemu_accelerator?In any case, I gave it a quick run on s390x with kvm and tcg and nothing seems to break, hence for the changes in s390x:
Tested-by Nico Boehr <[email protected]>Acked-by Nico Boehr <[email protected]>
Quoted 6 lines
Thanks for a quick try and comment for this. I guess it's fine to keep the function name as
get_qemu_accelator()because $ACCEL is split into $ACCEL and $ACCEL_PROPS inside it, even it don't print the accelerator name at return. However, I'm also fine withcheck_qemu_accelerator(). Lets see what's Drew's comment on this and I can post v4 to have the modified function name, or an followup patch to modify the function name.
I suggested naming it set_qemu_accelerator() in the v2 review.
Thanks,
drew
Hi Drew,
Quoted 39 lines · Andrew Jones
Quoted 38 lines · Gavin Shan
Quoted 35 lines · Nico Boehr
Quoting Gavin Shan (2023-06-15 08:21:48)
Quoted 19 lines
There are extra properties for accelerators to enable the specific features. For example, the dirty ring for KVM accelerator can be enabled by "-accel kvm,dirty-ring-sizee536". Unfortuntely, the extra properties for the accelerators aren't supported. It makes it's impossible to test the combination of KVM and dirty ring as the following error message indicates.
# cd /home/gavin/sandbox/kvm-unit-tests/tests # QEMU=/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ ACCEL=kvm,dirty-ring-sizee536 ./its-migration : BUILD_HEAD/ffb37e timeout -k 1s --foreground 90s /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ -nodefaults -machine virt -accel kvm,dirty-ring-sizee536 -cpu cortex-a57 \ -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd \ -device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 160 \ -machine gic-version=3 -append its-pending-migration # -initrd /tmp/tmp.gfDLa1EtWk qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argumentQuoted 5 lines
Allow to specify extra properties for accelerators. With this, the "its-migration" can be tested for the combination of KVM and dirty ring.
Signed-off-by Gavin Shan <[email protected]>Maybe
get_qemu_acceleratorcould be renamed now, since it doesn't actually "get" anything, so maybecheck_qemu_accelerator?In any case, I gave it a quick run on s390x with kvm and tcg and nothing seems to break, hence for the changes in s390x:
Tested-by Nico Boehr <[email protected]>Acked-by Nico Boehr <[email protected]>
Quoted 9 lines
Quoted 6 lines
Thanks for a quick try and comment for this. I guess it's fine to keep the function name as
get_qemu_accelator()because $ACCEL is split into $ACCEL and $ACCEL_PROPS inside it, even it don't print the accelerator name at return. However, I'm also fine withcheck_qemu_accelerator(). Lets see what's Drew's comment on this and I can post v4 to have the modified function name, or an followup patch to modify the function name.I suggested naming it
set_qemu_accelerator()in the v2 review.
My bad, it will be renamed to set_qemu_accelerator() in v4 :)
Thanks,
Gavin
Quoted 53 lines · Gavin Shan
There are extra properties for accelerators to enable the specific features. For example, the dirty ring for KVM accelerator can be enabled by "-accel kvm,dirty-ring-sizee536". Unfortuntely, the extra properties for the accelerators aren't supported. It makes it's impossible to test the combination of KVM and dirty ring as the following error message indicates.
# cd /home/gavin/sandbox/kvm-unit-tests/tests # QEMU=/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ ACCEL=kvm,dirty-ring-sizee536 ./its-migration : BUILD_HEAD/ffb37e timeout -k 1s --foreground 90s /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ -nodefaults -machine virt -accel kvm,dirty-ring-sizee536 -cpu cortex-a57 \ -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd \ -device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 160 \ -machine gic-version=3 -append its-pending-migration # -initrd /tmp/tmp.gfDLa1EtWk qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argumentAllow to specify extra properties for accelerators. With this, the "its-migration" can be tested for the combination of KVM and dirty ring.
Signed-off-by Gavin Shan <[email protected]>---
v3: Split $ACCEL to $ACCEL and $ACCEL_PROPS inget_qemu_accelerator()
and don't print them as output, suggested by Drew.--- arm/run | 12 ++++-------- powerpc/run | 5 ++--- s390x/run | 5 ++--- scripts/arch-run.bash | 21 +++++++++++++-------- x86/run | 5 ++--- 5 files changed, 23 insertions(+), 25 deletions(-)arm/run +2
-4@@ -10,10 +10,8 @@ if [ -z "$KUT_STANDALONE" ]; then fi processor="$PROCESSOR" -accel=$(get_qemu_accelerator) || - exit $? - -if [ "$accel" = "kvm" ]; then +get_qemu_accelerator || exit $? +if [ "$ACCEL" = "kvm" ]; then QEMU_ARCH=$HOST fi
arm/run qemu=$(search_qemu_binary) || · line 26
Quoted 7 lines
arm/run +1
-1@@ -23,11 +21,9 @@ qemu=$(search_qemu_binary) || if [ "$QEMU" ] && [ -z "$ACCEL" ] && [ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] && [ "$(basename $QEMU)" = "qemu-system-arm" ]; then - accel=tcg + ACCEL="tcg" fi
As I pointed out in the v2 review we can't just s/accel/ACCEL/ without other changes. Now ACCEL will also be set when the above condition is checked, making it useless. Please ensure the test case that commit c7d6c7f00e7c ("arm/run: Use TCG with qemu-system-arm on arm64 systems") fixed still works with your patch.
Thanks,
drew
Hi Drew,
Quoted 53 lines · Andrew Jones
Quoted 52 lines · Gavin Shan
There are extra properties for accelerators to enable the specific features. For example, the dirty ring for KVM accelerator can be enabled by "-accel kvm,dirty-ring-sizee536". Unfortuntely, the extra properties for the accelerators aren't supported. It makes it's impossible to test the combination of KVM and dirty ring as the following error message indicates.
# cd /home/gavin/sandbox/kvm-unit-tests/tests # QEMU=/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ ACCEL=kvm,dirty-ring-sizee536 ./its-migration : BUILD_HEAD/ffb37e timeout -k 1s --foreground 90s /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ -nodefaults -machine virt -accel kvm,dirty-ring-sizee536 -cpu cortex-a57 \ -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd \ -device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 160 \ -machine gic-version=3 -append its-pending-migration # -initrd /tmp/tmp.gfDLa1EtWk qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argumentAllow to specify extra properties for accelerators. With this, the "its-migration" can be tested for the combination of KVM and dirty ring.
Signed-off-by Gavin Shan <[email protected]>---
v3: Split $ACCEL to $ACCEL and $ACCEL_PROPS inget_qemu_accelerator()
and don't print them as output, suggested by Drew.--- arm/run | 12 ++++-------- powerpc/run | 5 ++--- s390x/run | 5 ++--- scripts/arch-run.bash | 21 +++++++++++++-------- x86/run | 5 ++--- 5 files changed, 23 insertions(+), 25 deletions(-)arm/run +2
-4@@ -10,10 +10,8 @@ if [ -z "$KUT_STANDALONE" ]; then fi processor="$PROCESSOR" -accel=$(get_qemu_accelerator) || - exit $? - -if [ "$accel" = "kvm" ]; then +get_qemu_accelerator || exit $? +if [ "$ACCEL" = "kvm" ]; then QEMU_ARCH=$HOST fi
Quoted 15 lines
arm/run qemu=$(search_qemu_binary) || · line 26
Quoted 8 lines
arm/run +1
-1@@ -23,11 +21,9 @@ qemu=$(search_qemu_binary) || if [ "$QEMU" ] && [ -z "$ACCEL" ] && [ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] && [ "$(basename $QEMU)" = "qemu-system-arm" ]; then - accel=tcg + ACCEL="tcg" fiAs I pointed out in the v2 review we can't just s/accel/ACCEL/ without other changes. Now ACCEL will also be set when the above condition is checked, making it useless. Please ensure the test case that commit
c7d6c7f00e7c("arm/run: Use TCG with qemu-system-arm on arm64 systems") fixed still works with your patch.
Sorry that I missed your comments for v2. In order to make the test case in c7d6c7f00e7c working, we just need to call set_qemu_accelerator() after the chunk of code, like below. When $ACCEL is set to "tcg" by the conditional code, it won't be changed in the following set_qemu_accelerator().
Could you Please confirm if it looks good to you so that I can integrate the changes to v4 and post it.
arm/run
--------
processor="$PROCESSOR"
if [ "$QEMU" ] && [ -z "$ACCEL" ] &&
[ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] &&
[ "$(basename $QEMU)" = "qemu-system-arm" ]; then
ACCEL="tcg"fi
set_qemu_accelerator || exit $?
if [ "$ACCEL" = "kvm" ]; then
QEMU_ARCH=$HOST
fi
Thanks,
Gavin
Quoted 85 lines · Gavin Shan
Hi Drew,
Quoted 56 lines · Andrew Jones
Quoted 55 lines · Gavin Shan
There are extra properties for accelerators to enable the specific features. For example, the dirty ring for KVM accelerator can be enabled by "-accel kvm,dirty-ring-sizee536". Unfortuntely, the extra properties for the accelerators aren't supported. It makes it's impossible to test the combination of KVM and dirty ring as the following error message indicates.
# cd /home/gavin/sandbox/kvm-unit-tests/tests # QEMU=/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ ACCEL=kvm,dirty-ring-sizee536 ./its-migration : BUILD_HEAD/ffb37e timeout -k 1s --foreground 90s /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ -nodefaults -machine virt -accel kvm,dirty-ring-sizee536 -cpu cortex-a57 \ -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd \ -device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 160 \ -machine gic-version=3 -append its-pending-migration # -initrd /tmp/tmp.gfDLa1EtWk qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argumentAllow to specify extra properties for accelerators. With this, the "its-migration" can be tested for the combination of KVM and dirty ring.
Signed-off-by Gavin Shan <[email protected]>---
v3: Split $ACCEL to $ACCEL and $ACCEL_PROPS inget_qemu_accelerator()
and don't print them as output, suggested by Drew.--- arm/run | 12 ++++-------- powerpc/run | 5 ++--- s390x/run | 5 ++--- scripts/arch-run.bash | 21 +++++++++++++-------- x86/run | 5 ++--- 5 files changed, 23 insertions(+), 25 deletions(-)arm/run +2
-5@@ -10,10 +10,8 @@ if [ -z "$KUT_STANDALONE" ]; then fi processor="$PROCESSOR" -accel=$(get_qemu_accelerator) || - exit $? - -if [ "$accel" = "kvm" ]; then +get_qemu_accelerator || exit $? +if [ "$ACCEL" = "kvm" ]; then QEMU_ARCH=$HOST fi@@ -23,11 +21,9 @@ qemu=$(search_qemu_binary) || if [ "$QEMU" ] && [ -z "$ACCEL" ] && [ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] && [ "$(basename $QEMU)" = "qemu-system-arm" ]; then - accel=tcgQuoted 9 lines
arm/run qemu=$(search_qemu_binary) || · line 25
Quoted 2 lines
arm/run +1
-0+ ACCEL="tcg" fiAs I pointed out in the v2 review we can't just s/accel/ACCEL/ without other changes. Now ACCEL will also be set when the above condition is checked, making it useless. Please ensure the test case that commit
c7d6c7f00e7c("arm/run: Use TCG with qemu-system-arm on arm64 systems") fixed still works with your patch.Sorry that I missed your comments for v2. In order to make the test case in
c7d6c7f00e7cworking, we just need to callset_qemu_accelerator()after the chunk of code, like below. When $ACCEL is set to "tcg" by the conditional code, it won't be changed in the followingset_qemu_accelerator().Could you Please confirm if it looks good to you so that I can integrate the changes to v4 and post it.
arm/run
--------processor="$PROCESSOR"
if [ "$QEMU" ] && [ -z "$ACCEL" ] &&
[ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] && [ "$(basename $QEMU)" = "qemu-system-arm" ]; then
Quoted 8 lines
ACCEL="tcg"fi
set_qemu_accelerator|| exit $?
if [ "$ACCEL" = "kvm" ]; then
QEMU_ARCH=$HOST
fi
Looks fine, but please give it a test run.
Thanks,
drew
Hi Drew,
Quoted 87 lines · Andrew Jones
Quoted 86 lines · Gavin Shan
Quoted 56 lines · Andrew Jones
Quoted 55 lines · Gavin Shan
There are extra properties for accelerators to enable the specific features. For example, the dirty ring for KVM accelerator can be enabled by "-accel kvm,dirty-ring-sizee536". Unfortuntely, the extra properties for the accelerators aren't supported. It makes it's impossible to test the combination of KVM and dirty ring as the following error message indicates.
# cd /home/gavin/sandbox/kvm-unit-tests/tests # QEMU=/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ ACCEL=kvm,dirty-ring-sizee536 ./its-migration : BUILD_HEAD/ffb37e timeout -k 1s --foreground 90s /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ -nodefaults -machine virt -accel kvm,dirty-ring-sizee536 -cpu cortex-a57 \ -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd \ -device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 160 \ -machine gic-version=3 -append its-pending-migration # -initrd /tmp/tmp.gfDLa1EtWk qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argumentAllow to specify extra properties for accelerators. With this, the "its-migration" can be tested for the combination of KVM and dirty ring.
Signed-off-by Gavin Shan <[email protected]>---
v3: Split $ACCEL to $ACCEL and $ACCEL_PROPS inget_qemu_accelerator()
and don't print them as output, suggested by Drew.--- arm/run | 12 ++++-------- powerpc/run | 5 ++--- s390x/run | 5 ++--- scripts/arch-run.bash | 21 +++++++++++++-------- x86/run | 5 ++--- 5 files changed, 23 insertions(+), 25 deletions(-)arm/run +2
-5@@ -10,10 +10,8 @@ if [ -z "$KUT_STANDALONE" ]; then fi processor="$PROCESSOR" -accel=$(get_qemu_accelerator) || - exit $? - -if [ "$accel" = "kvm" ]; then +get_qemu_accelerator || exit $? +if [ "$ACCEL" = "kvm" ]; then QEMU_ARCH=$HOST fi@@ -23,11 +21,9 @@ qemu=$(search_qemu_binary) || if [ "$QEMU" ] && [ -z "$ACCEL" ] && [ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] && [ "$(basename $QEMU)" = "qemu-system-arm" ]; then - accel=tcgQuoted 9 lines
arm/run qemu=$(search_qemu_binary) || · line 25
Quoted 2 lines
arm/run +1
-0+ ACCEL="tcg" fiAs I pointed out in the v2 review we can't just s/accel/ACCEL/ without other changes. Now ACCEL will also be set when the above condition is checked, making it useless. Please ensure the test case that commit
c7d6c7f00e7c("arm/run: Use TCG with qemu-system-arm on arm64 systems") fixed still works with your patch.Sorry that I missed your comments for v2. In order to make the test case in
c7d6c7f00e7cworking, we just need to callset_qemu_accelerator()after the chunk of code, like below. When $ACCEL is set to "tcg" by the conditional code, it won't be changed in the followingset_qemu_accelerator().Could you Please confirm if it looks good to you so that I can integrate the changes to v4 and post it.
arm/run
--------processor="$PROCESSOR"
if [ "$QEMU" ] && [ -z "$ACCEL" ] &&
[ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] && [ "$(basename $QEMU)" = "qemu-system-arm" ]; then ACCEL="tcg"fi
Quoted 8 lines
Quoted 5 lines
set_qemu_accelerator|| exit $?
if [ "$ACCEL" = "kvm" ]; then
QEMU_ARCH=$HOST
fiLooks fine, but please give it a test run.
Thanks, Drew. v4 has been posted for further review. Since I don't have a 'arm' host around, I adjust $ARCH to "arm64" for a simulation and the test case included in commit c7d6c7f00e7c should be working fine: We eventually have "tcg" instead of "kvm" accelerator for the combination, which is expected by commit c7d6c7f00e7c
v4: https://lore.kernel.org/kvmarm/[email protected]/T/#u
Thanks,
Gavin
Quoted 96 lines · Gavin Shan
Hi Drew,
Quoted 93 lines · Andrew Jones
Quoted 91 lines · Gavin Shan
Quoted 56 lines · Andrew Jones
Quoted 55 lines · Gavin Shan
There are extra properties for accelerators to enable the specific features. For example, the dirty ring for KVM accelerator can be enabled by "-accel kvm,dirty-ring-sizee536". Unfortuntely, the extra properties for the accelerators aren't supported. It makes it's impossible to test the combination of KVM and dirty ring as the following error message indicates.
# cd /home/gavin/sandbox/kvm-unit-tests/tests # QEMU=/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ ACCEL=kvm,dirty-ring-sizee536 ./its-migration : BUILD_HEAD/ffb37e timeout -k 1s --foreground 90s /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ -nodefaults -machine virt -accel kvm,dirty-ring-sizee536 -cpu cortex-a57 \ -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd \ -device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 160 \ -machine gic-version=3 -append its-pending-migration # -initrd /tmp/tmp.gfDLa1EtWk qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argumentAllow to specify extra properties for accelerators. With this, the "its-migration" can be tested for the combination of KVM and dirty ring.
Signed-off-by Gavin Shan <[email protected]>---
v3: Split $ACCEL to $ACCEL and $ACCEL_PROPS inget_qemu_accelerator()
and don't print them as output, suggested by Drew.--- arm/run | 12 ++++-------- powerpc/run | 5 ++--- s390x/run | 5 ++--- scripts/arch-run.bash | 21 +++++++++++++-------- x86/run | 5 ++--- 5 files changed, 23 insertions(+), 25 deletions(-)arm/run +2
-5@@ -10,10 +10,8 @@ if [ -z "$KUT_STANDALONE" ]; then fi processor="$PROCESSOR" -accel=$(get_qemu_accelerator) || - exit $? - -if [ "$accel" = "kvm" ]; then +get_qemu_accelerator || exit $? +if [ "$ACCEL" = "kvm" ]; then QEMU_ARCH=$HOST fi@@ -23,11 +21,9 @@ qemu=$(search_qemu_binary) || if [ "$QEMU" ] && [ -z "$ACCEL" ] && [ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] && [ "$(basename $QEMU)" = "qemu-system-arm" ]; then - accel=tcgQuoted 9 lines
arm/run qemu=$(search_qemu_binary) || · line 25
Quoted 2 lines
arm/run +1
-0+ ACCEL="tcg" fiAs I pointed out in the v2 review we can't just s/accel/ACCEL/ without other changes. Now ACCEL will also be set when the above condition is checked, making it useless. Please ensure the test case that commit
c7d6c7f00e7c("arm/run: Use TCG with qemu-system-arm on arm64 systems") fixed still works with your patch.Sorry that I missed your comments for v2. In order to make the test case in
c7d6c7f00e7cworking, we just need to callset_qemu_accelerator()after the chunk of code, like below. When $ACCEL is set to "tcg" by the conditional code, it won't be changed in the followingset_qemu_accelerator().Could you Please confirm if it looks good to you so that I can integrate the changes to v4 and post it.
arm/run
--------processor="$PROCESSOR"
if [ "$QEMU" ] && [ -z "$ACCEL" ] &&
[ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] && [ "$(basename $QEMU)" = "qemu-system-arm" ]; then ACCEL="tcg"fi
set_qemu_accelerator|| exit $?
if [ "$ACCEL" = "kvm" ]; then
QEMU_ARCH=$HOST
fi
Quoted 7 lines
Quoted 2 lines
Looks fine, but please give it a test run.
Thanks, Drew. v4 has been posted for further review. Since I don't have a 'arm' host around, I adjust $ARCH to "arm64" for a simulation and the test case included in commit
c7d6c7f00e7cshould be working fine: We eventually have "tcg" instead of "kvm" accelerator for the combination, which is expected by commitc7d6c7f00e7c
You don't need an arm host. Indeed $HOST should be aarch64 for this case. You just need to compile the tests for arm instead of aarch64. That's easy to do with a cross compiler
./configure --arch=arm --cross-prefix=arm-linux-gnu-
But hacking the condition is fine too for this simple case.
Thanks,
drew
Quoted 6 lines
v4: https://lore.kernel.org/kvmarm/[email protected]/T/#u
Thanks,
Gavin