Skip to content

Commit 21912a6

Browse files
xzpetersean-jc
authored andcommitted
KVM: selftests: Allow dumping per-vcpu info for uffd threads
There's one PER_VCPU_DEBUG in per-vcpu uffd threads but it's never hit. Trigger that when quit in normal ways (kick pollfd[1]), meanwhile fix the number of nanosec calculation. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: James Houghton <jthoughton@google.com> Link: https://lore.kernel.org/r/20230427201112.2164776-3-peterx@redhat.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent ba125de commit 21912a6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tools/testing/selftests/kvm/lib/userfaultfd_util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static void *uffd_handler_thread_fn(void *arg)
7070
r = read(pollfd[1].fd, &tmp_chr, 1);
7171
TEST_ASSERT(r == 1,
7272
"Error reading pipefd in UFFD thread\n");
73-
return NULL;
73+
break;
7474
}
7575

7676
if (!(pollfd[0].revents & POLLIN))
@@ -103,7 +103,7 @@ static void *uffd_handler_thread_fn(void *arg)
103103
ts_diff = timespec_elapsed(start);
104104
PER_VCPU_DEBUG("userfaulted %ld pages over %ld.%.9lds. (%f/sec)\n",
105105
pages, ts_diff.tv_sec, ts_diff.tv_nsec,
106-
pages / ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / 100000000.0));
106+
pages / ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / NSEC_PER_SEC));
107107

108108
return NULL;
109109
}

0 commit comments

Comments
 (0)