s390x: Add specification exception test
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/5 s390x: Add specification exception test
Generate specification exceptions and check that they occur. With the iterations argument one can check if specification exception interpretation occurs, e.g. by using a high value and checking that the debugfs counters are substantially lower. The argument is also useful for estimating the performance benefit of interpretation.
--- s390x/Makefile | 1 + s390x/spec_ex.c | 182 ++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 3 + 3 files changed, 186 insertions(+) create mode 100644 s390x/spec_ex.c
s390x/Makefile +1 -0
@@ -24,6 +24,7 @@ tests += $(TEST_DIR)/mvpg.elf tests += $(TEST_DIR)/uv-host.elf tests += $(TEST_DIR)/edat.elf tests += $(TEST_DIR)/mvpg-sie.elf +tests += $(TEST_DIR)/spec_ex.elf tests_binary = $(patsubst %.elf,%.bin,$(tests)) ifneq ($(HOST_KEY_DOCUMENT),)
s390x/spec_ex.c new file +182 -0
182 lines not on this page · raw message
s390x/unittests.cfg +3 -0
@@ -109,3 +109,6 @@ file = edat.elf [mvpg-sie] file = mvpg-sie.elf + +[spec_ex] +file = spec_ex.elf
Signature · 1 line
2.31.1
Re: [kvm-unit-tests PATCH v2 1/5] [kvm-unit-tests PATCH v2 0/5] Add specification exception tests
Oops, forgot to Cc the lists on the cover letter, see below.
Test that specification exceptions cause the correct interruption code during both normal and transactional execution.
The last three patches are cosmetic only and could be dropped.
Unrelated: There should not be * in the file patterns in MAINTAINERS, should there?
v1 -> v2
Add license and test description
Split test patch into normal test and transactional execution test Add comments to
invalid PSW fixup function
with_transaction
Rename some variables/functions
Pass mask as single parameter to asm
Get rid of report_info_if macro
Introduce report_pass/fail and use them
Janis Schoetterl-Glausch (5):
s390x: Add specification exception test
s390x: Test specification exceptions during transaction
lib: Introduce report_pass and report_fail
Use report_fail(...) instead of report(0/false, ...) Use report_pass(...) instead of report(1/true, ...)
s390x/Makefile | 1 + lib/s390x/asm/arch_def.h | 1 + lib/libcflat.h | 6 +- lib/report.c | 20 ++- lib/s390x/css_lib.c | 30 ++-- x86/vmx.h | 31 ++-- arm/psci.c | 2 +- arm/timer.c | 2 +- s390x/css.c | 22 +-- s390x/diag288.c | 2 +- s390x/selftest.c | 2 +- s390x/smp.c | 16 +- s390x/spec_ex.c | 345 +++++++++++++++++++++++++++++++++++++++ x86/asyncpf.c | 11 +- x86/emulator.c | 2 +- x86/hyperv_stimer.c | 24 ++- x86/hyperv_synic.c | 2 +- x86/svm_tests.c | 180 ++++++++++---------- x86/syscall.c | 2 +- x86/taskswitch2.c | 2 +- x86/tsc_adjust.c | 2 +- x86/vmx.c | 23 ++- x86/vmx_tests.c | 172 ++++++++++--------- s390x/unittests.cfg | 3 + 24 files changed, 630 insertions(+), 273 deletions(-) create mode 100644 s390x/spec_ex.c
base-commit: fe26131eec769cef7ad7e2e1e4e192aa0bdb2bba
Signature · 1 line
2.31.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 69 lines · Janosch Frank
Quoted 68 lines · Janis Schoetterl-Glausch
Generate specification exceptions and check that they occur. With the iterations argument one can check if specification exception interpretation occurs, e.g. by using a high value and checking that the debugfs counters are substantially lower. The argument is also useful for estimating the performance benefit of interpretation.
Signed-off-by Janis Schoetterl-Glausch <[email protected]>---
s390x/Makefile | 1 +
s390x/spec_ex.c | 182 ++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 3 +3 files changed, 186 insertions(+)create mode 100644
s390x/spec_ex.cs390x/Makefile +0
-0@@ -24,6 +24,7 @@ tests += $(TEST_DIR)/mvpg.elftests += $(TEST_DIR)/uv-host.elf
tests += $(TEST_DIR)/edat.elf
tests += $(TEST_DIR)/mvpg-sie.elf
+tests += $(TEST_DIR)/spec_ex.elftests_binary= $(patsubst %.elf,%.bin,$(tests)) ifneq ($(HOST_KEY_DOCUMENT),)s390x/spec_ex.c new file +36
-0@@ -0,0 +1,182 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* © Copyright IBM Corp. 2021 +* +* Specification exception test. +* Tests that specification exceptions occur when expected. +*/ +#include <stdlib.h> +#include <libcflat.h> +#include <asm/interrupt.h> +#include <asm/facility.h> + +static struct lowcore *lc = (struct lowcore *)0 ; + +static bool expect_invalid_psw; +static struct psw expected_psw; +static struct psw fixup_psw; + +/* The standard program exception handler cannot deal with invalid old PSWs, +* especially not invalid instruction addresses, as in that case one cannot +* find the instruction following the faulting one from the old PSW. +* The PSW to return to is set by load_psw. +*/ +static void fixup_invalid_psw (void ) +{ + if (expect_invalid_psw) { + report(expected_psw.mask == lc->pgm_old_psw.mask + && expected_psw.addr == lc->pgm_old_psw.addr, + "Invalid program new PSW as expected"); + expect_invalid_psw = false; + } + lc->pgm_old_psw = fixup_psw; +} + +static void load_psw (struct psw psw) +{
Quoted 8 lines
s390x/spec_ex.c line 42
Quoted 6 lines
s390x/spec_ex.c new file +6
-0+ uint64_t r0 = 0, r1 = 0; + + asm volatile ( + " epsw %0,%1\n" + " st %0,%[mask]\n" + " st %1,4+%[mask]\n"You're grabbing the mask for the fixup psw, right?
Yes
Quoted 1 line
Why don't you use the
extract_psw_mask()function for that?
No reason, sounds like a good idea to use the function.
Quoted 2 lines
Also I'd recommend not mixing named operands and numeric operands, especially when the variables are then called r0 and r1.
I suppose I didn't name them because they're just scratch registers. But using extract_psw_mask() will get rid of them anyway
Quoted 29 lines
s390x/spec_ex.c line 44
Quoted 3 lines
s390x/spec_ex.c new file +2
-0+ " larl %0,nop%=\n" + " stg %0,%[addr]\n"This stores the address of the nop to the fixup psw addr. So far so good, but why is it only called "addr"?
s390x/spec_ex.c line 51
Quoted 7 lines
s390x/spec_ex.c new file +7
-0+ " lpswe %[psw]\n" + "nop%=: nop\n" + : "+&r"(r0), "+&a"(r1), [mask] "=&R"(fixup_psw.mask), + [addr] "=&R"(fixup_psw.addr) + : [psw] "Q"(psw) + : "cc", "memory" + );You made this a bit complicated and didn't document it.
/*
* Setupfixup_pswbefore loading an invalid PSW so that*fixup_invalid_psw()can bring us back onto the right track. */Quoted 10 lines
Quoted 1 line
+}
s390x/spec_ex.c new file +9
-0+ +static void psw_bit_12_is_1 (void ) +{ + expected_psw.mask = 0x0008000000000000; + expected_psw.addr = 0x00000000deadbeee; + expect_invalid_psw = true; + load_psw(expected_psw); +} +
[...]
Quoted 33 lines · Janis Schoetterl-Glausch
Generate specification exceptions and check that they occur. With the iterations argument one can check if specification exception interpretation occurs, e.g. by using a high value and checking that the debugfs counters are substantially lower. The argument is also useful for estimating the performance benefit of interpretation.
Signed-off-by Janis Schoetterl-Glausch <[email protected]>--- s390x/Makefile | 1 + s390x/spec_ex.c | 182 ++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 3 + 3 files changed, 186 insertions(+)create mode 100644
s390x/spec_ex.cs390x/Makefile +1
-0@@ -24,6 +24,7 @@ tests += $(TEST_DIR)/mvpg.elf tests += $(TEST_DIR)/uv-host.elf tests += $(TEST_DIR)/edat.elf tests += $(TEST_DIR)/mvpg-sie.elf +tests += $(TEST_DIR)/spec_ex.elf tests_binary = $(patsubst %.elf,%.bin,$(tests)) ifneq ($(HOST_KEY_DOCUMENT),)s390x/spec_ex.c new file +0
-0
s390x/spec_ex.c line 3
Quoted 3 lines
s390x/spec_ex.c new file +3
-0@@ -0,0 +1,182 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* © Copyright IBM Corp. 2021
Could we please avoid non-ASCII characters in source code if possible? ... it's maybe best if you do the Copyright line similar to the other *.c files from IBM that are already in the repository.
Quoted 34 lines
s390x/spec_ex.c new file +34
-0+* Specification exception test. +* Tests that specification exceptions occur when expected. +*/ +#include <stdlib.h> +#include <libcflat.h> +#include <asm/interrupt.h> +#include <asm/facility.h> + +static struct lowcore *lc = (struct lowcore *)0 ; + +static bool expect_invalid_psw; +static struct psw expected_psw; +static struct psw fixup_psw; + +/* The standard program exception handler cannot deal with invalid old PSWs, +* especially not invalid instruction addresses, as in that case one cannot +* find the instruction following the faulting one from the old PSW. +* The PSW to return to is set by load_psw. +*/ +static void fixup_invalid_psw (void ) +{ +if (expect_invalid_psw) { +report (expected_psw.mask == lc->pgm_old_psw.mask + && expected_psw.addr == lc->pgm_old_psw.addr, +"Invalid program new PSW as expected" ); + expect_invalid_psw = false; + } + lc->pgm_old_psw = fixup_psw; +} + +static void load_psw (struct psw psw) +{ +uint64_t r0 =0 , r1 =0 ; +
s390x/spec_ex.c line 48
Quoted 10 lines
s390x/spec_ex.c new file +10
-0+ asmvolatile ( +" epsw %0,%1\n" +" st %0,%[mask]\n" +" st %1,4+%[mask]\n" +" larl %0,nop%=\n" +" stg %0,%[addr]\n" +" lpswe %[psw]\n" +"nop%=: nop\n" + :"+&r" (r0),"+&a" (r1), [mask]"=&R" (fixup_psw.mask), + [addr] "=&R"(fixup_psw.addr)
stg uses long displacement, so maybe the constraint should rather be "T" instead?
Quoted 91 lines
s390x/spec_ex.c new file +91
-0+ : [psw] "Q"(psw) + : "cc", "memory" + ); +} + +static void psw_bit_12_is_1 (void ) +{ + expected_psw.mask =0x0008000000000000 ; + expected_psw.addr =0x00000000deadbeee ; + expect_invalid_psw = true; +load_psw (expected_psw); +} + +static void bad_alignment (void ) +{ +uint32_t words[5 ] = {0 ,0 ,0 }; +uint32_t (*bad_aligned)[4 ]; + + registeruint64_t r1 asm("6" ); + registeruint64_t r2 asm("7" ); +if (((uintptr_t )&words[0 ]) &0xf ) + bad_aligned = (uint32_t (*)[4 ])&words[0 ]; +else + bad_aligned = (uint32_t (*)[4 ])&words[1 ]; + asmvolatile ("lpq %0,%2" + :"=r" (r1),"=r" (r2) + :"T" (*bad_aligned) + ); +} + +static void not_even (void ) +{ +uint64_t quad[2 ]; + + registeruint64_t r1 asm("7" ); + registeruint64_t r2 asm("8" ); + asmvolatile (".insn rxy,0xe3000000008f,%0,%2" //lpq %0,%2 + :"=r" (r1),"=r" (r2) + :"T" (quad) + ); +} + +struct spec_ex_trigger { +const char *name; +void (*func)(void ); +void (*fixup)(void ); +}; + +static const struct spec_ex_trigger spec_ex_triggers[] = { + {"psw_bit_12_is_1" , &psw_bit_12_is_1, &fixup_invalid_psw}, + {"bad_alignment" , &bad_alignment,NULL }, + {"not_even" , ¬_even,NULL }, + {NULL ,NULL ,NULL }, +}; + +struct args { +uint64_t iterations; +}; + +static void test_spec_ex (struct args *args, +const struct spec_ex_trigger *trigger) +{ +uint16_t expected_pgm =PGM_INT_CODE_SPECIFICATION ; +uint16_t pgm; +unsigned int i; + +for (i =0 ; i < args->iterations; i++) { +expect_pgm_int (); +register_pgm_cleanup_func (trigger->fixup); + trigger->func (); +register_pgm_cleanup_func (NULL ); + pgm =clear_pgm_int (); +if (pgm != expected_pgm) { +report (0 , +"Program interrupt: expected(%d) == received(%d)" , + expected_pgm, + pgm); +return ; + } + } +report (1 , +"Program interrupt: always expected(%d) == received(%d)" , + expected_pgm, + expected_pgm); +} + +static struct args parse_args (int argc,char **argv) +{ +struct args args = { + .iterations =1 , + };
s390x/spec_ex.c line 149
Quoted 10 lines
s390x/spec_ex.c new file +10
-0+unsigned int i; +long arg; +bool no_arg; +char *end; + +for (i =1 ; i < argc; i++) { + no_arg = true; +if (i < argc -1 ) { + no_arg = *argv[i+1 ] =='\0' ; + arg =strtol (argv[i+1 ], &end,10 );
Nit: It's more common to use spaces around the "+" (i.e. "i + 1")
Quoted 23 lines
s390x/spec_ex.c new file +23
-0+ no_arg |= *end !='\0' ; + no_arg |= arg <0 ; + } + +if (!strcmp ("--iterations" , argv[i])) { +if (no_arg) +report_abort ("--iterations needs a positive parameter" ); + args.iterations = arg; + ++i; + }else { +report_abort ("Unsupported parameter '%s'" , + argv[i]); + } + } +return args; +} + +int main (int argc,char **argv) +{ +unsigned int i; + +struct args args =parse_args (argc, argv); +
s390x/spec_ex.c line 182
Quoted 10 lines
s390x/spec_ex.c new file +10
-0+report_prefix_push ("specification exception" ); +for (i =0 ; spec_ex_triggers[i].name; i++) { +report_prefix_push (spec_ex_triggers[i].name); +test_spec_ex (&args, &spec_ex_triggers[i]); +report_prefix_pop (); + } +report_prefix_pop (); + +return report_summary (); +}
Apart from the nits, this looks fine to me.
Thomas
Quoted 30 lines · Thomas Huth
Quoted 29 lines · Janis Schoetterl-Glausch
Generate specification exceptions and check that they occur. With the iterations argument one can check if specification exception interpretation occurs, e.g. by using a high value and checking that the debugfs counters are substantially lower. The argument is also useful for estimating the performance benefit of interpretation.
Signed-off-by Janis Schoetterl-Glausch <[email protected]>---
s390x/Makefile | 1 +
s390x/spec_ex.c | 182 ++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 3 +3 files changed, 186 insertions(+)create mode 100644
s390x/spec_ex.cs390x/Makefile +0
-0@@ -24,6 +24,7 @@ tests += $(TEST_DIR)/mvpg.elftests += $(TEST_DIR)/uv-host.elf
tests += $(TEST_DIR)/edat.elf
tests += $(TEST_DIR)/mvpg-sie.elf
+tests += $(TEST_DIR)/spec_ex.elftests_binary= $(patsubst %.elf,%.bin,$(tests)) ifneq ($(HOST_KEY_DOCUMENT),)s390x/spec_ex.c new file +0
-0
Quoted 8 lines
s390x/spec_ex.c line 3
Quoted 6 lines
s390x/spec_ex.c new file +3
-0@@ -0,0 +1,182 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* © Copyright IBM Corp. 2021 Could we please avoid non-ASCII characters in source code if possible? ... it's maybe best if you do the Copyright line similar to the other *.c files from IBM that are already in the repository.
Yes, I'll remove it. I thought it would be fine since it's in a comment, didn't consider that it might cause trouble with some mail clients. So that's grounds for removal by itself.
Quoted 39 lines
Quoted 39 lines
s390x/spec_ex.c new file +38
-0+* Specification exception test. +* Tests that specification exceptions occur when expected. +*/ +#include <stdlib.h> +#include <libcflat.h> +#include <asm/interrupt.h> +#include <asm/facility.h> + +static struct lowcore *lc = (struct lowcore *)0 ; + +static bool expect_invalid_psw; +static struct psw expected_psw; +static struct psw fixup_psw; + +/* The standard program exception handler cannot deal with invalid old PSWs, +* especially not invalid instruction addresses, as in that case one cannot +* find the instruction following the faulting one from the old PSW. +* The PSW to return to is set by load_psw. +*/ +static void fixup_invalid_psw (void ) +{ + if (expect_invalid_psw) { + report(expected_psw.mask == lc->pgm_old_psw.mask + && expected_psw.addr == lc->pgm_old_psw.addr, + "Invalid program new PSW as expected"); + expect_invalid_psw = false; + } + lc->pgm_old_psw = fixup_psw; +} + +static void load_psw (struct psw psw) +{ + uint64_t r0 = 0, r1 = 0; + + asm volatile ( + " epsw %0,%1\n" + " st %0,%[mask]\n" + " st %1,4+%[mask]\n"
Quoted 8 lines
s390x/spec_ex.c line 48
Quoted 6 lines
s390x/spec_ex.c new file +6
-0+ " larl %0,nop%=\n" + " stg %0,%[addr]\n" + " lpswe %[psw]\n" + "nop%=: nop\n" + : "+&r"(r0), "+&a"(r1), [mask] "=&R"(fixup_psw.mask), + [addr] "=&R"(fixup_psw.addr)stg uses long displacement, so maybe the constraint should rather be "T" instead?
Good catch.
Quoted 6 lines
Quoted 6 lines
s390x/spec_ex.c new file +5
-0+ : [psw] "Q"(psw) + : "cc", "memory" + ); +} +
[...]
Quoted 9 lines
Quoted 9 lines
s390x/spec_ex.c new file +9
-0+static struct args parse_args (int argc,char **argv) +{ + struct args args = { + .iterations = 1, + }; + unsigned int i; + long arg; + bool no_arg; + char *end;
Quoted 8 lines
Quoted 6 lines
+
+ for (i = 1; i < argc; i++) {
+no_arg= true;
+ if (i < argc - 1) {
+no_arg= *argv[i+1] == '\0';
+ arg =strtol(argv[i+1], &end, 10);Nit: It's more common to use spaces around the "+" (i.e. "i + 1")
Ok
Quoted 28 lines
Quoted 28 lines
+
no_arg|= *end != '\0';
+no_arg|= arg < 0;
+ }s390x/spec_ex.c new file +24
-0+ + if (!strcmp("--iterations", argv[i])) { + if (no_arg) + report_abort("--iterations needs a positive parameter"); + args.iterations = arg; + ++i; + } else { + report_abort("Unsupported parameter '%s'", + argv[i]); + } + } + return args; +} + +int main (int argc,char **argv) +{ + unsigned int i; + + struct args args = parse_args(argc, argv); + + report_prefix_push("specification exception"); + for (i = 0; spec_ex_triggers[i].name; i++) { + report_prefix_push(spec_ex_triggers[i].name); + test_spec_ex(&args, &spec_ex_triggers[i]);
Quoted 8 lines
s390x/spec_ex.c line 182
Quoted 6 lines
+
report_prefix_pop();
+ }
+report_prefix_pop();s390x/spec_ex.c new file +3
-0+ + return report_summary(); +}Apart from the nits, this looks fine to me.
Thanks for the review.
Quoted 3 lines
Thomas
PATCH v2 2/5 s390x: Test specification exceptions during transaction
In reply to a message not in the archiveProgram interruptions during transactional execution cause other interruption codes.
Check that we see the expected code for (some) specification exceptions.
--- lib/s390x/asm/arch_def.h | 1 + s390x/spec_ex.c | 175 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 171 insertions(+), 5 deletions(-)
lib/s390x/asm/arch_def.h +1 -0
@@ -235,6 +235,7 @@ static inline uint64_t stctg(int cr)return value; } +#define CTL0_TRANSACT_EX_CTL (63 - 8)#define CTL0_LOW_ADDR_PROT (63 - 35)#define CTL0_EDAT (63 - 40)#define CTL0_IEP (63 - 43)
s390x/spec_ex.c +170 -5
227 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v2 3/5 lib: Introduce report_pass and report_fail
In reply to a message not in the archiveThese functions can be used instead of report(1/true/0/false, ...) and read a bit nicer.
---
There is probably a better name than report_passed() for the function without a message...
lib/libcflat.h | 6 +++++- lib/report.c | 20 +++++++++++++++++++- x86/vmx.h | 6 +++--- 3 files changed, 27 insertions(+), 5 deletions(-)
lib/libcflat.h +5 -1
@@ -106,7 +106,11 @@ extern void report_skip(const char *msg_fmt, ...) __attribute__((format(printf, 1, 2)));extern void report_info (const char *msg_fmt, ...) __attribute__((format (printf,1 ,2 ))); -extern void report_pass (void ); +extern void report_pass (const char *msg_fmt, ...) + __attribute__((format (printf,1 ,2 ))); +extern void report_fail (const char *msg_fmt, ...) + __attribute__((format (printf,1 ,2 ))); +extern void report_passed (void );extern int report_summary (void );bool simple_glob (const char *text,const char *pattern);
lib/report.c +19 -1
@@ -19,7 +19,7 @@ static struct spinlock lock;#define PREFIX_DELIMITER ": " -void report_pass (void ) +void report_passed (void ) {spin_lock (&lock); tests++;
@@ -112,6 +112,24 @@ void report(bool pass, const char *msg_fmt, ...)va_end (va); } +void report_pass (const char *msg_fmt, ...) +{ +va_list va; + +va_start (va, msg_fmt); +va_report (msg_fmt, true, false, false, va); +va_end (va); +} + +void report_fail (const char *msg_fmt, ...) +{ +va_list va; + +va_start (va, msg_fmt); +va_report (msg_fmt, false, false, false, va); +va_end (va); +} +void report_xfail (bool xfail,bool pass,const char *msg_fmt, ...) {va_list va;
x86/vmx.h +3 -3
@@ -928,7 +928,7 @@ do { \dump_stack (); \__abort_test (); \ } \ -report_pass (); \ +report_passed (); \ }while (0 ) #define TEST_ASSERT_MSG(cond, fmt, args...) \
@@ -939,7 +939,7 @@ do { \dump_stack (); \__abort_test (); \ } \ -report_pass (); \ +report_passed (); \ }while (0 ) #define __TEST_EQ(a, b, a_str, b_str, assertion, fmt, args...) \
@@ -964,7 +964,7 @@ do { \if (assertion) \__abort_test (); \ } \ -report_pass (); \ +report_passed (); \ } while (0)#define TEST_ASSERT_EQ (a, b) __TEST_EQ(a, b, #a, #b, 1, "")
Signature · 1 line
2.31.1
PATCH v2 4/5 Use report_fail(...) instead of report(0/false, ...)
In reply to a message not in the archiveWhitespace is kept consistent with the rest of the file.
--- lib/s390x/css_lib.c | 30 ++++---- x86/vmx.h | 25 ++++--- arm/psci.c | 2 +- arm/timer.c | 2 +- s390x/css.c | 18 ++--- s390x/spec_ex.c | 7 +- x86/asyncpf.c | 4 +- x86/hyperv_stimer.c | 6 +- x86/hyperv_synic.c | 2 +- x86/svm_tests.c | 163 ++++++++++++++++++++++---------------------- x86/vmx.c | 17 +++-- x86/vmx_tests.c | 136 ++++++++++++++++++------------------ 12 files changed, 200 insertions(+), 212 deletions(-)
lib/s390x/css_lib.c +14 -16
@@ -360,9 +360,8 @@ void css_irq_io(void) sid = lowcore_ptr->subsys_id_word;/* Lowlevel set the SID as interrupt parameter. */ if (lowcore_ptr->io_int_param != sid) { -report (0 , -"io_int_param: %x differs from subsys_id_word: %x" , - lowcore_ptr->io_int_param, sid); +report_fail ("io_int_param: %x differs from subsys_id_word: %x" , + lowcore_ptr->io_int_param, sid); goto pop; }report_prefix_pop ();
@@ -373,15 +372,14 @@ void css_irq_io(void)case 1 :dump_irb (&irb); flags =dump_scsw_flags (irb.scsw.ctrl); -report (0 , -"I/O interrupt, but tsch returns CC 1 for subchannel %08x. SCSW flags: %s" , - sid, flags); +report_fail ("I/O interrupt, but tsch returns CC 1 for subchannel %08x.SCSW flags: %s" , + sid, flags);break ;case 2 : -report (0 ,"tsch returns unexpected CC 2" ); +report_fail ("tsch returns unexpected CC 2" );break ;case 3 : -report (0 ,"tsch reporting sch %08x as not operational" , sid); +report_fail ("tsch reporting sch %08x as not operational" , sid);break ;case 0 :/* Stay humble on success */
@@ -435,30 +433,30 @@ int wait_and_check_io_completion(int schid)report_prefix_push ("check I/O completion" );if (lowcore_ptr->io_int_param != schid) { -report (0 ,"interrupt parameter: expected %08x got %08x" , - schid, lowcore_ptr->io_int_param); +report_fail ("interrupt parameter: expected %08x got %08x" , + schid, lowcore_ptr->io_int_param); ret =-1 ; goto end; }/* Verify that device status is valid */ if (!(irb.scsw.ctrl &SCSW_SC_PENDING )) { -report (0 ,"No status pending after interrupt. Subch Ctrl: %08x" , - irb.scsw.ctrl); +report_fail ("No status pending after interrupt. Subch Ctrl: %08x" , + irb.scsw.ctrl); ret =-1 ; goto end; }if (!(irb.scsw.ctrl & (SCSW_SC_SECONDARY |SCSW_SC_PRIMARY ))) { -report (0 ,"Primary or secondary status missing. Subch Ctrl: %08x" , - irb.scsw.ctrl); +report_fail ("Primary or secondary status missing. Subch Ctrl: %08x" , + irb.scsw.ctrl); ret =-1 ; goto end; }if (!(irb.scsw.dev_stat & (SCSW_DEVS_DEV_END |SCSW_DEVS_SCH_END ))) { -report (0 ,"No device end or sch end. Dev. status: %02x" , - irb.scsw.dev_stat); +report_fail ("No device end or sch end. Dev. status: %02x" , + irb.scsw.dev_stat); ret =-1 ; goto end; }
x86/vmx.h +12 -13
@@ -923,8 +923,8 @@ void __abort_test(void);#define TEST_ASSERT (cond) \ do { \ if (!(cond)) { \ - report(0, "%s:%d: Assertion failed: %s", \ - __FILE__, __LINE__, #cond); \ + report_fail("%s:%d: Assertion failed: %s", \ + __FILE__, __LINE__, #cond); \ dump_stack(); \ __abort_test(); \ } \
@@ -934,8 +934,8 @@ do { \ #define TEST_ASSERT_MSG(cond, fmt, args...) \ do { \ if (!(cond)) { \ - report(0, "%s:%d: Assertion failed: %s\n" fmt, \ - __FILE__, __LINE__, #cond, ##args); \ + report_fail("%s:%d: Assertion failed: %s\n" fmt, \ + __FILE__, __LINE__, #cond, ##args); \ dump_stack(); \ __abort_test(); \ } \
@@ -951,15 +951,14 @@ do { \char _bin_b[BINSTR_SZ ]; \binstr (_a, _bin_a); \binstr (_b, _bin_b); \ -report (0 , \ -"%s:%d: %s failed: (%s) == (%s)\n" \ -"\tLHS: %#018lx - %s - %lu\n" \ -"\tRHS: %#018lx - %s - %lu%s" fmt, \ - __FILE__, __LINE__, \ - assertion ?"Assertion" :"Expectation" , a_str, b_str, \ - (unsigned long ) _a, _bin_a, (unsigned long ) _a, \ - (unsigned long ) _b, _bin_b, (unsigned long ) _b, \ - fmt[0] == '\0' ? "" : "\n", ## args); \ +report_fail ("%s:%d: %s failed: (%s) == (%s)\n" \ +"\tLHS: %#018lx - %s - %lu\n" \ +"\tRHS: %#018lx - %s - %lu%s" fmt, \ + __FILE__, __LINE__, \ + assertion ?"Assertion" :"Expectation" , a_str, b_str, \ + (unsigned long ) _a, _bin_a, (unsigned long ) _a, \ + (unsigned long ) _b, _bin_b, (unsigned long ) _b, \ + fmt[0] == '\0' ? "" : "\n", ## args); \dump_stack (); \if (assertion) \__abort_test (); \
arm/psci.c +1 -1
@@ -156,7 +156,7 @@ done:#if 0 report_summary ();psci_invoke (PSCI_0_2_FN_SYSTEM_OFF ,0 ,0 ,0 ); -report (false,"system-off" ); +report_fail ("system-off" );return 1 ;/* only reaches here if system-off fails */ #else return report_summary ();
arm/timer.c +1 -1
@@ -311,7 +311,7 @@ static void test_init(void) if (ptimer_unsupported && !ERRATA(7b6b46311a85)) {report_skip ("Skipping ptimer tests. Set ERRATA_7b6b46311a85=y to enable." ); }else if (ptimer_unsupported) { -report (false,"ptimer: read CNTP_CTL_EL0" ); +report_fail ("ptimer: read CNTP_CTL_EL0" );report_info ("ptimer: skipping remaining tests" ); }
s390x/css.c +9 -9
@@ -34,7 +34,7 @@ static void test_enumerate(void)report (1 ,"Schid of first I/O device: 0x%08x" , test_device_sid);return ; } -report (0 ,"No I/O device found" ); +report_fail ("No I/O device found" ); }static void test_enable (void )
@@ -69,8 +69,8 @@ static void test_sense(void) ret =css_enable (test_device_sid,IO_SCH_ISC );if (ret) { -report (0 ,"Could not enable the subchannel: %08x" , - test_device_sid); +report_fail ("Could not enable the subchannel: %08x" , + test_device_sid);return ; }
@@ -78,19 +78,19 @@ static void test_sense(void) senseid =alloc_io_mem (sizeof (*senseid),0 );if (!senseid) { -report (0 ,"Allocation of senseid" ); +report_fail ("Allocation of senseid" );return ; } ccw =ccw_alloc (CCW_CMD_SENSE_ID , senseid,sizeof (*senseid),CCW_F_SLI );if (!ccw) { -report (0 ,"Allocation of CCW" ); +report_fail ("Allocation of CCW" ); goto error_ccw; } ret =start_ccw1_chain (test_device_sid, ccw);if (ret) { -report (0 ,"Starting CCW chain" ); +report_fail ("Starting CCW chain" ); goto error; }
@@ -107,14 +107,14 @@ static void test_sense(void) }else if (ret !=0 ) { len =sizeof (*senseid) - ret;if (ret && len <CSS_SENSEID_COMMON_LEN ) { -report (0 ,"transferred a too short length: %d" , ret); +report_fail ("transferred a too short length: %d" , ret); goto error; }else if (ret && len)report_info ("transferred a shorter length: %d" , len); }if (senseid->reserved !=0xff ) { -report (0 ,"transferred garbage: 0x%02x" , senseid->reserved); +report_fail ("transferred garbage: 0x%02x" , senseid->reserved); goto error; }
@@ -265,7 +265,7 @@ static void msch_with_wrong_fmt1_mbo(unsigned int schid, uint64_t mb)/* Read the SCHIB for this subchannel */ cc =stsch (schid, &schib);if (cc) { -report (0 ,"stsch: sch %08x failed with cc=%d" , schid, cc); +report_fail ("stsch: sch %08x failed with cc=%d" , schid, cc);return ; }
s390x/spec_ex.c +3 -4
@@ -129,10 +129,9 @@ static void test_spec_ex(struct args *args,register_pgm_cleanup_func (NULL ); pgm =clear_pgm_int ();if (pgm != expected_pgm) { -report (0 , -"Program interrupt: expected(%d) == received(%d)" , - expected_pgm, - pgm); +report_fail ("Program interrupt: expected(%d) == received(%d)" , + expected_pgm, + pgm);return ; } }
x86/asyncpf.c +2 -2
@@ -55,7 +55,7 @@ static void pf_isr(struct ex_regs *r)switch (reason) {case 0 : -report (false,"unexpected #PF at %#lx" ,read_cr2 ()); +report_fail ("unexpected #PF at %#lx" ,read_cr2 ());break ;case KVM_PV_REASON_PAGE_NOT_PRESENT : phys =virt_to_pte_phys (phys_to_virt (read_cr3 ()), virt);
@@ -78,7 +78,7 @@ static void pf_isr(struct ex_regs *r) phys =0 ;break ;default : -report (false,"unexpected async pf reason %" PRId32, reason); +report_fail ("unexpected async pf reason %" PRId32, reason);break ; } }
x86/hyperv_stimer.c +3 -3
@@ -96,7 +96,7 @@ static void process_stimer_msg(struct svcpu *svcpu,if (msg->header.message_type !=HVMSG_TIMER_EXPIRED && msg->header.message_type !=HVMSG_NONE ) { -report (false,"invalid Hyper-V SynIC msg type" ); +report_fail ("invalid Hyper-V SynIC msg type" );report_summary ();abort (); }
@@ -106,7 +106,7 @@ static void process_stimer_msg(struct svcpu *svcpu, }if (msg->header.payload_size <sizeof (*payload)) { -report (false,"invalid Hyper-V SynIC msg payload size" ); +report_fail ("invalid Hyper-V SynIC msg payload size" );report_summary ();abort (); }
@@ -114,7 +114,7 @@ static void process_stimer_msg(struct svcpu *svcpu,/* Now process timer expiration message */ if (payload->timer_index >=ARRAY_SIZE (svcpu->timer)) { -report (false,"invalid Hyper-V SynIC timer index" ); +report_fail ("invalid Hyper-V SynIC timer index" );report_summary ();abort (); }
x86/hyperv_synic.c +1 -1
@@ -90,7 +90,7 @@ static void synic_test_prepare(void *ctx) } r =rdmsr (HV_X64_MSR_EOM );if (r !=0 ) { -report (false,"Hyper-V SynIC test, EOM read %#" PRIx64, r); +report_fail ("Hyper-V SynIC test, EOM read %#" PRIx64, r);return ; }
x86/svm_tests.c +81 -82
451 lines not on this page · raw message
x86/vmx.c +8 -9
@@ -1112,11 +1112,10 @@ void check_ept_ad(unsigned long *pml4, u64 guest_cr3,if (!bad_pt_ad) { bad_pt_ad |= (ept_pte & (EPT_ACCESS_FLAG |EPT_DIRTY_FLAG )) != expected_pt_ad;if (bad_pt_ad) -report (false, -"EPT - guest level %d page table A=%d/D=%d" , - l, - !!(expected_pt_ad &EPT_ACCESS_FLAG ), - !!(expected_pt_ad &EPT_DIRTY_FLAG )); +report_fail ("EPT - guest level %d page table A=%d/D=%d" , + l, + !!(expected_pt_ad &EPT_ACCESS_FLAG ), + !!(expected_pt_ad &EPT_DIRTY_FLAG )); } pte = pt[offset];
@@ -1137,7 +1136,7 @@ void check_ept_ad(unsigned long *pml4, u64 guest_cr3, gpa = (pt[offset] &PT_ADDR_MASK ) | (guest_addr & offset_in_page);if (!get_ept_pte (pml4, gpa,1 , &ept_pte)) { -report (false,"EPT - guest physical address is not mapped" ); +report_fail ("EPT - guest physical address is not mapped" );return ; } report((ept_pte & (EPT_ACCESS_FLAG | EPT_DIRTY_FLAG)) == expected_gpa_ad,
@@ -1883,7 +1882,7 @@ static int test_run(struct vmx_test *test)int ret =0 ;if (test->init || test->guest_main || test->exit_handler || test->syscall_handler) { -report (0 ,"V2 test cannot specify V1 callbacks." ); +report_fail ("V2 test cannot specify V1 callbacks." ); ret =1 ; }if (ret)
@@ -1928,7 +1927,7 @@ static int test_run(struct vmx_test *test)run_teardown_step (&teardown_steps[--teardown_count]);if (launched && !guest_finished) -report (0 ,"Guest didn't run to completion." ); +report_fail ("Guest didn't run to completion." ); out:if (vmx_off ()) {
@@ -2123,7 +2122,7 @@ int main(int argc, const char *argv[]) goto exit; }else {if (vmx_on ()) { -report (0 ,"vmxon" ); +report_fail ("vmxon" ); goto exit; } }
x86/vmx_tests.c +65 -71
463 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [kvm-unit-tests PATCH v2 4/5] Use report_fail(...) instead of report(0/false, ...)
Quoted 18 lines · Janis Schoetterl-Glausch
Whitespace is kept consistent with the rest of the file.
Signed-off-by Janis Schoetterl-Glausch <[email protected]>--- lib/s390x/css_lib.c | 30 ++++---- x86/vmx.h | 25 ++++--- arm/psci.c | 2 +- arm/timer.c | 2 +- s390x/css.c | 18 ++--- s390x/spec_ex.c | 7 +- x86/asyncpf.c | 4 +- x86/hyperv_stimer.c | 6 +- x86/hyperv_synic.c | 2 +- x86/svm_tests.c | 163 ++++++++++++++++++++++---------------------- x86/vmx.c | 17 +++-- x86/vmx_tests.c | 136 ++++++++++++++++++------------------ 12 files changed, 200 insertions(+), 212 deletions(-)
Hi Janis,
Thank you for this cleanup.
Re: [kvm-unit-tests PATCH v2 4/5] Use report_fail(...) instead of report(0/false, ...)
In reply to Janis Schoetterl-GlauschQuoted 17 lines · Janis Schoetterl-Glausch
Whitespace is kept consistent with the rest of the file.
Signed-off-by Janis Schoetterl-Glausch <[email protected]>--- lib/s390x/css_lib.c | 30 ++++---- x86/vmx.h | 25 ++++--- arm/psci.c | 2 +- arm/timer.c | 2 +- s390x/css.c | 18 ++--- s390x/spec_ex.c | 7 +- x86/asyncpf.c | 4 +- x86/hyperv_stimer.c | 6 +- x86/hyperv_synic.c | 2 +- x86/svm_tests.c | 163 ++++++++++++++++++++++---------------------- x86/vmx.c | 17 +++-- x86/vmx_tests.c | 136 ++++++++++++++++++------------------ 12 files changed, 200 insertions(+), 212 deletions(-)
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v2 5/5 Use report_pass(...) instead of report(1/true, ...)
In reply to a message not in the archiveWhitespace is kept consistent with the rest of the file.
--- s390x/css.c | 4 ++-- s390x/diag288.c | 2 +- s390x/selftest.c | 2 +- s390x/smp.c | 16 ++++++++-------- s390x/spec_ex.c | 7 +++---- x86/asyncpf.c | 7 +++---- x86/emulator.c | 2 +- x86/hyperv_stimer.c | 18 ++++++++---------- x86/svm_tests.c | 17 ++++++++--------- x86/syscall.c | 2 +- x86/taskswitch2.c | 2 +- x86/tsc_adjust.c | 2 +- x86/vmx.c | 6 +++--- x86/vmx_tests.c | 36 ++++++++++++++++++------------------ 14 files changed, 59 insertions(+), 64 deletions(-)
s390x/css.c +2 -2
@@ -31,7 +31,7 @@ static void test_enumerate(void) { test_device_sid =css_enumerate ();if (test_device_sid &SCHID_ONE ) { -report (1 ,"Schid of first I/O device: 0x%08x" , test_device_sid); +report_pass ("Schid of first I/O device: 0x%08x" , test_device_sid);return ; }report_fail ("No I/O device found" );
@@ -178,7 +178,7 @@ static void test_schm(void)/* Normal operation */ report_prefix_push ("Normal operation" );schm (NULL ,SCHM_MBU ); -report (1 ,"SCHM call without address" ); +report_pass ("SCHM call without address" );report_prefix_pop (); }
s390x/diag288.c +1 -1
@@ -99,7 +99,7 @@ static void test_bite(void)"0: nop\n" " j 0b\n" "1:"); -report (true,"restart" ); +report_pass ("restart" ); }int main (void )
s390x/selftest.c +1 -1
@@ -78,7 +78,7 @@ int main(int argc, char**argv) {report_prefix_push ("selftest" ); -report (true,"true" ); +report_pass ("true" );report (argc ==3 ,"argc == 3" );report (!strcmp (argv[0 ],"s390x/selftest.elf" ),"argv[0] == PROGNAME" );report (!strcmp (argv[1 ],"test" ),"argv[1] == test" );
s390x/smp.c +8 -8
@@ -47,7 +47,7 @@ static void test_start(void)set_flag (0 );smp_cpu_start (1 , psw);wait_for_flag (); -report (1 ,"start" ); +report_pass ("start" ); }/*
@@ -75,7 +75,7 @@ static void test_restart(void)set_flag (0 );smp_cpu_restart (1 );wait_for_flag (); -report (1 ,"restart while running" ); +report_pass ("restart while running" ); }static void test_stop (void )
@@ -87,7 +87,7 @@ static void test_stop(void)* implementation */ while (!smp_cpu_stopped (1 )) {} -report (1 ,"stop" ); +report_pass ("stop" ); }static void test_stop_store_status (void )
@@ -140,7 +140,7 @@ static void test_store_status(void)smp_cpu_stop (1 );sigp (1 ,SIGP_STORE_STATUS_AT_ADDRESS , (uintptr_t )status,NULL );while (!status->prefix) {mb (); } -report (1 ,"status written" ); +report_pass ("status written" );free_pages (status);report_prefix_pop ();smp_cpu_stop (1 );
@@ -160,7 +160,7 @@ static void ecall(void)load_psw_mask (mask);set_flag (1 );while (lc->ext_int_code !=0x1202 ) {mb (); } -report (1 ,"received" ); +report_pass ("received" );set_flag (1 ); }
@@ -194,7 +194,7 @@ static void emcall(void)load_psw_mask (mask);set_flag (1 );while (lc->ext_int_code !=0x1201 ) {mb (); } -report (1 ,"received" ); +report_pass ("received" );set_flag (1 ); }
@@ -225,7 +225,7 @@ static void test_sense_running(void)smp_cpu_stop (1 );/* Make sure to have at least one time with a not running indication */ while (smp_sense_running_status (1 )); -report (true,"CPU1 sense claims not running" ); +report_pass ("CPU1 sense claims not running" );report_prefix_pop (); }
@@ -310,7 +310,7 @@ static void test_reset(void) psw.addr = (unsigned long )test_local_ints;smp_cpu_start (1 , psw);wait_for_flag (); -report (true,"local interrupts cleared" ); +report_pass ("local interrupts cleared" );report_prefix_pop (); }
s390x/spec_ex.c +3 -4
@@ -135,10 +135,9 @@ static void test_spec_ex(struct args *args,return ; } } -report (1 , -"Program interrupt: always expected(%d) == received(%d)" , - expected_pgm, - expected_pgm); +report_pass ("Program interrupt: always expected(%d) == received(%d)" , + expected_pgm, + expected_pgm); }#define TRANSACTION_COMPLETED 4
x86/asyncpf.c +3 -4
@@ -61,16 +61,15 @@ static void pf_isr(struct ex_regs *r) phys =virt_to_pte_phys (phys_to_virt (read_cr3 ()), virt);install_pte (phys_to_virt (read_cr3 ()),1 , virt, phys,0 );write_cr3 (read_cr3 ()); -report (true, -"Got not present #PF token %lx virt addr %p phys addr %#" PRIx64, -read_cr2 (), virt, phys); +report_pass ("Got not present #PF token %lx virt addr %p phys addr %#" PRIx64, +read_cr2 (), virt, phys);while (phys) {safe_halt ();/* enables irq */ irq_disable (); }break ;case KVM_PV_REASON_PAGE_READY : -report (true,"Got present #PF token %lx" ,read_cr2 ()); +report_pass ("Got present #PF token %lx" ,read_cr2 ());if ((uint32_t )read_cr2 () == ~0 )break ;install_pte (phys_to_virt (read_cr3 ()),1 , virt, phys |PT_PRESENT_MASK |PT_WRITABLE_MASK ,0 );
x86/emulator.c +1 -1
@@ -268,7 +268,7 @@ static void test_pop(void *mem)"1: mov %[tmp], %%rsp" : [tmp]"=&r"(tmp) : [stack_top]"r"(stack_top) : "memory"); - report(1 ,"ret" ); + report_pass("ret" ); stack_top[-1 ] =0x778899 ; asm volatile("mov %[stack_top], %%r8 \n\t"
x86/hyperv_stimer.c +8 -10
@@ -234,7 +234,7 @@ static void stimer_test_periodic(int vcpu, struct stimer *timer1, (atomic_read(&timer2->fire_count) < 1000)) {pause (); } -report (true,"Hyper-V SynIC periodic timers test vcpu %d" , vcpu); +report_pass ("Hyper-V SynIC periodic timers test vcpu %d" , vcpu);stimer_shutdown (timer1);stimer_shutdown (timer2); }
@@ -246,7 +246,7 @@ static void stimer_test_one_shot(int vcpu, struct stimer *timer)while (atomic_read (&timer->fire_count) <1 ) {pause (); } -report (true,"Hyper-V SynIC one-shot test vcpu %d" , vcpu); +report_pass ("Hyper-V SynIC one-shot test vcpu %d" , vcpu);stimer_shutdown (timer); }
@@ -257,8 +257,7 @@ static void stimer_test_auto_enable_one_shot(int vcpu, struct stimer *timer)while (atomic_read (&timer->fire_count) <1 ) {pause (); } -report (true,"Hyper-V SynIC auto-enable one-shot timer test vcpu %d" , - vcpu); +report_pass ("Hyper-V SynIC auto-enable one-shot timer test vcpu %d" , vcpu);stimer_shutdown (timer); }
@@ -269,8 +268,7 @@ static void stimer_test_auto_enable_periodic(int vcpu, struct stimer *timer)while (atomic_read (&timer->fire_count) <1000 ) {pause (); } -report (true,"Hyper-V SynIC auto-enable periodic timer test vcpu %d" , - vcpu); +report_pass ("Hyper-V SynIC auto-enable periodic timer test vcpu %d" , vcpu);stimer_shutdown (timer); }
@@ -298,7 +296,7 @@ static void stimer_test_one_shot_busy(int vcpu, struct stimer *timer)while (atomic_read (&timer->fire_count) <1 ) {pause (); } -report (true,"timer resumed when msg slot released: vcpu %d" , vcpu); +report_pass ("timer resumed when msg slot released: vcpu %d" , vcpu);stimer_shutdown (timer); }
@@ -355,17 +353,17 @@ int main(int ac, char **av) {if (!synic_supported ()) { -report (true,"Hyper-V SynIC is not supported" ); +report_pass ("Hyper-V SynIC is not supported" ); goto done; }if (!stimer_supported ()) { -report (true,"Hyper-V SynIC timers are not supported" ); +report_pass ("Hyper-V SynIC timers are not supported" ); goto done; }if (!hv_time_ref_counter_supported ()) { -report (true,"Hyper-V time reference counter is not supported" ); +report_pass ("Hyper-V time reference counter is not supported" ); goto done; }
x86/svm_tests.c +8 -9
@@ -1441,7 +1441,7 @@ static bool nmi_finished(struct svm_test *test)return true; } -report (true,"NMI intercept while running guest" ); +report_pass ("NMI intercept while running guest" );break ;case 2 :
@@ -1543,7 +1543,7 @@ static bool nmi_hlt_finished(struct svm_test *test)return true; } -report (true,"NMI intercept while running guest" ); +report_pass ("NMI intercept while running guest" );break ;case 3 :
@@ -1844,9 +1844,8 @@ static void reg_corruption_test(struct svm_test *test)static bool reg_corruption_finished (struct svm_test *test) {if (isr_cnt ==10000 ) { -report (true, -"No RIP corruption detected after %d timer interrupts" , - isr_cnt); +report_pass ("No RIP corruption detected after %d timer interrupts" , + isr_cnt);set_test_stage (test,1 );return true; }
@@ -1950,7 +1949,7 @@ static bool init_intercept_finished(struct svm_test *test) init_intercept = true; -report (true,"INIT to vcpu intercepted" ); +report_pass ("INIT to vcpu intercepted" );return true; }
@@ -2811,7 +2810,7 @@ static void svm_vmrun_errata_test(void)unsigned long *page =alloc_pages (1 );if (!page) { -report (true,"All guest memory tested, no bug found" );; +report_pass ("All guest memory tested, no bug found" );break ; }
@@ -2940,7 +2939,7 @@ static bool vgif_finished(struct svm_test *test) vmcb->control.int_ctl &= ~V_GIF_ENABLED_MASK ;return true; } -report (true,"STGI set VGIF bit." ); +report_pass ("STGI set VGIF bit." ); vmcb->save.rip +=3 ;inc_test_stage (test);break ;
@@ -2954,7 +2953,7 @@ static bool vgif_finished(struct svm_test *test) vmcb->control.int_ctl &= ~V_GIF_ENABLED_MASK ;return true; } -report (true,"CLGI cleared VGIF bit." ); +report_pass ("CLGI cleared VGIF bit." ); vmcb->save.rip +=3 ;inc_test_stage (test); vmcb->control.int_ctl &= ~V_GIF_ENABLED_MASK ;
x86/syscall.c +1 -1
@@ -18,7 +18,7 @@ static void test_syscall_lazy_load(void) asmvolatile ("pushf; syscall; syscall_target: popf" :"=c" (tmp) : :"r11" );write_ss (ss);// will crash horribly if broken -report (true,"MSR_*STAR eager loading" ); +report_pass ("MSR_*STAR eager loading" ); }/*
x86/taskswitch2.c +1 -1
@@ -260,7 +260,7 @@ static void test_vm86_switch(void)"popf\n" "iret\n" ); -report (1 ,"VM86" ); +report_pass ("VM86" ); }#define IOPL_SHIFT 12
x86/tsc_adjust.c +1 -1
@@ -34,7 +34,7 @@ int main(void) "MSR_IA32_TSC_ADJUST msr adjustment on tsc write"); }else { -report (true,"MSR_IA32_TSC_ADJUST feature not enabled" ); +report_pass ("MSR_IA32_TSC_ADJUST feature not enabled" ); }return report_summary (); }
x86/vmx.c +3 -3
@@ -1127,9 +1127,9 @@ void check_ept_ad(unsigned long *pml4, u64 guest_cr3, }if (!bad_pt_ad) -report (true,"EPT - guest page table structures A=%d/D=%d" , - !!(expected_pt_ad &EPT_ACCESS_FLAG ), - !!(expected_pt_ad &EPT_DIRTY_FLAG )); +report_pass ("EPT - guest page table structures A=%d/D=%d" , + !!(expected_pt_ad &EPT_ACCESS_FLAG ), + !!(expected_pt_ad &EPT_DIRTY_FLAG )); offset = (guest_addr >>EPT_LEVEL_SHIFT (l)) &EPT_PGDIR_MASK ; offset_in_page = guest_addr & ((1 <<EPT_LEVEL_SHIFT (l)) -1 );
x86/vmx_tests.c +18 -18
@@ -53,7 +53,7 @@ static inline void vmcall(void)static void basic_guest_main (void ) { -report (1 ,"Basic VMX test" ); +report_pass ("Basic VMX test" ); }static int basic_exit_handler (union exit_reason exit_reason)
@@ -68,7 +68,7 @@ static void vmenter_main(void)u64 rax;u64 rsp, resume_rsp; -report (1 ,"test vmlaunch" ); +report_pass ("test vmlaunch" ); asmvolatile ( "mov %%rsp, %0\n\t"
@@ -1184,9 +1184,9 @@ static void ept_common(void)if (vmx_get_test_stage () ==1 ) {if (*((u32 *)data_page1) ==MAGIC_VAL_3 && *((u32 *)data_page2) ==MAGIC_VAL_2 ) -report (1 ,"EPT basic framework" ); +report_pass ("EPT basic framework" );else -report (1 ,"EPT basic framework - remap" ); +report_pass ("EPT basic framework - remap" ); } }// Test EPT Misconfigurations
@@ -1897,7 +1897,7 @@ static int nmi_hlt_exit_handler(union exit_reason exit_reason)print_vmexit_info (exit_reason);return VMX_TEST_VMEXIT ; } -report (true,"NMI intercept while running guest" ); +report_pass ("NMI intercept while running guest" );vmcs_write (GUEST_ACTV_STATE ,ACTV_ACTIVE );break ;
@@ -2156,12 +2156,12 @@ static void disable_rdtscp_ud_handler(struct ex_regs *regs) {switch (vmx_get_test_stage ()) {case 0 : -report (true,"RDTSCP triggers #UD" ); +report_pass ("RDTSCP triggers #UD" );vmx_inc_test_stage (); regs->rip +=3 ;break ;case 2 : -report (true,"RDPID triggers #UD" ); +report_pass ("RDPID triggers #UD" );vmx_inc_test_stage (); regs->rip +=4 ;break ;
@@ -2328,7 +2328,7 @@ static void v2_null_test(void) {test_set_guest (v2_null_test_guest);enter_guest (); -report (1 , __func__); +report_pass (__func__); }static void v2_multiple_entries_test_guest (void )
@@ -2346,7 +2346,7 @@ static void v2_multiple_entries_test(void)skip_exit_vmcall ();enter_guest ();TEST_ASSERT_EQ (vmx_get_test_stage (),2 ); -report (1 , __func__); +report_pass (__func__); }static int fixture_test_data =1 ;
@@ -2377,7 +2377,7 @@ static void fixture_test_case1(void)TEST_ASSERT_EQ (2 , fixture_test_data);enter_guest ();TEST_ASSERT_EQ (3 , fixture_test_data); -report (1 , __func__); +report_pass (__func__); }static void fixture_test_case2 (void )
@@ -2386,7 +2386,7 @@ static void fixture_test_case2(void)TEST_ASSERT_EQ (2 , fixture_test_data);enter_guest ();TEST_ASSERT_EQ (3 , fixture_test_data); -report (1 , __func__); +report_pass (__func__); }enum ept_access_op {
@@ -6971,7 +6971,7 @@ static void test_x2apic_wr( got, val);apic_write (reg, restore_val); }else { -report (true,"non-virtualized and write-only OK" ); +report_pass ("non-virtualized and write-only OK" ); } }skip_exit_insn ();
@@ -9581,7 +9581,7 @@ static void vmx_eoi_bitmap_ioapic_scan_test(void)/* Let L2 finish */ enter_guest (); -report (1 , __func__); +report_pass (__func__); }#define HLT_WITH_RVI_VECTOR (0xf1)
@@ -9709,7 +9709,7 @@ static void vmx_apic_passthrough(bool set_irq_line_from_thread)/* Let L2 finish */ enter_guest (); -report (1 , __func__); +report_pass (__func__); }static void vmx_apic_passthrough_test (void )
@@ -9761,7 +9761,7 @@ static void vmx_apic_passthrough_tpr_threshold_test(void) asmvolatile ("nop" );report (vmx_apic_passthrough_tpr_threshold_ipi_isr_fired,"self-IPI fired" ); -report (1 , __func__); +report_pass (__func__); }static u64 init_signal_test_exit_reason;
@@ -9958,7 +9958,7 @@ static void vmx_sipi_test_guest(void)/* First SIPI signal */ apic_icr_write (APIC_DEST_PHYSICAL |APIC_DM_STARTUP |APIC_INT_ASSERT , id_map[1 ]); -report (1 ,"BSP(L2): Send first SIPI to cpu[%d]" , id_map[1 ]); +report_pass ("BSP(L2): Send first SIPI to cpu[%d]" , id_map[1 ]);/* wait AP enter guest */ while (vmx_get_test_stage () !=2 )
@@ -9967,7 +9967,7 @@ static void vmx_sipi_test_guest(void)/* Second SIPI signal should be ignored since AP is not in WAIT_SIPI state */ apic_icr_write (APIC_DEST_PHYSICAL |APIC_DM_STARTUP |APIC_INT_ASSERT , id_map[1 ]); -report (1 ,"BSP(L2): Send second SIPI to cpu[%d]" , id_map[1 ]); +report_pass ("BSP(L2): Send second SIPI to cpu[%d]" , id_map[1 ]);/* Delay a while to check whether second SIPI would cause VMExit */ delay (SIPI_SIGNAL_TEST_DELAY );
@@ -10025,7 +10025,7 @@ static void sipi_test_ap_thread(void *data)enter_guest ();if (vmcs_read (EXI_REASON ) ==VMX_SIPI ) { -report (1 ,"AP: Handle SIPI VMExit" ); +report_pass ("AP: Handle SIPI VMExit" );vmcs_write (GUEST_ACTV_STATE ,ACTV_ACTIVE );vmx_set_test_stage (2 ); }else {
Signature · 1 line
2.31.1
Re: [kvm-unit-tests PATCH v2 5/5] Use report_pass(...) instead of report(1/true, ...)
Quoted 19 lines · Janis Schoetterl-Glausch
Whitespace is kept consistent with the rest of the file.
Signed-off-by Janis Schoetterl-Glausch <[email protected]>--- s390x/css.c | 4 ++-- s390x/diag288.c | 2 +- s390x/selftest.c | 2 +- s390x/smp.c | 16 ++++++++-------- s390x/spec_ex.c | 7 +++---- x86/asyncpf.c | 7 +++---- x86/emulator.c | 2 +- x86/hyperv_stimer.c | 18 ++++++++---------- x86/svm_tests.c | 17 ++++++++--------- x86/syscall.c | 2 +- x86/taskswitch2.c | 2 +- x86/tsc_adjust.c | 2 +- x86/vmx.c | 6 +++--- x86/vmx_tests.c | 36 ++++++++++++++++++------------------ 14 files changed, 59 insertions(+), 64 deletions(-)
Re: [kvm-unit-tests PATCH v2 5/5] Use report_pass(...) instead of report(1/true, ...)
In reply to Janis Schoetterl-GlauschQuoted 25 lines · Janis Schoetterl-Glausch
Whitespace is kept consistent with the rest of the file.
Signed-off-by Janis Schoetterl-Glausch <[email protected]>--- s390x/css.c | 4 ++-- s390x/diag288.c | 2 +- s390x/selftest.c | 2 +- s390x/smp.c | 16 ++++++++-------- s390x/spec_ex.c | 7 +++---- x86/asyncpf.c | 7 +++---- x86/emulator.c | 2 +- x86/hyperv_stimer.c | 18 ++++++++---------- x86/svm_tests.c | 17 ++++++++--------- x86/syscall.c | 2 +- x86/taskswitch2.c | 2 +- x86/tsc_adjust.c | 2 +- x86/vmx.c | 6 +++--- x86/vmx_tests.c | 36 ++++++++++++++++++------------------ 14 files changed, 59 insertions(+), 64 deletions(-)s390x/css.c +0
-0
s390x/css.c static void test_enumerate(void) · line 36
Quoted 7 lines
s390x/css.c +1
-1@@ -31,7 +31,7 @@ static void test_enumerate(void) { test_device_sid =css_enumerate ();if (test_device_sid &SCHID_ONE ) { -report (1 ,"Schid of first I/O device: 0x%08x" , test_device_sid); +report_pass ("Schid of first I/O device: 0x%08x" , test_device_sid);return ; }
...
Thanks, I've applied patches 3 - 5 now to the repository, since there were no objections and they are independent from your spec_ex work. (Dropped the hunk to spec_ex.c here of course, so please integrate that in the next version of that patch directly instead).
Thomas
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thomas Huth
AppliedRe: [kvm-unit-tests PATCH v2 0/5] Add specification exception tests
Quoted 75 lines · Janis Schoetterl-Glausch
Quoted 10 lines · Thomas Huth
Quoted 7 lines · Janis Schoetterl-Glausch
Test that specification exceptions cause the correct interruption code during both normal and transactional execution.
The last three patches are cosmetic only and could be dropped.
Unrelated: There should not be * in the file patterns in
MAINTAINERS, should there?I think those could be dropped, indeed. Care to send a patch?
You mean the * patterns, not the cosmetic patches, correct?
-- >8 --
Subject: [kvm-unit-tests PATCH]MAINTAINERS: Include subdirectories in file
patternsThe * pattern does not cover subdirectories, so get_maintainer.pl does not know who maintains e.g. lib/<arch>/asm/*.
Signed-off-by Janis Schoetterl-Glausch <[email protected]>--- MAINTAINERS | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)MAINTAINERS +10
-10@@ -68,9 +68,9 @@ M: Andrew Jones <[email protected]> S: Supported L: [email protected] L: [email protected] -F: arm/* -F: lib/arm/* -F: lib/arm64/* +F: arm/ +F: lib/arm/ +F: lib/arm64/ T: https://gitlab.com/rhdrjones/kvm-unit-tests.git POWERPC@@ -79,9 +79,9 @@ M: Thomas Huth <[email protected]> S: Maintained L: [email protected] L: [email protected] -F: powerpc/* -F: lib/powerpc/* -F: lib/ppc64/* +F: powerpc/ +F: lib/powerpc/ +F: lib/ppc64/ S390X M: Thomas Huth <[email protected]>@@ -92,13 +92,13 @@ R: Claudio Imbrenda <[email protected]> R: David Hildenbrand <[email protected]> L: [email protected] L: [email protected] -F: s390x/* -F: lib/s390x/* +F: s390x/ +F: lib/s390x/ X86 M: Paolo Bonzini <[email protected]> S: Supported L: [email protected] -F: x86/* -F: lib/x86/* +F: x86/ +F: lib/x86/ T: https://gitlab.com/bonzini/kvm-unit-tests.git
Quoted 2 lines
base-commit:
fe26131eec769cef7ad7e2e1e4e192aa0bdb2bba
Thanks, applied.
Thomas