Message ID | 20220915000448.1674802-6-vannapurve@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Execute hypercalls from guests according to cpu type | expand |
On Thu, Sep 15, 2022 at 12:04:45AM +0000, Vishal Annapurve wrote: > svm_vmcall_test is superseded by fix_hypercall_test. Please provide a more detailed description of why svm_vmcall_test is being dropped. e.g. What do you mean by "superseded" specifically? I ask because this will be helpful context for future readers of this commit. I also ask because it's not clear to me that fix_hypercall_test is a 1:1 replacement of svm_vmcall_test. e.g. svm_vmcall_test sets up an L2 while fix_hypercall_test just executes in L1. > > Suggested-by: Sean Christopherson <seanjc@google.com> > Signed-off-by: Vishal Annapurve <vannapurve@google.com> > --- > tools/testing/selftests/kvm/.gitignore | 1 - > .../selftests/kvm/x86_64/svm_vmcall_test.c | 74 ------------------- > 2 files changed, 75 deletions(-) > delete mode 100644 tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c > > diff --git a/tools/testing/selftests/kvm/.gitignore b/tools/testing/selftests/kvm/.gitignore > index d625a3f83780..22e9a5b5488c 100644 > --- a/tools/testing/selftests/kvm/.gitignore > +++ b/tools/testing/selftests/kvm/.gitignore > @@ -36,7 +36,6 @@ > /x86_64/sev_migrate_tests > /x86_64/smm_test > /x86_64/state_test > -/x86_64/svm_vmcall_test > /x86_64/svm_int_ctl_test > /x86_64/svm_nested_soft_inject_test > /x86_64/sync_regs_test > diff --git a/tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c b/tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c > deleted file mode 100644 > index c3ac45df7483..000000000000 > --- a/tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c > +++ /dev/null > @@ -1,74 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0-only > -/* > - * svm_vmcall_test > - * > - * Copyright (C) 2020, Red Hat, Inc. > - * > - * Nested SVM testing: VMCALL > - */ > - > -#include "test_util.h" > -#include "kvm_util.h" > -#include "processor.h" > -#include "svm_util.h" > - > -static void l2_guest_code(struct svm_test_data *svm) > -{ > - __asm__ __volatile__("vmcall"); > -} > - > -static void l1_guest_code(struct svm_test_data *svm) > -{ > - #define L2_GUEST_STACK_SIZE 64 > - unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE]; > - struct vmcb *vmcb = svm->vmcb; > - > - /* Prepare for L2 execution. */ > - generic_svm_setup(svm, l2_guest_code, > - &l2_guest_stack[L2_GUEST_STACK_SIZE]); > - > - run_guest(vmcb, svm->vmcb_gpa); > - > - GUEST_ASSERT(vmcb->control.exit_code == SVM_EXIT_VMMCALL); > - GUEST_DONE(); > -} > - > -int main(int argc, char *argv[]) > -{ > - struct kvm_vcpu *vcpu; > - vm_vaddr_t svm_gva; > - struct kvm_vm *vm; > - > - TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM)); > - > - vm = vm_create_with_one_vcpu(&vcpu, l1_guest_code); > - > - vcpu_alloc_svm(vm, &svm_gva); > - vcpu_args_set(vcpu, 1, svm_gva); > - > - for (;;) { > - volatile struct kvm_run *run = vcpu->run; > - struct ucall uc; > - > - vcpu_run(vcpu); > - TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, > - "Got exit_reason other than KVM_EXIT_IO: %u (%s)\n", > - run->exit_reason, > - exit_reason_str(run->exit_reason)); > - > - switch (get_ucall(vcpu, &uc)) { > - case UCALL_ABORT: > - REPORT_GUEST_ASSERT(uc); > - /* NOT REACHED */ > - case UCALL_SYNC: > - break; > - case UCALL_DONE: > - goto done; > - default: > - TEST_FAIL("Unknown ucall 0x%lx.", uc.cmd); > - } > - } > -done: > - kvm_vm_free(vm); > - return 0; > -} > -- > 2.37.2.789.g6183377224-goog >
On Wed, Sep 21, 2022 at 2:34 PM David Matlack <dmatlack@google.com> wrote: > > On Thu, Sep 15, 2022 at 12:04:45AM +0000, Vishal Annapurve wrote: > > svm_vmcall_test is superseded by fix_hypercall_test. > > Please provide a more detailed description of why svm_vmcall_test is > being dropped. e.g. What do you mean by "superseded" specifically? > > I ask because this will be helpful context for future readers of this > commit. I also ask because it's not clear to me that fix_hypercall_test > is a 1:1 replacement of svm_vmcall_test. e.g. svm_vmcall_test sets up an > L2 while fix_hypercall_test just executes in L1. > You are right, I earlier wrongly interpreted it to be just testing vmcall, but it also does vmcall from L2. I will exclude this change in the next series. > > > > Suggested-by: Sean Christopherson <seanjc@google.com> > > Signed-off-by: Vishal Annapurve <vannapurve@google.com> > > --- > > -- > > 2.37.2.789.g6183377224-goog > >
diff --git a/tools/testing/selftests/kvm/.gitignore b/tools/testing/selftests/kvm/.gitignore index d625a3f83780..22e9a5b5488c 100644 --- a/tools/testing/selftests/kvm/.gitignore +++ b/tools/testing/selftests/kvm/.gitignore @@ -36,7 +36,6 @@ /x86_64/sev_migrate_tests /x86_64/smm_test /x86_64/state_test -/x86_64/svm_vmcall_test /x86_64/svm_int_ctl_test /x86_64/svm_nested_soft_inject_test /x86_64/sync_regs_test diff --git a/tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c b/tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c deleted file mode 100644 index c3ac45df7483..000000000000 --- a/tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c +++ /dev/null @@ -1,74 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * svm_vmcall_test - * - * Copyright (C) 2020, Red Hat, Inc. - * - * Nested SVM testing: VMCALL - */ - -#include "test_util.h" -#include "kvm_util.h" -#include "processor.h" -#include "svm_util.h" - -static void l2_guest_code(struct svm_test_data *svm) -{ - __asm__ __volatile__("vmcall"); -} - -static void l1_guest_code(struct svm_test_data *svm) -{ - #define L2_GUEST_STACK_SIZE 64 - unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE]; - struct vmcb *vmcb = svm->vmcb; - - /* Prepare for L2 execution. */ - generic_svm_setup(svm, l2_guest_code, - &l2_guest_stack[L2_GUEST_STACK_SIZE]); - - run_guest(vmcb, svm->vmcb_gpa); - - GUEST_ASSERT(vmcb->control.exit_code == SVM_EXIT_VMMCALL); - GUEST_DONE(); -} - -int main(int argc, char *argv[]) -{ - struct kvm_vcpu *vcpu; - vm_vaddr_t svm_gva; - struct kvm_vm *vm; - - TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM)); - - vm = vm_create_with_one_vcpu(&vcpu, l1_guest_code); - - vcpu_alloc_svm(vm, &svm_gva); - vcpu_args_set(vcpu, 1, svm_gva); - - for (;;) { - volatile struct kvm_run *run = vcpu->run; - struct ucall uc; - - vcpu_run(vcpu); - TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, - "Got exit_reason other than KVM_EXIT_IO: %u (%s)\n", - run->exit_reason, - exit_reason_str(run->exit_reason)); - - switch (get_ucall(vcpu, &uc)) { - case UCALL_ABORT: - REPORT_GUEST_ASSERT(uc); - /* NOT REACHED */ - case UCALL_SYNC: - break; - case UCALL_DONE: - goto done; - default: - TEST_FAIL("Unknown ucall 0x%lx.", uc.cmd); - } - } -done: - kvm_vm_free(vm); - return 0; -}
svm_vmcall_test is superseded by fix_hypercall_test. Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Vishal Annapurve <vannapurve@google.com> --- tools/testing/selftests/kvm/.gitignore | 1 - .../selftests/kvm/x86_64/svm_vmcall_test.c | 74 ------------------- 2 files changed, 75 deletions(-) delete mode 100644 tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c