From mboxrd@z Thu Jan 1 00:00:00 1970 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 6647EC433EF for ; Sat, 7 May 2022 21:26:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79E346B0071; Sat, 7 May 2022 17:26:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 726046B0073; Sat, 7 May 2022 17:26:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5ED8F6B0074; Sat, 7 May 2022 17:26:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4818A6B0071 for ; Sat, 7 May 2022 17:26:36 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0EED420A10 for ; Sat, 7 May 2022 21:26:36 +0000 (UTC) X-FDA: 79440231192.27.4C713D3 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf28.hostedemail.com (Postfix) with ESMTP id A8E3AC002E for ; Sat, 7 May 2022 21:26:17 +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 ams.source.kernel.org (Postfix) with ESMTPS id 1093BB8085B; Sat, 7 May 2022 21:26:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8936FC385A6; Sat, 7 May 2022 21:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1651958791; bh=TpnUc2DE5KFYkQnmUd4Sv+a4aCiTuBPeApHJNytttBc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pjNdf+wv67dGI3O/VbxZIjKLTI4TigjrucaDTW42JMGnwVsHYqDS8DWIqz2NfVoro WHoPr6hO0dYaQ1qFYxgMcWuCydf7PV5uLp3JKveImP52BsWIAMb5rZtzFotNj0Mt9I gJ1WKCPuoNGe/7DZs+5m8H8FGmaQB4n98c3jdvRo= Date: Sat, 7 May 2022 14:26:30 -0700 From: Andrew Morton To: Joel Savitz Cc: linux-kernel@vger.kernel.org, Shuah Khan , Nico Pache , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Sidhartha Kumar Subject: Re: [PATCH] selftests: clarify common error when running gup_test Message-Id: <20220507142630.56f7ee13658d6fd78cc2d88f@linux-foundation.org> In-Reply-To: <20220502224942.995427-1-jsavitz@redhat.com> References: <20220502224942.995427-1-jsavitz@redhat.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: A8E3AC002E X-Stat-Signature: 7nc3bftpjsjqzijr3qe6x81xeyezi697 Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=pjNdf+wv; dmarc=none; spf=pass (imf28.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1651958777-776252 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: On Mon, 2 May 2022 18:49:42 -0400 Joel Savitz wrote: > > 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. > > --- 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); > } > Sidhartha did a similar thing: https://lkml.kernel.org/r/20220405214809.3351223-1-sidhartha.kumar@oracle.com (Which is now in mm-stable at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm) Although in retroreview, it should have printed that to stderr rather than to stdout.