linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Axel Rasmussen <axelrasmussen@google.com>
To: Peter Xu <peterx@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 Andrea Arcangeli <aarcange@redhat.com>,
	Nadav Amit <nadav.amit@gmail.com>,
	 Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] selftests/uffd: Allow EINTR/EAGAIN
Date: Mon, 15 Nov 2021 09:30:01 -0800	[thread overview]
Message-ID: <CAJHvVciEV1uU=3ZmYB7V3uEa04SUzeqh8Ljvovz0t2huEAF19g@mail.gmail.com> (raw)
In-Reply-To: <20211115135219.85881-1-peterx@redhat.com>

Looks correct to me!

Reviewed-by: Axel Rasmussen <axelrasmussen@google.com>

On Mon, Nov 15, 2021 at 5:52 AM Peter Xu <peterx@redhat.com> wrote:
>
> This allow test to continue with interruptions like gdb.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  tools/testing/selftests/vm/userfaultfd.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
> index 8a09057d2f22..64845be3971d 100644
> --- a/tools/testing/selftests/vm/userfaultfd.c
> +++ b/tools/testing/selftests/vm/userfaultfd.c
> @@ -644,7 +644,7 @@ static int uffd_read_msg(int ufd, struct uffd_msg *msg)
>
>         if (ret != sizeof(*msg)) {
>                 if (ret < 0) {
> -                       if (errno == EAGAIN)
> +                       if (errno == EAGAIN || errno == EINTR)
>                                 return 1;
>                         err("blocking read error");
>                 } else {
> @@ -720,8 +720,11 @@ static void *uffd_poll_thread(void *arg)
>
>         for (;;) {
>                 ret = poll(pollfd, 2, -1);
> -               if (ret <= 0)
> +               if (ret <= 0) {
> +                       if (errno == EINTR || errno == EAGAIN)
> +                               continue;
>                         err("poll error: %d", ret);
> +               }
>                 if (pollfd[1].revents & POLLIN) {
>                         if (read(pollfd[1].fd, &tmp_chr, 1) != 1)
>                                 err("read pipefd error");
> --
> 2.32.0
>


      reply	other threads:[~2021-11-15 17:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 13:52 Peter Xu
2021-11-15 17:30 ` Axel Rasmussen [this message]

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='CAJHvVciEV1uU=3ZmYB7V3uEa04SUzeqh8Ljvovz0t2huEAF19g@mail.gmail.com' \
    --to=axelrasmussen@google.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nadav.amit@gmail.com \
    --cc=peterx@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