Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp246516iob; Mon, 2 May 2022 18:25:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySkdIHGPQByRjvPxs+c/Dsv4h/9G7dQBCI2DcSlYFXFbS4Ie2rcsdMSlD8TjJyFz8HAvtS X-Received: by 2002:a63:1d26:0:b0:3c1:eb3f:9daf with SMTP id d38-20020a631d26000000b003c1eb3f9dafmr9364645pgd.284.1651541105604; Mon, 02 May 2022 18:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651541105; cv=none; d=google.com; s=arc-20160816; b=T5jOK6pLG/AJ108W92sXMa3ZcLlkRWJaFTKW/WCB5MUiMAzQS6LNla1jHgRNfpAQ9H RH3iTPBE0Uve6ZEFmh/nzUeW/fhxy8VBZ8NXap1L92O9L/GRFzUs3wefAYMtnZpGNXQg HfGBIJQN64OdFNdzepN5DJBy3ZjW7ODeEQ+6kgelApJuobqpwG+z3CqgpBav4AbrQjLf 6M5AA85a0rBdeMmVWJUAx/QFuavqmJPG0aWYJdgIzxaKxjx3KJeUO1DpbYbpaBw3OCN9 Yj423CIH7yScC2heMf8gJGj+8DXZDn6ZR2mrPtwKVXCzChm4NCGUCRXBtHaTwI7n8aJS mwPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=teevnqkm14nHJRBfyCMDeZXlCSbdTUq69zQhC9ksboU=; b=z0qG5c6UMH4QNKnWZM2Skcm8xzpHH1kOIYWnG7/4cwpaPZMdie+ZGc65c3bayNEmUS Ly6GHNbK6yWGOkJh7F9/m6khKgrZwghhd6WTU7xwd0Uv0NiqCM3dCxRBEJJjcm86hbfd +K5OAb4BfTS9z8mipALUd0Jtfe0RZR0vc1sLVeSU6LNvAjrrGyAIXxckRBzt4+z7CqYE rEfoyy/l6ddYg1t06QTwm5wuNpLOtdCiNUkK9Irs39iebf9BJgEANtpl39QknY0ZUpdo dXOSs7mzTVMFXr6bSs1BNstSDBkT0fzg+Xx62O4icVtfxNeJ77WY4a8Of3RyIkviYkv+ WtWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JQrjCwqB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a6-20020a63e846000000b003c19e2b38f8si11758913pgk.421.2022.05.02.18.25.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 18:25:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JQrjCwqB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 64F064C79A; Mon, 2 May 2022 18:04:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232741AbiEBWy1 (ORCPT + 99 others); Mon, 2 May 2022 18:54:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236061AbiEBWxk (ORCPT ); Mon, 2 May 2022 18:53:40 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8CED911A2C for ; Mon, 2 May 2022 15:50:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651531789; 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=JQrjCwqByb8SG9pP7hZVV7E3f+Fv1l5w5yF64kJ+v1jZFV6tvDgXB6zuh8dIe1azn3IAaz iYwE0BgoEy637R0QX/6nUqr9GNqVA/pYuBt8LY8l1t6INwqIR7i+0ViFTmlrZ54mWG54Wx rCNHHYEnJwiR11YXD8AqIU+6hNOnd80= 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } -- 2.27.0