s390x: run script fixes for PV tests
cover s390x: run script fixes for PV tests
Shellcheck caught what looks like two bugs. May not have been too noticable because one just seems like it allows TCG to run PV tests which fails (and might be guarded out later anyway), and the other might only affect running and individual .pv.bin test with s390x-run and not unittests runs.
I don't know about running PV tests or have a system with KVM to try, so these are not tested beyond gitlab CI. That might run some PV tests with s390x-kvm, but I don't know so please test/review/ack/nack if possible.
Thanks,
Nick
Nicholas Piggin (2):
s390x: Fix misspelt variable name in func.bash
s390x: Fix is_pv check in run script
s390x/run | 8 ++++---- scripts/s390x/func.bash | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 s390x: Fix misspelt variable name in func.bash
The if statement is intended to run non-migration tests with PV on KVM. With the misspelling, they are run on KVM or TCG.
--- scripts/s390x/func.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/s390x/func.bash +1 -1
@@ -21,7 +21,7 @@ function arch_cmd_s390x() "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" # run PV test case - if [ "$ACCEL" = 'tcg' ] || grep -q "migration" <<< "$groups"; then + if [ "$accel" = 'tcg' ] || grep -q "migration" <<< "$groups"; then return fi kernel=${kernel%.elf}.pv.bin
Signature · 1 line
2.43.0
Re: [kvm-unit-tests PATCH 1/2] s390x: Fix misspelt variable name in func.bash
Quoted 3 lines · Nicholas Piggin
The if statement is intended to run non-migration tests with PV on KVM. With the misspelling, they are run on KVM or TCG.
It's not misspelt, is it?
It's in the wrong case.
I'm fine with the code though.
Re: [kvm-unit-tests PATCH 1/2] s390x: Fix misspelt variable name in func.bash
Quoted 7 lines · Janosch Frank
Quoted 3 lines · Nicholas Piggin
The if statement is intended to run non-migration tests with PV on KVM. With the misspelling, they are run on KVM or TCG.
It's not misspelt, is it?
It's in the wrong case.
Yes, that's the right word.
Quoted 3 lines
I'm fine with the code though.
Thanks, I'll take that as an Acked-by: you
Thanks,
Nick
Re: [kvm-unit-tests PATCH 1/2] s390x: Fix misspelt variable name in func.bash
Quoted 9 lines · Nicholas Piggin
Quoted 7 lines · Janosch Frank
Quoted 3 lines · Nicholas Piggin
The if statement is intended to run non-migration tests with PV on KVM. With the misspelling, they are run on KVM or TCG.
It's not misspelt, is it?
It's in the wrong case.
Quoted 7 lines
Yes, that's the right word.
Quoted 3 lines
I'm fine with the code though.
Thanks, I'll take that as an Acked-by: you
Could you send out a fixed version that I can pick or do you want me to fix that up?
Re: [kvm-unit-tests PATCH 1/2] s390x: Fix misspelt variable name in func.bash
Quoted 14 lines · Janosch Frank
Quoted 13 lines · Nicholas Piggin
Quoted 7 lines · Janosch Frank
Quoted 3 lines · Nicholas Piggin
The if statement is intended to run non-migration tests with PV on KVM. With the misspelling, they are run on KVM or TCG.
It's not misspelt, is it?
It's in the wrong case.Yes, that's the right word.
Quoted 2 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
I'm fine with the code though.
Thanks, I'll take that as an Acked-by: you
Could you send out a fixed version that I can pick or do you want me to fix that up?
I was going to at some point, but was juggling a bunch of other things and have some travel and vacation. You are welcome to take over them if you like it would be helpful.
Thanks,
Nick
Re: [kvm-unit-tests PATCH 1/2] s390x: Fix misspelt variable name in func.bash
Quoted 17 lines · Nicholas Piggin
Quoted 16 lines · Janosch Frank
Quoted 15 lines · Nicholas Piggin
Quoted 7 lines · Janosch Frank
Quoted 3 lines · Nicholas Piggin
The if statement is intended to run non-migration tests with PV on KVM. With the misspelling, they are run on KVM or TCG.
It's not misspelt, is it?
It's in the wrong case.Yes, that's the right word.
Quoted 3 lines
I'm fine with the code though.
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
Thanks, I'll take that as an Acked-by: you
Could you send out a fixed version that I can pick or do you want me to fix that up?
I was going to at some point, but was juggling a bunch of other things and have some travel and vacation. You are welcome to take over them if you like it would be helpful.
Same here, I'll be on vacation starting next week so I've prepared a branch with your patches for Nico and Claudio which they can send out when I'm on vacation.
https://gitlab.com/frankja/kvm-unit-tests/-/commits/queue/?ref_type=heads
PATCH 2/2 s390x: Fix is_pv check in run script
In reply to Nicholas PigginShellcheck reports "is_pv references arguments, but none are ever passed." and suggests "use is_pv "$@" if function's $1 should mean script's $1."
The is_pv test does not evaluate to true for .pv.bin file names, only for _PV suffix test names. The arch_cmd_s390x() function appends .pv.bin to the file name AND _PV to the test name, so this does not affect run_tests.sh runs, but it might prevent PV tests from being run directly with the s390x-run command.
--- s390x/run | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
s390x/run +4 -4
@@ -21,12 +21,12 @@ is_pv() { return 1 } -if is_pv && [ "$ACCEL" = "tcg" ]; then +if is_pv "$@" && [ "$ACCEL" = "tcg" ]; then echo "Protected Virtualization isn't supported under TCG" exit 2 fi -if is_pv && [ "$MIGRATION" = "yes" ]; then +if is_pv "$@" && [ "$MIGRATION" = "yes" ]; then echo "Migration isn't supported under Protected Virtualization" exit 2 fi
@@ -34,12 +34,12 @@ fi M='-machine s390-ccw-virtio' M+=",accel=$ACCEL$ACCEL_PROPS" -if is_pv; then +if is_pv "$@"; then M+=",confidential-guest-support=pv0" fi command="$qemu -nodefaults -nographic $M" -if is_pv; then +if is_pv "$@"; then command+=" -object s390-pv-guest,id=pv0" fi command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0"
Signature · 1 line
2.43.0
Re: [kvm-unit-tests PATCH 2/2] s390x: Fix is_pv check in run script
Quoted 10 lines · On Sat, 6 Apr 2024 22:24:54 +1000 Nicholas Piggin <[email protected]> wrote:
Shellcheck reports "
is_pvreferences arguments, but none are ever passed." and suggests "useis_pv"$@" if function's $1 should mean script's $1."The
is_pvtest does not evaluate to true for .pv.bin file names, only for_PVsuffix test names. Thearch_cmd_s390x()function appends .pv.bin to the file name AND_PVto the test name, so this does not affectrun_tests.shruns, but it might prevent PV tests from being run directly with the s390x-run command.
Quoted 3 lines
Reported-by shellcheck SC2119, SC2120Reviewed-by Andrew Jones <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>
although tbh I would rewrite it to check a variable, something like:
IS_PV=no
[ "${1: -7}" = ".pv.bin" -o "${TESTNAME: -3}" = "_PV" ] && IS_PV=yes
Quoted 9 lines
--- s390x/run | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)s390x/run +0
-0
s390x/run is_pv() { · line 24
Quoted 5 lines
s390x/run +1
-1@@ -21,12 +21,12 @@ is_pv() { return 1 } -if is_pv && [ "$ACCEL" = "tcg" ]; then +if is_pv "$@" && [ "$ACCEL" = "tcg" ]; then
if [ "$IS_PV" = "yes" -a "$ACCEL" = "tcg" ]; then
etc...
Quoted 24 lines
s390x/run +3
-3echo "Protected Virtualization isn't supported under TCG" exit 2 fi -if is_pv && [ "$MIGRATION" = "yes" ]; then +if is_pv "$@" && [ "$MIGRATION" = "yes" ]; then echo "Migration isn't supported under Protected Virtualization" exit 2 fi@@ -34,12 +34,12 @@ fi M='-machine s390-ccw-virtio' M+=",accel=$ACCEL$ACCEL_PROPS" -if is_pv; then +if is_pv "$@"; then M+=",confidential-guest-support=pv0" fi command="$qemu -nodefaults -nographic $M" -if is_pv; then +if is_pv "$@"; then command+=" -object s390-pv-guest,id=pv0" fi command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0"
Re: [kvm-unit-tests PATCH 2/2] s390x: Fix is_pv check in run script
Quoted 13 lines · Claudio Imbrenda
Quoted 10 lines · On Sat, 6 Apr 2024 22:24:54 +1000 Nicholas Piggin <[email protected]> wrote:
Shellcheck reports "
is_pvreferences arguments, but none are ever passed." and suggests "useis_pv"$@" if function's $1 should mean script's $1."The
is_pvtest does not evaluate to true for .pv.bin file names, only for_PVsuffix test names. Thearch_cmd_s390x()function appends .pv.bin to the file name AND_PVto the test name, so this does not affectrun_tests.shruns, but it might prevent PV tests from being run directly with the s390x-run command.
Quoted 6 lines
Quoted 3 lines
Reported-by shellcheck SC2119, SC2120Reviewed-by Andrew Jones <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>Reviewed-by Claudio Imbrenda <[email protected]>Fixes bcedc5a2 ("s390x: run PV guests with confidential guest enabled")
Thanks.
Quoted 4 lines
although tbh I would rewrite it to check a variable, something like:
IS_PV=no
[ "${1: -7}" = ".pv.bin" -o "${TESTNAME: -3}" = "_PV" ] && IS_PV=yes
I don't have a problem if you want to fix it a different way instead. I don't have a good way to test at the moment and this seemed the simplest fix. Shout out if you don't want it going upstream as is.
Thanks,
Nick
Quoted 44 lines
Quoted 10 lines
--- s390x/run | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)s390x/run +0
-0s390x/run is_pv() { · line 24
Quoted 5 lines
s390x/run +1
-1@@ -21,12 +21,12 @@ is_pv() { return 1 } -if is_pv && [ "$ACCEL" = "tcg" ]; then +if is_pv "$@" && [ "$ACCEL" = "tcg" ]; thenif [ "$IS_PV" = "yes" -a "$ACCEL" = "tcg" ]; then
etc...
Quoted 24 lines
s390x/run +3
-3echo "Protected Virtualization isn't supported under TCG" exit 2 fi -if is_pv && [ "$MIGRATION" = "yes" ]; then +if is_pv "$@" && [ "$MIGRATION" = "yes" ]; then echo "Migration isn't supported under Protected Virtualization" exit 2 fi@@ -34,12 +34,12 @@ fi M='-machine s390-ccw-virtio' M+=",accel=$ACCEL$ACCEL_PROPS" -if is_pv; then +if is_pv "$@"; then M+=",confidential-guest-support=pv0" fi command="$qemu -nodefaults -nographic $M" -if is_pv; then +if is_pv "$@"; then command+=" -object s390-pv-guest,id=pv0" fi command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0"
Re: [kvm-unit-tests PATCH 2/2] s390x: Fix is_pv check in run script
Quoted 25 lines · On Wed, 10 Apr 2024 14:34:25 +1000 "Nicholas Piggin" <[email protected]> wrote:
Quoted 13 lines · Claudio Imbrenda
Quoted 10 lines · On Sat, 6 Apr 2024 22:24:54 +1000 Nicholas Piggin <[email protected]> wrote:
Shellcheck reports "
is_pvreferences arguments, but none are ever passed." and suggests "useis_pv"$@" if function's $1 should mean script's $1."The
is_pvtest does not evaluate to true for .pv.bin file names, only for_PVsuffix test names. Thearch_cmd_s390x()function appends .pv.bin to the file name AND_PVto the test name, so this does not affectrun_tests.shruns, but it might prevent PV tests from being run directly with the s390x-run command.Quoted 6 lines
Quoted 3 lines
Reported-by shellcheck SC2119, SC2120Reviewed-by Andrew Jones <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>Reviewed-by Claudio Imbrenda <[email protected]>Fixes bcedc5a2 ("s390x: run PV guests with confidential guest enabled")Thanks.
Quoted 2 lines
although tbh I would rewrite it to check a variable, something like:
Quoted 7 lines
Quoted 2 lines
IS_PV=no
[ "${1: -7}" = ".pv.bin" -o "${TESTNAME: -3}" = "_PV" ] && IS_PV=yesI don't have a problem if you want to fix it a different way instead. I don't have a good way to test at the moment and this seemed the simplest fix. Shout out if you don't want it going upstream as is.
well, I did give you a r-b for the current version of your patch :)
it's not so important, as long as it works correctly
Quoted 49 lines
Thanks,
NickQuoted 44 lines
Quoted 10 lines
--- s390x/run | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)s390x/run +0
-0s390x/run is_pv() { · line 24
Quoted 5 lines
s390x/run +1
-1@@ -21,12 +21,12 @@ is_pv() { return 1 } -if is_pv && [ "$ACCEL" = "tcg" ]; then +if is_pv "$@" && [ "$ACCEL" = "tcg" ]; thenif [ "$IS_PV" = "yes" -a "$ACCEL" = "tcg" ]; then
etc...
Quoted 24 lines
s390x/run +3
-3echo "Protected Virtualization isn't supported under TCG" exit 2 fi -if is_pv && [ "$MIGRATION" = "yes" ]; then +if is_pv "$@" && [ "$MIGRATION" = "yes" ]; then echo "Migration isn't supported under Protected Virtualization" exit 2 fi@@ -34,12 +34,12 @@ fi M='-machine s390-ccw-virtio' M+=",accel=$ACCEL$ACCEL_PROPS" -if is_pv; then +if is_pv "$@"; then M+=",confidential-guest-support=pv0" fi command="$qemu -nodefaults -nographic $M" -if is_pv; then +if is_pv "$@"; then command+=" -object s390-pv-guest,id=pv0" fi command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0"
Re: [kvm-unit-tests PATCH 2/2] s390x: Fix is_pv check in run script
In reply to Nicholas PigginQuoted 10 lines · Nicholas Piggin
Shellcheck reports "
is_pvreferences arguments, but none are ever passed." and suggests "useis_pv"$@" if function's $1 should mean script's $1."The
is_pvtest does not evaluate to true for .pv.bin file names, only for_PVsuffix test names. Thearch_cmd_s390x()function appends .pv.bin to the file name AND_PVto the test name, so this does not affectrun_tests.shruns, but it might prevent PV tests from being run directly with the s390x-run command.
The only thing that changes with this patch is that we get the error message from s390x/run and not from QEMU which complains about the unpack facility (needed for PV) not being available (because TCG does not implement it). And that's likely why we never ran into any problems.
Patch looks fine to me:
Re: [kvm-unit-tests PATCH 2/2] s390x: Fix is_pv check in run script
Quoted 12 lines · Janosch Frank
Quoted 10 lines · Nicholas Piggin
Shellcheck reports "
is_pvreferences arguments, but none are ever passed." and suggests "useis_pv"$@" if function's $1 should mean script's $1."The
is_pvtest does not evaluate to true for .pv.bin file names, only for_PVsuffix test names. Thearch_cmd_s390x()function appends .pv.bin to the file name AND_PVto the test name, so this does not affectrun_tests.shruns, but it might prevent PV tests from being run directly with the s390x-run command.
Quoted 5 lines
The only thing that changes with this patch is that we get the error message from s390x/run and not from QEMU which complains about the unpack facility (needed for PV) not being available (because TCG does not implement it).
And that's likely why we never ran into any problems.
Yeah it did look relatively minor. Thanks for taking a look.
Thanks,
Nick
Quoted 4 lines
Patch looks fine to me:
Reviewed-by Janosch Frank <[email protected]>
Quoted 6 lines · Nicholas Piggin
Shellcheck caught what looks like two bugs. May not have been too noticable because one just seems like it allows TCG to run PV tests which fails (and might be guarded out later anyway), and the other might only affect running and individual .pv.bin test with s390x-run and not unittests runs.
Quoted 7 lines
I don't know about running PV tests or have a system with KVM to try, so these are not tested beyond gitlab CI. That might run some PV tests with s390x-kvm, but I don't know so please test/review/ack/nack if possible.
Thanks,
Nick
Hey Nick, thanks for cleaning this up.
The changes work on my machine and I've thrown them into our CI.
Give me a sec to check the patches itself.