From: Peter Xu <peterx@redhat.com>
To: Ben Gardon <bgardon@google.com>
Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>,
Cannon Matthews <cannonmatthews@google.com>,
Andrew Jones <drjones@redhat.com>
Subject: Re: [PATCH 2/9] KVM: selftests: Add demand paging content to the demand paging test
Date: Sun, 29 Sep 2019 15:11:57 +0800 [thread overview]
Message-ID: <20190929071157.GA8903@xz-x1> (raw)
In-Reply-To: <20190927161836.57978-3-bgardon@google.com>
On Fri, Sep 27, 2019 at 09:18:30AM -0700, Ben Gardon wrote:
> The demand paging test is currently a simple page access test which, while
> potentially useful, doesn't add much versus the existing dirty logging
> test. To improve the demand paging test, add a basic userfaultfd demand
> paging implementation.
>
> Signed-off-by: Ben Gardon <bgardon@google.com>
> ---
> .../selftests/kvm/demand_paging_test.c | 157 ++++++++++++++++++
> 1 file changed, 157 insertions(+)
>
> diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c
> index 5f214517ba1de..61ba4e6a8214a 100644
> --- a/tools/testing/selftests/kvm/demand_paging_test.c
> +++ b/tools/testing/selftests/kvm/demand_paging_test.c
> @@ -11,11 +11,14 @@
>
> #include <stdio.h>
> #include <stdlib.h>
> +#include <sys/syscall.h>
[1]
> #include <unistd.h>
> #include <time.h>
> +#include <poll.h>
> #include <pthread.h>
> #include <linux/bitmap.h>
> #include <linux/bitops.h>
> +#include <linux/userfaultfd.h>
>
> #include "test_util.h"
> #include "kvm_util.h"
> @@ -29,6 +32,8 @@
> /* Default guest test virtual memory offset */
> #define DEFAULT_GUEST_TEST_MEM 0xc0000000
>
> +#define __NR_userfaultfd 323
This line can be dropped if with [1] above?
[...]
> +static void *uffd_handler_thread_fn(void *arg)
> +{
> + struct uffd_handler_args *uffd_args = (struct uffd_handler_args *)arg;
> + int uffd = uffd_args->uffd;
> + int64_t pages = 0;
> +
> + while (!quit_uffd_thread) {
> + struct uffd_msg msg;
> + struct pollfd pollfd[1];
> + int r;
> + uint64_t addr;
> +
> + pollfd[0].fd = uffd;
> + pollfd[0].events = POLLIN;
> +
> + r = poll(pollfd, 1, 2000);
This may introduce an unecessary 2s delay when quit. Maybe we can
refer to how userfaultfd selftest did with this (please see
uffd_poll_thread() in selftests/vm/userfaultfd.c on usage of pipefd).
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2019-09-29 7:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-27 16:18 [PATCH 0/9] Create a userfaultfd demand paging test Ben Gardon
2019-09-27 16:18 ` [PATCH 1/9] KVM: selftests: Create a " Ben Gardon
2019-09-27 16:18 ` [PATCH 2/9] KVM: selftests: Add demand paging content to the " Ben Gardon
2019-09-29 7:11 ` Peter Xu [this message]
2019-09-27 16:18 ` [PATCH 3/9] KVM: selftests: Add memory size parameter " Ben Gardon
2019-09-27 16:18 ` [PATCH 4/9] KVM: selftests: Pass args to vCPU instead of using globals Ben Gardon
2019-10-03 7:38 ` Andrew Jones
2019-09-27 16:18 ` [PATCH 5/9] KVM: selftests: Support multiple vCPUs in demand paging test Ben Gardon
2019-09-27 16:18 ` [PATCH 6/9] KVM: selftests: Time guest demand paging Ben Gardon
2019-09-27 16:18 ` [PATCH 7/9] KVM: selftests: Add parameter to _vm_create for memslot 0 base paddr Ben Gardon
2019-10-03 8:10 ` Andrew Jones
2019-09-27 16:18 ` [PATCH 8/9] KVM: selftests: Support large VMs in demand paging test Ben Gardon
2019-09-29 7:22 ` [PATCH 0/9] Create a userfaultfd " Peter Xu
2019-09-30 17:02 ` Ben Gardon
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=20190929071157.GA8903@xz-x1 \
--to=peterx@redhat.com \
--cc=bgardon@google.com \
--cc=cannonmatthews@google.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.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