On Thu, Apr 06, 2023, Mathias Krause wrote: > On 05.04.23 22:51, Sean Christopherson wrote: > > Add a helper macro to dedup nSVM test code that handles fatal errors > > by reporting the failure, setting the test stage to a magic number, and > > invoking VMMCALL to bail to the host and terminate. > > > > Note, the V_TPR fails if report() is invoked. Punt on the issue for > > now as most users already report only failures, but leave a TODO for > > future developers. > > > > Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> > > --- > > x86/svm_tests.c | 127 ++++++++++++++++-------------------------------- > > 1 file changed, 42 insertions(+), 85 deletions(-) > > > > diff --git a/x86/svm_tests.c b/x86/svm_tests.c > > index 27ce47b4..e87db3fa 100644 > > --- a/x86/svm_tests.c > > +++ b/x86/svm_tests.c > > @@ -947,6 +947,21 @@ static bool lat_svm_insn_check(struct svm_test *test) > > return true; > > } > > > > +/* > > + * Report failures from SVM guest code, and on failure, set the stage to -1 and > > + * do VMMCALL to terminate the test (host side must treat -1 as "finished"). > > + * TODO: fix the tests that don't play nice with a straight report, e.g. the > > + * V_TPR test fails if report() is invoked. > > + */ > > +#define report_svm_guest(cond, test, fmt, args...) \ > > +do { \ > > + if (!(cond)) { \ > > > + report_fail("why didn't my format '" fmt "' format?", ##args);\ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Debug artifact? Should probably be this instead (making use of C99): Yes. I'm just glad I posted the PG version and not the rated R version.