From patchwork Tue Dec 8 02:47:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11957465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1194AC4361B for ; Tue, 8 Dec 2020 02:47:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9D0E823976 for ; Tue, 8 Dec 2020 02:47:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D0E823976 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3493F8D000B; Mon, 7 Dec 2020 21:47:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F5218D0001; Mon, 7 Dec 2020 21:47:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D30B8D000B; Mon, 7 Dec 2020 21:47:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0190.hostedemail.com [216.40.44.190]) by kanga.kvack.org (Postfix) with ESMTP id ECF928D0001 for ; Mon, 7 Dec 2020 21:47:16 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B1261180AD81D for ; Tue, 8 Dec 2020 02:47:16 +0000 (UTC) X-FDA: 77568578472.05.voice43_200f678273e3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 956F81801E8DA for ; Tue, 8 Dec 2020 02:47:16 +0000 (UTC) X-HE-Tag: voice43_200f678273e3 X-Filterd-Recvd-Size: 4269 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Dec 2020 02:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607395635; 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: in-reply-to:in-reply-to:references:references; bh=4svAT51jDNn90VCBgpKJLgnxLVTUryttpZeaTRRqYeU=; b=CUqhpGSlWs4BUXo4TuUYPTSHONGcKfeKke23sJtpEuFp859kVlutBZRfylPpRdvZWb5Dwv zvvmfy+rPx5xiZy4bUU7eCwdpmKU9XtiEINotNHmmHG7lZfMYl/8IElrRPMtpMayU7hNfo vkgxCsRQin8mMVsQ9RCUyXjiQF5ENoI= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-406-0-ooHeLOPTelpJqB1fZIXQ-1; Mon, 07 Dec 2020 21:47:13 -0500 X-MC-Unique: 0-ooHeLOPTelpJqB1fZIXQ-1 Received: by mail-qv1-f72.google.com with SMTP id e13so13211276qvl.19 for ; Mon, 07 Dec 2020 18:47:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4svAT51jDNn90VCBgpKJLgnxLVTUryttpZeaTRRqYeU=; b=j/29XwfWnDxDEhMGVRCRuZvakC0hHYmkuIHDj0HbziwSacmds4DsF//OgTLVxedL8W jI0PlxuVxdjVX1DgQYRG05AuyJprkqBikYaKUnJPYrmXyEAxnnofrnhLdzhQndp4ozr+ ZEjX1MW3QMrhS9OIbxCLgqaH0NcKLKXmBttOxrwdFxJHb3SQ8i41+eGtzBPXq3ndAmTj sHSYlbPyvJ6WxROdooHu66ogs02lXLD+KM9G6vaTjeEsLIudy/vIFQTGgkRutFYyHweS VYtx+ivyr0U91YFunKUf2YPXk9EYGtpAz2cgj7KMVIDQ2prEIUpTPZKtvpXLPSNkLi34 2njg== X-Gm-Message-State: AOAM533SdIrEEBW8UyrzkQPxxdHKoOfGBKzFNo06FwxcW6nLwa3jbL2R F5PBloDATruCd+NPhmykofs2ioRP/0leG/PiYeepcKSk9KK/gsBEJIjpjbJ+An2PCuk8f0+KxRr YPimKgGT3+SI= X-Received: by 2002:ad4:476c:: with SMTP id d12mr11834401qvx.20.1607395633454; Mon, 07 Dec 2020 18:47:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfh3P7dY6eaeMmnsALY89l8oHv/XvtnKQ7OrAk09h0yrFjsDvtejpvLnKib5sgRda+p8FG0w== X-Received: by 2002:ad4:476c:: with SMTP id d12mr11834390qvx.20.1607395633255; Mon, 07 Dec 2020 18:47:13 -0800 (PST) Received: from localhost.localdomain ([142.126.83.202]) by smtp.gmail.com with ESMTPSA id n95sm13778744qte.43.2020.12.07.18.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 18:47:12 -0800 (PST) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrea Arcangeli , Andrew Morton , peterx@redhat.com, Mike Rapoport Subject: [PATCH 1/3] userfaultfd/selftests: Always dump something in modes Date: Mon, 7 Dec 2020 21:47:07 -0500 Message-Id: <20201208024709.7701-2-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201208024709.7701-1-peterx@redhat.com> References: <20201208024709.7701-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: BOUNCE_POLL is a special bit that if cleared it means "READ" instead. Dump that too otherwise we'll see tests with empty modes. Signed-off-by: Peter Xu --- tools/testing/selftests/vm/userfaultfd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index 61e5cfeb1350..31f470d12d0b 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -1230,6 +1230,8 @@ static int userfaultfd_stress(void) printf(" ver"); if (bounces & BOUNCE_POLL) printf(" poll"); + else + printf(" read"); printf(", "); fflush(stdout); From patchwork Tue Dec 8 02:47:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11957467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3383C4167B for ; Tue, 8 Dec 2020 02:47:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F56B235F9 for ; Tue, 8 Dec 2020 02:47:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F56B235F9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DCE1C8D000C; Mon, 7 Dec 2020 21:47:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D2FA88D0001; Mon, 7 Dec 2020 21:47:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA9B48D000C; Mon, 7 Dec 2020 21:47:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 9E5858D0001 for ; Mon, 7 Dec 2020 21:47:18 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 640D8362C for ; Tue, 8 Dec 2020 02:47:18 +0000 (UTC) X-FDA: 77568578556.07.blood74_1a17b00273e3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 48EC41803F9A9 for ; Tue, 8 Dec 2020 02:47:18 +0000 (UTC) X-HE-Tag: blood74_1a17b00273e3 X-Filterd-Recvd-Size: 5243 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Dec 2020 02:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607395637; 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: in-reply-to:in-reply-to:references:references; bh=JHm7VOf4vG5fW9dqcix1M4Ga8GJuy8GIXJPeBhURP8Y=; b=KDhX07LTWLwSOIEn/O2hkFYpEEiQRQpJhocpt86az03frrnTxMgAXHVNQ5bHzTf15eyt/r RmHIqKZ4v7KNKwQIvf8jmbtIuk6YE0vFjkZWoq/d0SnyHhKGv3XUhVcq+RQCRiS/JrOUKG 2y4ZMcPd1zn01YmuFtyoyzDRmKQeVlI= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-319-zOuJd2pLO-uIEh7ZhnrsAA-1; Mon, 07 Dec 2020 21:47:15 -0500 X-MC-Unique: zOuJd2pLO-uIEh7ZhnrsAA-1 Received: by mail-qk1-f199.google.com with SMTP id s9so14257977qks.2 for ; Mon, 07 Dec 2020 18:47:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JHm7VOf4vG5fW9dqcix1M4Ga8GJuy8GIXJPeBhURP8Y=; b=E07pepV+ek514Mx2Q2S/UgieBA/KYkaUAHEXp7+WvV6oBZTSlXCVUNbEjMhNgGWv9v wfZk3b9ar4d+3BY7U2Y7YO9m/DFJYp3bbbWbdvs18ldRw9jqehRcQjrYNAsWt13LUpnd nbQ/mQaHGYMUZ0vVe70V/G+HqG4Qaee8w0RH4lf7AAFB4dzrFVgZLlV/q1RK0bQrTelk W9zgdPhzR24KylIKpEW/hx/EFgM/pDRu3FLZYpZcphNfiZ+FLTiZGgmKF2vbWrzmUOZI pujsKfgMuuzE53zQ1rbSQMZJCaxVZgN7lOUFDpL4zo4A5GY9uFt+82AK0Dqfs+pDlNHH 0i3Q== X-Gm-Message-State: AOAM532dDjWFYLumPW+AX7YZJ92GblLYaIU3TlA11ZMsJ275ncCYkP3/ lmzwmVfjoyXKXonA7yUXHLdG9gfhH8JfSIJJtWVDPl/icUw4eYxyUVH7UsLumBRznQKMSA1AS6m cnrUkOtI1Dg4= X-Received: by 2002:ad4:524d:: with SMTP id s13mr24676864qvq.19.1607395634924; Mon, 07 Dec 2020 18:47:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBZN0PrBHURyXeqoNeBbqq9BCmFz5EFAExrc7GKN1qoYPwkrbI06U6+ZHVzQbzcNsGNsjMLQ== X-Received: by 2002:ad4:524d:: with SMTP id s13mr24676846qvq.19.1607395634725; Mon, 07 Dec 2020 18:47:14 -0800 (PST) Received: from localhost.localdomain ([142.126.83.202]) by smtp.gmail.com with ESMTPSA id n95sm13778744qte.43.2020.12.07.18.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 18:47:14 -0800 (PST) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrea Arcangeli , Andrew Morton , peterx@redhat.com, Mike Rapoport Subject: [PATCH 2/3] userfaultfd/selftests: Fix retval check for userfaultfd_open() Date: Mon, 7 Dec 2020 21:47:08 -0500 Message-Id: <20201208024709.7701-3-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201208024709.7701-1-peterx@redhat.com> References: <20201208024709.7701-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: userfaultfd_open() returns 1 for errors rather than negatives. Fix it on all the callers so when UFFDIO_API failed the test will bail out. Signed-off-by: Peter Xu --- tools/testing/selftests/vm/userfaultfd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index 31f470d12d0b..f0647bfda366 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -993,7 +993,7 @@ static int userfaultfd_zeropage_test(void) if (uffd_test_ops->release_pages(area_dst)) return 1; - if (userfaultfd_open(0) < 0) + if (userfaultfd_open(0)) return 1; uffdio_register.range.start = (unsigned long) area_dst; uffdio_register.range.len = nr_pages * page_size; @@ -1038,7 +1038,7 @@ static int userfaultfd_events_test(void) features = UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP | UFFD_FEATURE_EVENT_REMOVE; - if (userfaultfd_open(features) < 0) + if (userfaultfd_open(features)) return 1; fcntl(uffd, F_SETFL, uffd_flags | O_NONBLOCK); @@ -1101,7 +1101,7 @@ static int userfaultfd_sig_test(void) return 1; features = UFFD_FEATURE_EVENT_FORK|UFFD_FEATURE_SIGBUS; - if (userfaultfd_open(features) < 0) + if (userfaultfd_open(features)) return 1; fcntl(uffd, F_SETFL, uffd_flags | O_NONBLOCK); @@ -1170,7 +1170,7 @@ static int userfaultfd_stress(void) if (!area_dst) return 1; - if (userfaultfd_open(0) < 0) + if (userfaultfd_open(0)) return 1; count_verify = malloc(nr_pages * sizeof(unsigned long long)); From patchwork Tue Dec 8 02:47:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11957469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6215C433FE for ; Tue, 8 Dec 2020 02:47:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 93B47235F9 for ; Tue, 8 Dec 2020 02:47:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93B47235F9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2F65E8D000D; Mon, 7 Dec 2020 21:47:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CCB78D0001; Mon, 7 Dec 2020 21:47:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E2328D000D; Mon, 7 Dec 2020 21:47:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0072.hostedemail.com [216.40.44.72]) by kanga.kvack.org (Postfix) with ESMTP id 049DE8D0001 for ; Mon, 7 Dec 2020 21:47:22 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id C4E3C362C for ; Tue, 8 Dec 2020 02:47:21 +0000 (UTC) X-FDA: 77568578682.09.corn42_0304c53273e3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id ACA61180AD81D for ; Tue, 8 Dec 2020 02:47:21 +0000 (UTC) X-HE-Tag: corn42_0304c53273e3 X-Filterd-Recvd-Size: 4526 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Dec 2020 02:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607395640; 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: in-reply-to:in-reply-to:references:references; bh=xJW5IJGNOP6CMuFv2EzyZw9QmKSzTdQS44PAdYMNjXU=; b=MDJWQjW5ju8gFL9Xbnoxa2XCMNxQ7aDdpdt2+KO/pvxhh0F2bkn0PbW7UlNxQ5ksWEREjj Dz/v6SJsgOEOetG7UaYuJU2WJAdm9DB+uRh5vTlGW349UCBkvnP91i36+ie0OHDPUoLDHZ 8YahwuVfYkoj+TNtZ9mfTFdFLGw3hyM= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-lPmPP4UhOH6BSxX8cqs8lA-1; Mon, 07 Dec 2020 21:47:16 -0500 X-MC-Unique: lPmPP4UhOH6BSxX8cqs8lA-1 Received: by mail-qt1-f200.google.com with SMTP id b11so4806320qtj.11 for ; Mon, 07 Dec 2020 18:47:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xJW5IJGNOP6CMuFv2EzyZw9QmKSzTdQS44PAdYMNjXU=; b=PN1RLcoV8E+rSWihLsHXuYDUWT6SFnX8SYYIuM3+kN8s/RygUpptklbHlydOq+2Gfl kHkfeZxraKKA1uetamDuM4ZqDgTA+x4TL3RdlGoUR9zWLgspFBW/uAUNVZmTzDCL8IUo eXSN/XOMq4t0HhSjZw2RBuC9AWxgKcfsFS0hwlMdR4v807svc+9bSxrzmA0N6StgF21q IJpzYzsUBiZZll14+kT6L8zZVnh+Irot6up/R+WzLmjtlY9qRnOE5jj+jP9BA+VqBFjV qlc0UrROasYPyJw+W2ZVwhRdWrq2dsJSW6zIKyjfS4kO847XjqmLniDxgApazb+OBF5M AFbA== X-Gm-Message-State: AOAM531FPL2Agk1XBy2/UJmKNGPJTbg67LyrftQ4eGgF+nmEJrRjpKeV IcDH3AoqCBSu7fhXrFbyaJLXTFV9NtC+5gCiCpj7I/H22/VmKLcQJ44H1Y91SsDasQsU8SSKCyf xr0BSO7p6yK0= X-Received: by 2002:ac8:3594:: with SMTP id k20mr27520677qtb.18.1607395636336; Mon, 07 Dec 2020 18:47:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyK/+FRKLaJf67qFnojJEv5Ns9Slni9W1KgjcqTZnfv18RXlSVAdRnY1kJAEB1cQ1aYreeo1w== X-Received: by 2002:ac8:3594:: with SMTP id k20mr27520665qtb.18.1607395636145; Mon, 07 Dec 2020 18:47:16 -0800 (PST) Received: from localhost.localdomain ([142.126.83.202]) by smtp.gmail.com with ESMTPSA id n95sm13778744qte.43.2020.12.07.18.47.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 18:47:15 -0800 (PST) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrea Arcangeli , Andrew Morton , peterx@redhat.com, Mike Rapoport Subject: [PATCH 3/3] userfaultfd/selftests: Hint the test runner on required privilege Date: Mon, 7 Dec 2020 21:47:09 -0500 Message-Id: <20201208024709.7701-4-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201208024709.7701-1-peterx@redhat.com> References: <20201208024709.7701-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: Now userfaultfd test program requires either root or ptrace privilege due to the signal/event tests. When UFFDIO_API failed, hint the test runner about this fact verbosely. Signed-off-by: Peter Xu --- tools/testing/selftests/vm/userfaultfd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index f0647bfda366..27a1709099d0 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -755,7 +755,8 @@ static int userfaultfd_open(int features) uffdio_api.api = UFFD_API; uffdio_api.features = features; if (ioctl(uffd, UFFDIO_API, &uffdio_api)) { - fprintf(stderr, "UFFDIO_API\n"); + fprintf(stderr, "UFFDIO_API failed.\nPlease make sure to " + "run with either root or ptrace capability.\n"); return 1; } if (uffdio_api.api != UFFD_API) {