From patchwork Mon Nov 15 13:52:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12619545 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA6E5C433EF for ; Mon, 15 Nov 2021 13:52:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 46842619E3 for ; Mon, 15 Nov 2021 13:52:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 46842619E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DACC16B007D; Mon, 15 Nov 2021 08:52:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D5CB16B007E; Mon, 15 Nov 2021 08:52:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C251C6B0080; Mon, 15 Nov 2021 08:52:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0197.hostedemail.com [216.40.44.197]) by kanga.kvack.org (Postfix) with ESMTP id B3B846B007D for ; Mon, 15 Nov 2021 08:52:33 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 77CD9180A72FF for ; Mon, 15 Nov 2021 13:52:33 +0000 (UTC) X-FDA: 78811304586.11.FB75D43 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 48E6D5092782 for ; Mon, 15 Nov 2021 13:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636984352; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G6mvg61YlD7IhRhajTmh6Jvh8tR/o7YtVU1973fVaBU=; b=cbOf7FUv7X2iC9NgCtts6hEjXQlYTJ9u/sn6t1oewsfd8vJnpagWJNMmMotqe8+ZuM6FlY XAiy+LREJ7zDh86YYHzNfK1X3MiwXzeXpGAlVl3DlA1sc4KOK5fy+62S1ZZLRmCkGJ3ZEU p2Q6ri16i0cO1QenJfzOOfUWjv70M2o= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-479-uwZFgWksPie7apVXOqO1Zg-1; Mon, 15 Nov 2021 08:52:31 -0500 X-MC-Unique: uwZFgWksPie7apVXOqO1Zg-1 Received: by mail-pj1-f70.google.com with SMTP id d3-20020a17090a6a4300b001a70e45f34cso9023984pjm.0 for ; Mon, 15 Nov 2021 05:52:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=G6mvg61YlD7IhRhajTmh6Jvh8tR/o7YtVU1973fVaBU=; b=F1I74NiTkI1pg210gvsCbhqskFV7T+lVCk9qUwHN74sBlcDh3tCKvaNDxAQWPBBZYo xVVeJkPW2FWrfUlT7H+zzqSOwUXEP1MiLwhbW84bz2FmY94UqZiVoTo85dl+ktKBe3mY YtcvgddAsRB81Z1hDoteyxXZ7ZaHMcHUP1eWAb4npdIlfwwDbnWjT/49gET8Lm8qxwL3 dxoNx624unUQC5OWN9J8KBMV059ek+YNJyGdcDcwsyIH6LWDluQBhJZf9T7f3tPHD9VD EJPP0j/AYpevI18GoD2BrQary3Sdc7A3+SEgRgf1vJN5V7OjR1y8ayXeivAT+KmecFVe wneg== X-Gm-Message-State: AOAM530KICE3h/BKyxUMRS8ukwzTVitGrbHdklrNKugeaOOGabXCzg1E 4GQbOuxpinHaEnnZqckQ4bPwiimS93dqzHwrL394xwGsUW2in76YfTXHx8uE0sAlC27hZwxj53V EpBqAS+g6bHDa3v3jpUvvPHLxPWomSrH7i1E9t+v+I0KJBaYOajHmOWItJYXz X-Received: by 2002:a63:920b:: with SMTP id o11mr24351515pgd.314.1636984350228; Mon, 15 Nov 2021 05:52:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRqq3KS/bKMPGca2vbO5WJgqxcSez+txIiLTkNRoYDGbLnhbV4nn5jzGtrTi7bNuQ50/XpYA== X-Received: by 2002:a63:920b:: with SMTP id o11mr24351487pgd.314.1636984349943; Mon, 15 Nov 2021 05:52:29 -0800 (PST) Received: from localhost.localdomain ([191.101.132.72]) by smtp.gmail.com with ESMTPSA id u11sm16149464pfk.152.2021.11.15.05.52.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Nov 2021 05:52:29 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrea Arcangeli , peterx@redhat.com, Nadav Amit , Andrew Morton , Axel Rasmussen Subject: [PATCH] selftests/uffd: Allow EINTR/EAGAIN Date: Mon, 15 Nov 2021 21:52:19 +0800 Message-Id: <20211115135219.85881-1-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 48E6D5092782 X-Stat-Signature: 514yqgx137m43s8piickixuucxdyemkj Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cbOf7FUv; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf05.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=peterx@redhat.com X-HE-Tag: 1636984328-668330 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: This allow test to continue with interruptions like gdb. Signed-off-by: Peter Xu Reviewed-by: Axel Rasmussen --- 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");