Commit 2494a6d8 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: selftests: Convert rseq_test away from VCPU_ID

Convert rseq_test to use vm_create_with_one_vcpu() and pass around a
'struct kvm_vcpu' object instead of using a global VCPU_ID.
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent e82e630b
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include "processor.h" #include "processor.h"
#include "test_util.h" #include "test_util.h"
#define VCPU_ID 0
static __thread volatile struct rseq __rseq = { static __thread volatile struct rseq __rseq = {
.cpu_id = RSEQ_CPU_ID_UNINITIALIZED, .cpu_id = RSEQ_CPU_ID_UNINITIALIZED,
}; };
...@@ -207,6 +205,7 @@ int main(int argc, char *argv[]) ...@@ -207,6 +205,7 @@ int main(int argc, char *argv[])
{ {
int r, i, snapshot; int r, i, snapshot;
struct kvm_vm *vm; struct kvm_vm *vm;
struct kvm_vcpu *vcpu;
u32 cpu, rseq_cpu; u32 cpu, rseq_cpu;
/* Tell stdout not to buffer its content */ /* Tell stdout not to buffer its content */
...@@ -228,14 +227,14 @@ int main(int argc, char *argv[]) ...@@ -228,14 +227,14 @@ int main(int argc, char *argv[])
* GUEST_SYNC, while concurrently migrating the process by setting its * GUEST_SYNC, while concurrently migrating the process by setting its
* CPU affinity. * CPU affinity.
*/ */
vm = vm_create_default(VCPU_ID, 0, guest_code); vm = vm_create_with_one_vcpu(&vcpu, guest_code);
ucall_init(vm, NULL); ucall_init(vm, NULL);
pthread_create(&migration_thread, NULL, migration_worker, 0); pthread_create(&migration_thread, NULL, migration_worker, 0);
for (i = 0; !done; i++) { for (i = 0; !done; i++) {
vcpu_run(vm, VCPU_ID); vcpu_run(vm, vcpu->id);
TEST_ASSERT(get_ucall(vm, VCPU_ID, NULL) == UCALL_SYNC, TEST_ASSERT(get_ucall(vm, vcpu->id, NULL) == UCALL_SYNC,
"Guest failed?"); "Guest failed?");
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment