Re: [PATCH 13/14] KVM: selftests: Let dirty_log_test async for dirty ring test
From: Andrew Jones
Date: Wed Feb 05 2020 - 04:48:32 EST
On Tue, Feb 04, 2020 at 09:58:41PM -0500, Peter Xu wrote:
> diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h
> index 4b78a8d3e773..e64fbfe6bbd5 100644
> --- a/tools/testing/selftests/kvm/include/kvm_util.h
> +++ b/tools/testing/selftests/kvm/include/kvm_util.h
> @@ -115,6 +115,7 @@ vm_paddr_t addr_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva);
> struct kvm_run *vcpu_state(struct kvm_vm *vm, uint32_t vcpuid);
> void vcpu_run(struct kvm_vm *vm, uint32_t vcpuid);
> int _vcpu_run(struct kvm_vm *vm, uint32_t vcpuid);
> +int __vcpu_run(struct kvm_vm *vm, uint32_t vcpuid);
> void vcpu_run_complete_io(struct kvm_vm *vm, uint32_t vcpuid);
> void vcpu_set_mp_state(struct kvm_vm *vm, uint32_t vcpuid,
> struct kvm_mp_state *mp_state);
> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
> index 25edf20d1962..5137882503bd 100644
> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
> @@ -1203,6 +1203,14 @@ int _vcpu_run(struct kvm_vm *vm, uint32_t vcpuid)
> return rc;
> }
>
> +int __vcpu_run(struct kvm_vm *vm, uint32_t vcpuid)
> +{
> + struct vcpu *vcpu = vcpu_find(vm, vcpuid);
> +
> + TEST_ASSERT(vcpu != NULL, "vcpu not found, vcpuid: %u", vcpuid);
> + return ioctl(vcpu->fd, KVM_RUN, NULL);
> +}
> +
> void vcpu_run_complete_io(struct kvm_vm *vm, uint32_t vcpuid)
> {
> struct vcpu *vcpu = vcpu_find(vm, vcpuid);
I think we should add a vcpu_get_fd(vm, vcpuid) function instead, and
then call ioctl directly from the test.
Thanks,
drew