On 08/06/20 13:23, Vitaly Kuznetsov wrote: > GCC10 fails to build vmx_preemption_timer_test: > > gcc -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 > -fno-stack-protector -fno-PIE -I../../../../tools/include > -I../../../../tools/arch/x86/include -I../../../../usr/include/ > -Iinclude -Ix86_64 -Iinclude/x86_64 -I.. -pthread -no-pie > x86_64/evmcs_test.c ./linux/tools/testing/selftests/kselftest_harness.h > ./linux/tools/testing/selftests/kselftest.h > ./linux/tools/testing/selftests/kvm/libkvm.a > -o ./linux/tools/testing/selftests/kvm/x86_64/evmcs_test > /usr/bin/ld: ./linux/tools/testing/selftests/kvm/libkvm.a(vmx.o): > ./linux/tools/testing/selftests/kvm/include/x86_64/vmx.h:603: > multiple definition of `ctrl_exit_rev'; /tmp/ccMQpvNt.o: > ./linux/tools/testing/selftests/kvm/include/x86_64/vmx.h:603: > first defined here > /usr/bin/ld: ./linux/tools/testing/selftests/kvm/libkvm.a(vmx.o): > ./linux/tools/testing/selftests/kvm/include/x86_64/vmx.h:602: > multiple definition of `ctrl_pin_rev'; /tmp/ccMQpvNt.o: > ./linux/tools/testing/selftests/kvm/include/x86_64/vmx.h:602: > first defined here > ... > > ctrl_exit_rev/ctrl_pin_rev/basic variables are only used in > vmx_preemption_timer_test.c, just move them there. > > Fixes: 8d7fbf01f9af ("KVM: selftests: VMX preemption timer migration test") > Reported-by: Marcelo Bandeira Condotta <mcondotta@xxxxxxxxxx> > Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> > --- > tools/testing/selftests/kvm/include/x86_64/vmx.h | 4 ---- > .../testing/selftests/kvm/x86_64/vmx_preemption_timer_test.c | 4 ++++ > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/kvm/include/x86_64/vmx.h b/tools/testing/selftests/kvm/include/x86_64/vmx.h > index ccff3e6e2704..766af9944294 100644 > --- a/tools/testing/selftests/kvm/include/x86_64/vmx.h > +++ b/tools/testing/selftests/kvm/include/x86_64/vmx.h > @@ -598,10 +598,6 @@ union vmx_ctrl_msr { > }; > }; > > -union vmx_basic basic; > -union vmx_ctrl_msr ctrl_pin_rev; > -union vmx_ctrl_msr ctrl_exit_rev; > - > struct vmx_pages *vcpu_alloc_vmx(struct kvm_vm *vm, vm_vaddr_t *p_vmx_gva); > bool prepare_for_vmx_operation(struct vmx_pages *vmx); > void prepare_vmcs(struct vmx_pages *vmx, void *guest_rip, void *guest_rsp); > diff --git a/tools/testing/selftests/kvm/x86_64/vmx_preemption_timer_test.c b/tools/testing/selftests/kvm/x86_64/vmx_preemption_timer_test.c > index cc72b6188ca7..a7737af1224f 100644 > --- a/tools/testing/selftests/kvm/x86_64/vmx_preemption_timer_test.c > +++ b/tools/testing/selftests/kvm/x86_64/vmx_preemption_timer_test.c > @@ -31,6 +31,10 @@ bool l2_save_restore_done; > static u64 l2_vmx_pt_start; > volatile u64 l2_vmx_pt_finish; > > +union vmx_basic basic; > +union vmx_ctrl_msr ctrl_pin_rev; > +union vmx_ctrl_msr ctrl_exit_rev; > + > void l2_guest_code(void) > { > u64 vmx_pt_delta; > Queued both, thanks. Paolo