Re: [PATCH] kvm-unit-tests : The first version of VMX nested test case

Gleb Natapov
2013-07-16T15:20:40Z

On Tue, Jul 16, 2013 at 12:28:05PM +0200, Paolo Bonzini wrote:
> > +void vmx_exit(void)
> > +{
> > + test_vmxoff();
> > + printf("\nSUMMARY: %d tests, %d failures\n", tests, fails);
> > + exit(fails ? -1 : 0);
> > +}
>
> Can you try to jump back to main, and do test_vmxoff there? This will
> avoid having to write our tests in callback style, which is a pain.
> Basically something similar to setjmp/longjmp. In main:
>
> if (setjmp(jmpbuf) == 0) {
> vmx_run();
> /* Should not reach here */
> report("test vmlaunch", 0);
> }
> test_vmxoff();
>
> exit:
> printf("\nSUMMARY: %d tests, %d failures\n", tests, fails);
> return fails ? 1 : 0;
>
> In vmx_handler:
>
> case VMX_HLT:
> printf("\nVM exit.\n");
> longjmp(jmpbuf, 1);
>
Why not just make vmexit occur after vmlaunch/vmresume like KVM does. It
will make code much more straightforward and easer to follow.

--
Gleb.