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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77408C433EF for ; Thu, 31 Mar 2022 19:28:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240721AbiCaTab (ORCPT ); Thu, 31 Mar 2022 15:30:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240706AbiCaTaZ (ORCPT ); Thu, 31 Mar 2022 15:30:25 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58043554A6 for ; Thu, 31 Mar 2022 12:28:36 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id 9so703576iou.5 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=CmjlOW6UXyjWhsoz25m8R7H1RH0TKo0HTYMVgmSOC19G51/hUbsgDsq8Mh3xxTZteO 8KzPFEDVGh+kKcUB82i9MjNJFLz6FIae/Rn5u7sqXq3vKZByyHUHyQjY4SiJk3VurIi2 bv6iFURh2AXWw+Qz8hVYszgYE4TIyWBNGm4an7aEwQU+DULOoYx4JH2uMWhZlilFaNr0 O9f3guIQZ0beWo0xyL4vUWjDL7zHpXHile8iM6/jyQyZYunHhgwq6ALLTjn1Ev5FOW3h cVkvu9IOcE3477LaPhilE79pRGYsfpPrLRX7PAIyVip8jKGl3Fu5T4gw0RYHuoWCpUVx 190A== X-Gm-Message-State: AOAM5339YQpkeoi7uCdRYyjpmuCbj2ca471WZofG0BLrzZXKR53bFA7s zx9Gnzc7DvQVmN3Je6LOx4faFwOTcHKqVg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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