From patchwork Tue Sep 12 01:10:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 138250 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp487015vqx; Tue, 12 Sep 2023 08:28:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6/jHfB11cWDUJkY5B02QZGn4ghAIbfV635iNip0720U1i2H4u7DMbYDo+BHUoTDmzBBOV X-Received: by 2002:a05:6a21:a103:b0:14d:f8a4:d0d1 with SMTP id aq3-20020a056a21a10300b0014df8a4d0d1mr10801842pzc.35.1694532527514; Tue, 12 Sep 2023 08:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694532527; cv=none; d=google.com; s=arc-20160816; b=uGfeQ7hwOX1zudNz/jipmJsljJZ7ToPSVRrc0mytdoskmdfMbesNQemya0sodv9OxV qUExF4PwOhReC0M1Kdzwh/NcW8HGCTs99GBn8QxaJbZR5BUi4e5g97dowrutS/5ekEM3 xj2SWmKR7TvCoWKKAUtghBfkag0Ak+h0V8q2PNLTmpaFLvDHpt6om7dUHqIE8ZQagV0C 5ynM276gRDLXNr0pXOEoJ1Z7oaDqxEWtXFgJxLHZU9VOFedrZqacoeS9Tg4so7TOmbAy d6rmWF/zWIsgyshAqwWU08YiLbwB/L+VfLsPzo6F4pG9yaJ39lICA4LeFMtyEW4W7QuA 9KYA== 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 :user-agent:message-id:date:subject:cc:to:from:dkim-signature; bh=GbwrzjrPns49nnQqk+nCYw6PnS+zRSzfBqfh+ZpkZ64=; fh=vlI9JLMcMVdb1BtKf1SwiAj7VCsWm1EafTPOQy+/yTE=; b=jJvhnZJhemb2jLQmB/I/VhfGHzOvT7ASpJwWBjSUjc5GBViKi+XAqh0Vxy2G02pBh1 YUDC9i691yRcBHUg+Qf1ZQ6RcT7KDd8NQVm6fHIiZtTOxtCFrOeSWF0DLxtya5W29mU7 iBVeH4Na0WNNJo7/2wiB8nJlT/HRwdA8EDnXo5e4ACuQ3P4yOHxMQn259LRnkHCvxkAG VYjA/8tWC1lYWq4xZGg6oureR5ga+c5lPlBksCc6MbNFXoqd6ZjJoQJs2rfrIWBJz6Tm /UnEiLsWOdPiiE1bxsvvlBTICpLKn0uqLpvWp7lcbuXOgHXQ/AMT2EzxJhjIlBaKpSrI 2w1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rUpXzRmy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id j12-20020a63cf0c000000b00565e386ff44si8083751pgg.702.2023.09.12.08.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 08:28:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rUpXzRmy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CA682826C0DA; Mon, 11 Sep 2023 21:37:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241156AbjILC7P (ORCPT + 40 others); Mon, 11 Sep 2023 22:59:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240891AbjILC7D (ORCPT ); Mon, 11 Sep 2023 22:59:03 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A30A51167F3; Mon, 11 Sep 2023 18:22:25 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DE7AC4163C; Tue, 12 Sep 2023 01:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694481043; bh=cf5PfHaoDvF33waw1C2kNoX3JgbXMSowbmOHkiQVico=; h=From:To:Cc:Subject:Date:From; b=rUpXzRmyrgMOHSAyaDOPqyjt+q4z8siykatkYlee6noxCM9t1IUjTrEWYdebarssO DpNHGJ+dOuykNLhsjybrOXdzqUVCHx+AeJv2XZtklXAH4N8FuJXvGrkm8AkawqKDIr zHDs4bsXzmb4j17kGfOycSVKSU5usAJTmF5Ojsx0GJEIbK0vEAzJt1sgFtnlGC2Fy2 IbwL4Qr7vD+Uya4E0EjBKqKgLwqlk01w0etDhxMWzwuOeGPKur1jca3maw9FALzB6I CCAf3vYFm7n8LbVovFNMcPYEmg+yA6nH9odQ+k2Z3V4Or+p6jzkNbkFXGVSiNE4WJK GHQcXGCk8w55w== From: "Masami Hiramatsu (Google)" To: Shuah Khan Cc: Steven Rostedt , Mark Brown , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [FIX PATCH v2] selftests: tracing: Fix to unmount tracefs for recovering environment Date: Tue, 12 Sep 2023 10:10:39 +0900 Message-Id: <169448103881.242465.4589561134225171701.stgit@devnote2> X-Mailer: git-send-email 2.34.1 User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 11 Sep 2023 21:37:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776824350213077096 X-GMAIL-MSGID: 1776846139337152174 From: Masami Hiramatsu (Google) Fix to unmount the tracefs if the ftracetest mounted it for recovering system environment. If the tracefs is already mounted, this does nothing. Suggested-by: Mark Brown Link: https://lore.kernel.org/all/29fce076-746c-4650-8358-b4e0fa215cf7@sirena.org.uk/ Fixes: cbd965bde74c ("ftrace/selftests: Return the skip code when tracing directory not configured in kernel") Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - use -n option explictly for testing the string is non-zero. --- tools/testing/selftests/ftrace/ftracetest | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest index cb5f18c06593..d68264a5f3f0 100755 --- a/tools/testing/selftests/ftrace/ftracetest +++ b/tools/testing/selftests/ftrace/ftracetest @@ -31,6 +31,9 @@ err_ret=1 # kselftest skip code is 4 err_skip=4 +# umount required +UMOUNT_DIR="" + # cgroup RT scheduling prevents chrt commands from succeeding, which # induces failures in test wakeup tests. Disable for the duration of # the tests. @@ -45,6 +48,9 @@ setup() { cleanup() { echo $sched_rt_runtime_orig > $sched_rt_runtime + if [ -n "${UMOUNT_DIR}" ]; then + umount ${UMOUNT_DIR} ||: + fi } errexit() { # message @@ -160,11 +166,13 @@ if [ -z "$TRACING_DIR" ]; then mount -t tracefs nodev /sys/kernel/tracing || errexit "Failed to mount /sys/kernel/tracing" TRACING_DIR="/sys/kernel/tracing" + UMOUNT_DIR=${TRACING_DIR} # If debugfs exists, then so does /sys/kernel/debug elif [ -d "/sys/kernel/debug" ]; then mount -t debugfs nodev /sys/kernel/debug || errexit "Failed to mount /sys/kernel/debug" TRACING_DIR="/sys/kernel/debug/tracing" + UMOUNT_DIR=${TRACING_DIR} else err_ret=$err_skip errexit "debugfs and tracefs are not configured in this kernel"