Am 22/11/2022 um 17:11 schrieb Maxim Levitsky: > Move v2 tests running into test_run which allows to have code that runs the > test in one place and allows to run v2 tests on a non 0 vCPU if needed. > > Signed-off-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx> > --- Reviewed-by: Emanuele Giuseppe Esposito <eesposit@xxxxxxxxxx> > x86/svm.c | 33 +++++++++++++++++++-------------- > 1 file changed, 19 insertions(+), 14 deletions(-) > > diff --git a/x86/svm.c b/x86/svm.c > index 220bce66..2ab553a5 100644 > --- a/x86/svm.c > +++ b/x86/svm.c > @@ -106,6 +106,13 @@ int svm_vmrun(void) > > static noinline void test_run(struct svm_test *test) > { > + if (test->v2) { > + vmcb_ident(vmcb); > + v2_test = test; > + test->v2(); > + return; > + } > + > cli(); > vmcb_ident(vmcb); > > @@ -196,21 +203,19 @@ int run_svm_tests(int ac, char **av, struct svm_test *svm_tests) > continue; > if (svm_tests[i].supported && !svm_tests[i].supported()) > continue; > - if (svm_tests[i].v2 == NULL) { > - if (svm_tests[i].on_vcpu) { > - if (cpu_count() <= svm_tests[i].on_vcpu) > - continue; > - on_cpu_async(svm_tests[i].on_vcpu, (void *)test_run, &svm_tests[i]); > - while (!svm_tests[i].on_vcpu_done) > - cpu_relax(); > - } > - else > - test_run(&svm_tests[i]); > - } else { > - vmcb_ident(vmcb); > - v2_test = &(svm_tests[i]); > - svm_tests[i].v2(); > + > + if (!svm_tests[i].on_vcpu) { > + test_run(&svm_tests[i]); > + continue; > } > + > + if (cpu_count() <= svm_tests[i].on_vcpu) > + continue; > + > + on_cpu_async(svm_tests[i].on_vcpu, (void *)test_run, &svm_tests[i]); > + > + while (!svm_tests[i].on_vcpu_done) > + cpu_relax(); > } > > if (!matched) >