From: Peter Xu <peterx@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
James Houghton <jthoughton@google.com>,
peterx@redhat.com, Anish Moorthy <amoorthy@google.com>
Subject: [PATCH 2/2] selftests/kvm: Allow dump per-vcpu info for uffd threads
Date: Thu, 27 Apr 2023 16:11:12 -0400 [thread overview]
Message-ID: <20230427201112.2164776-3-peterx@redhat.com> (raw)
In-Reply-To: <20230427201112.2164776-1-peterx@redhat.com>
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>
---
tools/testing/selftests/kvm/lib/userfaultfd_util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kvm/lib/userfaultfd_util.c b/tools/testing/selftests/kvm/lib/userfaultfd_util.c
index 92cef20902f1..271f63891581 100644
--- a/tools/testing/selftests/kvm/lib/userfaultfd_util.c
+++ b/tools/testing/selftests/kvm/lib/userfaultfd_util.c
@@ -70,7 +70,7 @@ static void *uffd_handler_thread_fn(void *arg)
r = read(pollfd[1].fd, &tmp_chr, 1);
TEST_ASSERT(r == 1,
"Error reading pipefd in UFFD thread\n");
- return NULL;
+ break;
}
if (!(pollfd[0].revents & POLLIN))
@@ -103,7 +103,7 @@ static void *uffd_handler_thread_fn(void *arg)
ts_diff = timespec_elapsed(start);
PER_VCPU_DEBUG("userfaulted %ld pages over %ld.%.9lds. (%f/sec)\n",
pages, ts_diff.tv_sec, ts_diff.tv_nsec,
- pages / ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / 100000000.0));
+ pages / ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / NSEC_PER_SEC));
return NULL;
}
--
2.39.1
next prev parent reply other threads:[~2023-04-27 20:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 20:11 [PATCH 0/2] selftests/kvm: Fixes for demand paging test Peter Xu
2023-04-27 20:11 ` [PATCH 1/2] selftests/kvm: Setup vcpu_alias only for minor mode test Peter Xu
2023-04-27 20:35 ` James Houghton
2023-04-27 20:11 ` Peter Xu [this message]
2023-04-27 20:34 ` [PATCH 2/2] selftests/kvm: Allow dump per-vcpu info for uffd threads James Houghton
2023-06-02 1:23 ` [PATCH 0/2] selftests/kvm: Fixes for demand paging test Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230427201112.2164776-3-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=amoorthy@google.com \
--cc=jthoughton@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox