Lines Matching +full:run +full:- +full:time

1 // SPDX-License-Identifier: GPL-2.0
3 * steal/stolen time test
9 #include <time.h>
28 /* steal_time must have 64-byte alignment */
33 GUEST_ASSERT(!(READ_ONCE(st->version) & 1)); in check_status()
34 GUEST_ASSERT(READ_ONCE(st->flags) == 0); in check_status()
35 GUEST_ASSERT(READ_ONCE(st->preempted) == 0); in check_status()
49 WRITE_ONCE(guest_stolen_time[cpu], st->steal); in guest_code()
50 version = READ_ONCE(st->version); in guest_code()
55 GUEST_ASSERT(version < READ_ONCE(st->version)); in guest_code()
56 WRITE_ONCE(guest_stolen_time[cpu], st->steal); in guest_code()
72 sync_global_to_guest(vcpu->vm, st_gva[i]); in steal_time_init()
87 pr_info(" steal: %lld\n", st->steal); in steal_time_dump()
88 pr_info(" version: %d\n", st->version); in steal_time_dump()
89 pr_info(" flags: %d\n", st->flags); in steal_time_dump()
90 pr_info(" preempted: %d\n", st->preempted); in steal_time_dump()
93 pr_info("%d", st->u8_pad[i]); in steal_time_dump()
96 pr_info("%d", st->pad[i]); in steal_time_dump()
102 /* PV_TIME_ST must have 64-byte alignment */
125 GUEST_ASSERT(READ_ONCE(st->rev) == 0); in check_status()
126 GUEST_ASSERT(READ_ONCE(st->attr) == 0); in check_status()
142 GUEST_ASSERT(status != -1); in guest_code()
149 WRITE_ONCE(guest_stolen_time[cpu], st->st_time); in guest_code()
153 WRITE_ONCE(guest_stolen_time[cpu], st->st_time); in guest_code()
169 struct kvm_vm *vm = vcpu->vm; in steal_time_init()
187 TEST_ASSERT(ret == -1 && errno == EINVAL, "Bad IPA didn't report EINVAL"); in steal_time_init()
193 TEST_ASSERT(ret == -1 && errno == EEXIST, "Set IPA twice without EEXIST"); in steal_time_init()
201 pr_info(" rev: %d\n", st->rev); in steal_time_dump()
202 pr_info(" attr: %d\n", st->attr); in steal_time_dump()
203 pr_info(" st_time: %ld\n", st->st_time); in steal_time_dump()
238 exit_reason_str(vcpu->run->exit_reason)); in run_vcpu()
255 verbose = ac > 1 && (!strncmp(av[1], "-v", 3) || !strncmp(av[1], "--verbose", 10)); in main()
264 /* Create a VM and an identity mapped memslot for the steal time structure */ in main()
273 /* Run test on each VCPU */ in main()
279 /* First VCPU run initializes steal-time */ in main()
282 /* Second VCPU run, expect guest stolen time to be <= run_delay */ in main()
288 "Expected stolen time <= %ld, got %ld", in main()
291 /* Steal time from the VCPU. The steal time thread has the same CPU affinity as the VCPUs. */ in main()
296 while (get_run_delay() - run_delay < MIN_RUN_DELAY_NS); in main()
298 run_delay = get_run_delay() - run_delay; in main()
303 /* Run VCPU again to confirm stolen time is consistent with run_delay */ in main()
306 stolen_time = guest_stolen_time[i] - stolen_time; in main()
308 "Expected stolen time >= %ld, got %ld", in main()
312 pr_info("VCPU%d: total-stolen-time=%ld test-stolen-time=%ld", i, in main()
315 pr_info(" (BONUS: guest test-stolen-time even exactly matches test-run_delay)"); in main()