diff options
| author | Sean Christopherson <seanjc@google.com> | 2026-07-31 12:56:08 -0700 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-07-31 13:54:47 -0700 |
| commit | 5171573ce7cbaaaa3a02879a369f5884e3906710 (patch) | |
| tree | dec09d533231fb96816bab9d117c5f2872bde0a2 /tools/testing/selftests/kvm/arch_timer.c | |
| parent | bb0e7d84c4be5edfea15970762dc02bfedcab565 (diff) | |
KVM: selftests: Add KVM syscall wrapper for pthread_create()
Add and use a KVM wrapper for pthread_create() syscall so that selftests
don't need to manually assert that the syscall succeeded.
Note, most tests don't actually assert success, but they all obviously
rely on the syscall to succeed.
Other than explicitly failing if pthread_create() fails, no functional
change intended.
Link: https://patch.msgid.link/20260731195612.2697986-9-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm/arch_timer.c')
| -rw-r--r-- | tools/testing/selftests/kvm/arch_timer.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/tools/testing/selftests/kvm/arch_timer.c b/tools/testing/selftests/kvm/arch_timer.c index f8b02597897b..a6a66b5b7ea9 100644 --- a/tools/testing/selftests/kvm/arch_timer.c +++ b/tools/testing/selftests/kvm/arch_timer.c @@ -141,28 +141,22 @@ static void test_run(struct kvm_vm *vm) { pthread_t pt_vcpu_migration; unsigned int i; - int ret; pthread_mutex_init(&vcpu_done_map_lock, NULL); vcpu_done_map = bitmap_zalloc(test_args.nr_vcpus); TEST_ASSERT(vcpu_done_map, "Failed to allocate vcpu done bitmap"); - for (i = 0; i < (unsigned long)test_args.nr_vcpus; i++) { - ret = pthread_create(&pt_vcpu_run[i], NULL, test_vcpu_run, - (void *)(unsigned long)i); - TEST_ASSERT(!ret, "Failed to create vCPU-%d pthread", i); - } + for (i = 0; i < (unsigned long)test_args.nr_vcpus; i++) + kvm_pthread_create(&pt_vcpu_run[i], NULL, test_vcpu_run, + (void *)(unsigned long)i); /* Spawn a thread to control the vCPU migrations */ if (test_args.migration_freq_ms) { srand(time(NULL)); - ret = pthread_create(&pt_vcpu_migration, NULL, - test_vcpu_migration, NULL); - TEST_ASSERT(!ret, "Failed to create the migration pthread"); + kvm_pthread_create(&pt_vcpu_migration, NULL, test_vcpu_migration, NULL); } - for (i = 0; i < test_args.nr_vcpus; i++) pthread_join(pt_vcpu_run[i], NULL); |
