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 39204C433F5 for ; Thu, 31 Mar 2022 19:28:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 91C446B0073; Thu, 31 Mar 2022 15:28:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A58F6B0074; Thu, 31 Mar 2022 15:28:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7479E6B0075; Thu, 31 Mar 2022 15:28:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 637566B0073 for ; Thu, 31 Mar 2022 15:28:37 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2D0C461FF6 for ; Thu, 31 Mar 2022 19:28:37 +0000 (UTC) X-FDA: 79305668274.04.37F5CF8 Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by imf23.hostedemail.com (Postfix) with ESMTP id 8028C140007 for ; Thu, 31 Mar 2022 19:28:36 +0000 (UTC) Received: by mail-io1-f45.google.com with SMTP id b16so716824ioz.3 for ; Thu, 31 Mar 2022 12:28:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=KDv50hCOMSNm4tqOFej1XxVHswnaiqBQ/Ql5PRaAElM=; b=hr3WMnbNxfXX92/Y0t14FpEIS4pC+09DAI6p4oWqZgWnX03dIRuX74ev7qupnrKxzX n5Cz8IINdInr4rUCepEci1G0mhVdD9KS789z+ALBCwmklBUAZ+nFdcApJvLiaQ6DE1h6 gsrrPum6Nsrl58HvbzUvPWVrmzlfcNkgPf0Os= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KDv50hCOMSNm4tqOFej1XxVHswnaiqBQ/Ql5PRaAElM=; b=Xhh6KD+zUnM+Gi4F9w3F2bbILvJgxsr6rDf6wy7KqthtWIxg3JsacJl/5plNt+WB58 EDoQwDCyWCtbHGD7Wb1i3uLmXykNpIhAWLg/iaP/jhEIsUKcxdQpPm8lB3svxOhNY8QH J6RLZ6fjHYoCAjVOLDGIQD3D4i7kbIBb202efTcZ2ODBUghXjinck7LuiaE3Rj1iy4oE DWof2hXYswcK9uijlpi6hbpqwjehyuycPziqFyAyswuT2t/vTBE6HQTlV/UZ9L5iPOID W2+EraACdLyWtT95K/E1NPQbZI07VRIWhDnNB0PFMPF6A/8u+yzstdDhvf0jV7l2Z8/3 BppQ== X-Gm-Message-State: AOAM5310zoX44ROISTHt6TIk6DVrvSN4IHQu+C+tEEE0wxFt8VO5B7G9 HJ1J/cX89X6Bmfok2xSvMbR6iQ== X-Google-Smtp-Source: ABdhPJxfJ3AXDmXIug9uhpRb3ABjQOmyzzRYZ0nfXa4ivrk5be6vqTiSy892fiqB2bYpvFEb5d7u9Q== X-Received: by 2002:a02:7fc9:0:b0:323:6239:cfdb with SMTP id r192-20020a027fc9000000b003236239cfdbmr3849890jac.186.1648754915705; Thu, 31 Mar 2022 12:28:35 -0700 (PDT) Received: from [192.168.1.128] ([71.205.29.0]) by smtp.gmail.com with ESMTPSA id k12-20020a056e02156c00b002c9ad2b3dc4sm168559ilu.74.2022.03.31.12.28.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 31 Mar 2022 12:28:35 -0700 (PDT) Subject: Re: [PATCH] selftest/vm: clarify error statement in gup_test To: Sidhartha Kumar , shuah@kernel.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Shuah Khan References: <20220330215257.112029-1-sidhartha.kumar@oracle.com> From: Shuah Khan Message-ID: <9a752af3-8e3f-bfc5-eb24-eadcaf800bd5@linuxfoundation.org> Date: Thu, 31 Mar 2022 13:28:34 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20220330215257.112029-1-sidhartha.kumar@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspam-User: X-Stat-Signature: 7wgqr8j18o6ett75b65wckpqhuqppw88 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=google header.b=hr3WMnbN; spf=pass (imf23.hostedemail.com: domain of skhan@linuxfoundation.org designates 209.85.166.45 as permitted sender) smtp.mailfrom=skhan@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 8028C140007 X-HE-Tag: 1648754916-986526 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 3/30/22 3:52 PM, Sidhartha Kumar wrote: > Print two possible reasons /sys/kernel/debug/gup_test > cannot be opened to help users of this test diagnose > failures. > Thank you for the patch to improve rather cryptic error messages. > Signed-off-by: Sidhartha Kumar > Cc: stable@vger.kernel.org # 5.15+ > --- > tools/testing/selftests/vm/gup_test.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/vm/gup_test.c b/tools/testing/selftests/vm/gup_test.c > index fe043f67798b0..c496bcefa7a0e 100644 > --- a/tools/testing/selftests/vm/gup_test.c > +++ b/tools/testing/selftests/vm/gup_test.c > @@ -205,7 +205,9 @@ int main(int argc, char **argv) > > gup_fd = open("/sys/kernel/debug/gup_test", O_RDWR); > if (gup_fd == -1) { > - perror("open"); > + perror("failed to open /sys/kernel/debug/gup_test"); > + printf("check if CONFIG_GUP_TEST is enabled in kernel config\n"); > + printf("check if debugfs is mounted at /sys/kernel/debug\n"); Instead of adding 3 messages in a row, please check the errno to figure out why it failed and print an appropriate message. If open fails because CONFIG_GUP_TEST is not enabled, the test should skip the test instead of fail. Failing will indicate a test failure which is not the case. The test couldn't be run due to unmet dependencies. This test requires root access. A check for root privilege and skip the test for the same reason stated above. > exit(1); > } > > Please send v2 with these changes. thanks, -- Shuah