Re: [kvm-unit-tests PATCH 7/7] x86: VMX: the "noclone" attribute is gcc-specific

Oliver Upton
2020-02-28T18:20:13Z

On Fri, Feb 28, 2020 at 3:16 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 26/02/20 10:44, Bill Wendling wrote:
> > Don't use the "noclone" attribute for clang as it's not supported.
> >
> > Signed-off-by: Bill Wendling <morbo@google.com>
> > ---
> > x86/vmx_tests.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> > index ad8c002..ec88016 100644
> > --- a/x86/vmx_tests.c
> > +++ b/x86/vmx_tests.c
> > @@ -4976,7 +4976,10 @@ extern unsigned char test_mtf1;
> > extern unsigned char test_mtf2;
> > extern unsigned char test_mtf3;
> >
> > -__attribute__((noclone)) static void test_mtf_guest(void)
> > +#ifndef __clang__
> > +__attribute__((noclone))
> > +#endif
> > +static void test_mtf_guest(void)
> > {
> > asm ("vmcall;\n\t"
> > "out %al, $0x80;\n\t"
> >
>
> It's not needed at all, let's drop it.
>
> Paolo
>

If we wanted to be absolutely certain that the extern labels used for
assertions about the guest RIP are correct, we may still want it.
Alternatively, I could rewrite the test such that the guest will
report the instruction boundary where it anticipates MTF whenever it
makes the vmcall to request the host turns on MTF.

--
Thanks,
Oliver