Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5510114pxu; Thu, 22 Oct 2020 04:26:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0EZQv83jZwmfpwXe+gf/aaaPiNTV0BIHiMnHOSLZTmmfI2GzbvEs+ka/QxmvGWD/OYS02 X-Received: by 2002:a05:6402:605:: with SMTP id n5mr1655632edv.373.1603366015502; Thu, 22 Oct 2020 04:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603366015; cv=none; d=google.com; s=arc-20160816; b=cTW4ZOutCZPxqXZslW+Fkd3zM3mky3avf6R2xzxxkTFA/7kJIYy0GGG5mOH9ofPB70 iIebEOKXg2ggDnpHN32HvvmEDhQVTRSl6TpbdwGILAJGXDgjJ1qDxVc6ekpZXghX5tBF GCOeMVNv7xO3TPo/Pmg1lIFPBK+a4dbUkAlDHp5UfAzwLDV5aEWuHfDzVHVHyUaj1nNA W8Dq2AJ8kPcadEx94DsuXSrE1+9z0LjpdkENH2j/+zxDXq6lTFbz0wc/blu1aRA3VsUe Ke1S6Q7q0uVUKevfNbxa2z2TkUItANDR0OjAmXH5bfOKKF9ZRGshH1VraHj7wo4nUSry /x0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=UddkOGHhdOnx8gO073FR4GFAl/3VCv5YzyVjZQV2kTY=; b=xETVwnsPs2qHZYXJA0L44YnIJjRPfpCPlQdP5keLHDqQQFlUDnQ5JFi+rcWRdhzu75 SLs6XUqrVCHzRlM7/aYYkSivrb5mXS9pKMa5lzi4V/ILgTPRQfqaWIrBOW60jbC/bbBU cajYAQz8+A8dBOFf6lXK7FCQlThXzQ/StMFlPauzxroE3G37lHlV8rfiO3RRmunsJSeZ 6yUksV3eGg7mQ41OEezcfU+zMfIPO9qs/yPQoOiZ+SdJDChc/l7xaRNwSiIAMzi9yMYK mjLCs31YgsG+wcWdFMcMQLX0UG5D60zc19fC1BbgxsAvVThRemVAhF9q3MIRqIe0F3Vu +vBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RIn4Zs4J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si778361edt.266.2020.10.22.04.26.33; Thu, 22 Oct 2020 04:26:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RIn4Zs4J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2444536AbgJUQVz (ORCPT + 99 others); Wed, 21 Oct 2020 12:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2444530AbgJUQVz (ORCPT ); Wed, 21 Oct 2020 12:21:55 -0400 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53FF5C0613CE for ; Wed, 21 Oct 2020 09:21:55 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id f10so2357703otb.6 for ; Wed, 21 Oct 2020 09:21:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UddkOGHhdOnx8gO073FR4GFAl/3VCv5YzyVjZQV2kTY=; b=RIn4Zs4JYb0ISiXDMhZlmVBOs1H92Pt/XfcOik/Zg/T/AiT59oDR6E6T5SDcjzTyRs eAWYWSM4i+f7uWB7VRuSCm9Jrdq296pt5JTJS922HYjL88+A46XjTj3fpTl38Ep3XlBL 04L1LlzfVPY85rukqCmQ94emlE4UB9GxAGhkI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UddkOGHhdOnx8gO073FR4GFAl/3VCv5YzyVjZQV2kTY=; b=UhBUqziQiiMQDWsuX05uJYKPIJCEaPunJU9VQ6lcWOytVX5QlhGbk/h1nlgVH8mAjT UTENJLu3lOjYAFtd/0KjddGwuy7irLEt++OSKBw0ocFXY1+/O8MBOFTAWMciIzTZPy4s 7tNuGuLXh13QRPDobEQR7QTLR5PGCQ8/p3pM86UuOZtrqS3vUjSTFr/wulANzZx37Akz TbgZJVYjz/qIZ7bYDFgZXHS3UJvWn/9LGiehAQhAOk2CdX1WUTNE0TrVJYiAoUaFX9RL k5WlV6WNtK3Zkr03cXPX6kEm50u8+E6+GrOcoHSDWDfo8pC6JTN3IvnyboxRnSxWF62T ecJg== X-Gm-Message-State: AOAM533PMSGU9QpNN5tfDnybjHWj23r+6yd3HxpSYDe5pPL5AxDiQKTa Q2HsEb5uXH1b8Y3NxO1Gn7Sy3JcEdSYRzDbs6kS/WY2EjeE= X-Received: by 2002:a05:6830:4033:: with SMTP id i19mr3357774ots.127.1603297314353; Wed, 21 Oct 2020 09:21:54 -0700 (PDT) MIME-Version: 1.0 References: <20201021150458.GA139977@rlk> In-Reply-To: <20201021150458.GA139977@rlk> From: David Riley Date: Wed, 21 Oct 2020 09:21:43 -0700 Message-ID: Subject: Re: [PATCH v2] tools/time: access /sys/kernel/debug/udelay_test before test To: Hui Su Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reviewed-by: David Riley On Wed, Oct 21, 2020 at 8:05 AM Hui Su wrote: > > before(when i did not compile udelay_test.ko): > sh@ubuntu:~/workspace/compile/tools/time$ sudo ./udelay_test.sh > ./udelay_test.sh: line 25: /sys/kernel/debug/udelay_test: Permission denied > ./udelay_test.sh: line 26: /sys/kernel/debug/udelay_test: No such file or directory > ./udelay_test.sh: line 25: /sys/kernel/debug/udelay_test: Permission denied > ./udelay_test.sh: line 26: /sys/kernel/debug/udelay_test: No such file or directory > ... > about two hundreds lines. > > we access '/sys/kernel/debug/udelay_test' the before starting the > udelay_test. > > now(when i did not compile udelay_test.ko): > sh@ubuntu:~/workspace/linux-stable/tools/time$ sudo ./udelay_test.sh > modprobe: FATAL: Module udelay_test not found in directory /lib/modules/5.4.44 > ERROR, can not access /sys/kernel/debug/udelay_test. > modprobe: FATAL: Module udelay_test not found. > > --- > v1->v2: remove the debug_file_exist(). > > Signed-off-by: Hui Su > --- > tools/time/udelay_test.sh | 42 ++++++++++++++++++++++----------------- > 1 file changed, 24 insertions(+), 18 deletions(-) > > diff --git a/tools/time/udelay_test.sh b/tools/time/udelay_test.sh > index 6779d7e55d85..c8458d5b7fcd 100755 > --- a/tools/time/udelay_test.sh > +++ b/tools/time/udelay_test.sh > @@ -12,10 +12,11 @@ > > MODULE_NAME=udelay_test > UDELAY_PATH=/sys/kernel/debug/udelay_test > +retcode=0 > > setup() > { > - /sbin/modprobe -q $MODULE_NAME > + /sbin/modprobe $MODULE_NAME > tmp_file=`mktemp` > } > > @@ -31,29 +32,34 @@ cleanup() > if [ -f $tmp_file ]; then > rm $tmp_file > fi > - /sbin/modprobe -q -r $MODULE_NAME > + /sbin/modprobe -r $MODULE_NAME > } > > trap cleanup EXIT > setup > > -# Delay for a variety of times. > -# 1..200, 200..500 (by 10), 500..2000 (by 100) > -for (( delay = 1; delay < 200; delay += 1 )); do > - test_one $delay > -done > -for (( delay = 200; delay < 500; delay += 10 )); do > - test_one $delay > -done > -for (( delay = 500; delay <= 2000; delay += 100 )); do > - test_one $delay > -done > - > -# Search for failures > -count=`grep -c FAIL $tmp_file` > -if [ $? -eq "0" ]; then > - echo "ERROR: $count delays failed to delay long enough" > +if [ ! -d "$UDELAY_PATH" ]; then > retcode=1 > + echo "ERROR, can not access $UDELAY_PATH." > +else > + # Delay for a variety of times. > + # 1..200, 200..500 (by 10), 500..2000 (by 100) > + for (( delay = 1; delay < 200; delay += 1 )); do > + test_one $delay > + done > + for (( delay = 200; delay < 500; delay += 10 )); do > + test_one $delay > + done > + for (( delay = 500; delay <= 2000; delay += 100 )); do > + test_one $delay > + done > + > + # Search for failures > + count=`grep -c FAIL $tmp_file` > + if [ $? -eq "0" ]; then > + echo "ERROR: $count delays failed to delay long enough" > + retcode=1 > + fi > fi > > exit $retcode > -- > 2.25.1 > >