From patchwork Mon May 2 22:49:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Savitz X-Patchwork-Id: 12834867 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 BBF4EC433F5 for ; Mon, 2 May 2022 22:49:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E551B6B0071; Mon, 2 May 2022 18:49:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DDC3B6B0073; Mon, 2 May 2022 18:49:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C55906B0074; Mon, 2 May 2022 18:49:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id AF46F6B0071 for ; Mon, 2 May 2022 18:49:51 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 862652A994 for ; Mon, 2 May 2022 22:49:51 +0000 (UTC) X-FDA: 79422296982.28.854759B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 2B7CFA0075 for ; Mon, 2 May 2022 22:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651531790; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=teevnqkm14nHJRBfyCMDeZXlCSbdTUq69zQhC9ksboU=; b=BVEB1MkxQ3b1G3KT41/M/FEygVEHONQPlVikXuMn8R+rnDfxvrBxe66h/s/d9q2vlfoC+l p8tZQXL7j9axzFtJ8oCDBu8Jfy7Oxap5N4sNiVuUOPLQM8Iy92EeGJ1wzTAkyf9Q1WD7hZ Mem3inbBOEF3gulUkx4aSI9mwzGFz4M= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-528-cj8PsvapOTaO0EDOQlRiCQ-1; Mon, 02 May 2022 18:49:46 -0400 X-MC-Unique: cj8PsvapOTaO0EDOQlRiCQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0091C3C10AA2; Mon, 2 May 2022 22:49:46 +0000 (UTC) Received: from jsavitz-csb.redhat.com (unknown [10.22.10.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 885AD554A1E; Mon, 2 May 2022 22:49:45 +0000 (UTC) From: Joel Savitz To: linux-kernel@vger.kernel.org Cc: Joel Savitz , Andrew Morton , Shuah Khan , Nico Pache , linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: [PATCH] selftests: clarify common error when running gup_test Date: Mon, 2 May 2022 18:49:42 -0400 Message-Id: <20220502224942.995427-1-jsavitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 2B7CFA0075 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BVEB1Mkx; spf=none (imf15.hostedemail.com: domain of jsavitz@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=jsavitz@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Stat-Signature: znbhtgrfhacwtngunxggxr6ah4cr8hwz X-HE-Tag: 1651531783-918978 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: The gup_test binary will fail showing only the output of perror("open") in the case that /sys/kernel/debug/gup_test is not found. This will almost always be due to CONFIG_GUP_TEST not being set, which enables compilation of a kernel that provides this file. Add a short error message to clarify this failure and point the user to the solution. Signed-off-by: Joel Savitz --- tools/testing/selftests/vm/gup_test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/vm/gup_test.c b/tools/testing/selftests/vm/gup_test.c index cda837a14736..ac4e804d47f0 100644 --- a/tools/testing/selftests/vm/gup_test.c +++ b/tools/testing/selftests/vm/gup_test.c @@ -18,6 +18,8 @@ #define FOLL_WRITE 0x01 /* check pte is writable */ #define FOLL_TOUCH 0x02 /* mark page accessed */ +#define GUP_TEST_FILE "/sys/kernel/debug/gup_test" + static unsigned long cmd = GUP_FAST_BENCHMARK; static int gup_fd, repeats = 1; static unsigned long size = 128 * MB; @@ -204,9 +206,11 @@ int main(int argc, char **argv) if (write) gup.gup_flags |= FOLL_WRITE; - gup_fd = open("/sys/kernel/debug/gup_test", O_RDWR); + gup_fd = open(GUP_TEST_FILE, O_RDWR); if (gup_fd == -1) { perror("open"); + fprintf(stderr, "Unable to open %s: check that CONFIG_GUP_TEST=y\n", + GUP_TEST_FILE); exit(1); }