From patchwork Fri Jan 14 22:08:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12714118 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3516CC433F5 for ; Fri, 14 Jan 2022 22:08:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C38186B0139; Fri, 14 Jan 2022 17:08:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BE8CE6B013B; Fri, 14 Jan 2022 17:08:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A87F56B013C; Fri, 14 Jan 2022 17:08:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0044.hostedemail.com [216.40.44.44]) by kanga.kvack.org (Postfix) with ESMTP id 95B256B0139 for ; Fri, 14 Jan 2022 17:08:07 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5832190079 for ; Fri, 14 Jan 2022 22:08:07 +0000 (UTC) X-FDA: 79030281414.08.640C0CD Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf11.hostedemail.com (Postfix) with ESMTP id BC3ED40011 for ; Fri, 14 Jan 2022 22:08:06 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id DAC6CCE19A9; Fri, 14 Jan 2022 22:08:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1C3EC36AE9; Fri, 14 Jan 2022 22:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1642198082; bh=U69HfuOa+YONiguT5W5kkfMrpQWWUFeHxAKhMreztxo=; h=Date:From:To:Subject:In-Reply-To:From; b=Bt70inFZBzwoQZaepBGeIemirUALYdtcFE/mem722BeEPMuciqd1rhw8kSECo7FXl WnlRwReGKgVKHUHtQ+57GhSv+KVBfYG8d8mN6omgKwtdbOV0FDjGFtwN7BKBpq66Jf TxK3QrEA7w+tg7jnzg9PU/PECH7IYHKrzTaiEwIg= Date: Fri, 14 Jan 2022 14:08:01 -0800 From: Andrew Morton To: aarcange@redhat.com, akpm@linux-foundation.org, axelrasmussen@google.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, nadav.amit@gmail.com, peterx@redhat.com, torvalds@linux-foundation.org Subject: [patch 092/146] selftests/uffd: allow EINTR/EAGAIN Message-ID: <20220114220801.vRTCklHUU%akpm@linux-foundation.org> In-Reply-To: <20220114140222.6b14f0061194d3200000c52d@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Queue-Id: BC3ED40011 X-Stat-Signature: du1b6eife7e7qni7i44ztwtx4rzwqaeq Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=Bt70inFZ; dmarc=none; spf=pass (imf11.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam06 X-HE-Tag: 1642198086-380228 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Peter Xu Subject: selftests/uffd: allow EINTR/EAGAIN This allow test to continue with interruptions like gdb. Link: https://lkml.kernel.org/r/20211115135219.85881-1-peterx@redhat.com Signed-off-by: Peter Xu Reviewed-by: Axel Rasmussen Cc: Andrea Arcangeli Cc: Nadav Amit Signed-off-by: Andrew Morton --- tools/testing/selftests/vm/userfaultfd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/tools/testing/selftests/vm/userfaultfd.c~selftests-uffd-allow-eintr-eagain +++ a/tools/testing/selftests/vm/userfaultfd.c @@ -648,7 +648,7 @@ static int uffd_read_msg(int ufd, struct if (ret != sizeof(*msg)) { if (ret < 0) { - if (errno == EAGAIN) + if (errno == EAGAIN || errno == EINTR) return 1; err("blocking read error"); } else { @@ -724,8 +724,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");