mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [FIX PATCH v2] selftests: tracing: Fix to unmount tracefs for recovering environment
@ 2023-09-12  1:10 Masami Hiramatsu (Google)
  2023-09-12  1:24 ` Steven Rostedt
  2023-09-12 11:35 ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Masami Hiramatsu (Google) @ 2023-09-12  1:10 UTC (permalink / raw)
  To: Shuah Khan; +Cc: Steven Rostedt, Mark Brown, linux-kernel, linux-kselftest

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

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 <broonie@kernel.org>
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) <mhiramat@kernel.org>
---
 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"


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FIX PATCH v2] selftests: tracing: Fix to unmount tracefs for recovering environment
  2023-09-12  1:10 [FIX PATCH v2] selftests: tracing: Fix to unmount tracefs for recovering environment Masami Hiramatsu (Google)
@ 2023-09-12  1:24 ` Steven Rostedt
  2023-09-12 15:35   ` Shuah Khan
  2023-09-12 11:35 ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2023-09-12  1:24 UTC (permalink / raw)
  To: Masami Hiramatsu (Google)
  Cc: Shuah Khan, Mark Brown, linux-kernel, linux-kselftest

On Tue, 12 Sep 2023 10:10:39 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:

> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> 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 <broonie@kernel.org>
> 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) <mhiramat@kernel.org>
> ---
>  Changes in v2:
>    - use -n option explictly for testing the string is non-zero.
> ---
>  tool

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FIX PATCH v2] selftests: tracing: Fix to unmount tracefs for recovering environment
  2023-09-12  1:10 [FIX PATCH v2] selftests: tracing: Fix to unmount tracefs for recovering environment Masami Hiramatsu (Google)
  2023-09-12  1:24 ` Steven Rostedt
@ 2023-09-12 11:35 ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2023-09-12 11:35 UTC (permalink / raw)
  To: Masami Hiramatsu (Google)
  Cc: Shuah Khan, Steven Rostedt, linux-kernel, linux-kselftest

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

On Tue, Sep 12, 2023 at 10:10:39AM +0900, Masami Hiramatsu (Google) wrote:
> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> Fix to unmount the tracefs if the ftracetest mounted it for recovering
> system environment. If the tracefs is already mounted, this does nothing.

Reviewed-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FIX PATCH v2] selftests: tracing: Fix to unmount tracefs for recovering environment
  2023-09-12  1:24 ` Steven Rostedt
@ 2023-09-12 15:35   ` Shuah Khan
  2023-09-13  3:01     ` Masami Hiramatsu
  0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2023-09-12 15:35 UTC (permalink / raw)
  To: Steven Rostedt, Masami Hiramatsu (Google)
  Cc: Shuah Khan, Mark Brown, linux-kernel, linux-kselftest, Shuah Khan

On 9/11/23 19:24, Steven Rostedt wrote:
> On Tue, 12 Sep 2023 10:10:39 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> 
>> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>>
>> 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 <broonie@kernel.org>
>> 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) <mhiramat@kernel.org>
>> ---
>>   Changes in v2:
>>     - use -n option explictly for testing the string is non-zero.
>> ---
>>   tool
> 
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> 
> -- Steve

Thank you all. Applied to linux-kselftest fixes branch for next rc

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FIX PATCH v2] selftests: tracing: Fix to unmount tracefs for recovering environment
  2023-09-12 15:35   ` Shuah Khan
@ 2023-09-13  3:01     ` Masami Hiramatsu
  0 siblings, 0 replies; 5+ messages in thread
From: Masami Hiramatsu @ 2023-09-13  3:01 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Steven Rostedt, Shuah Khan, Mark Brown, linux-kernel, linux-kselftest

On Tue, 12 Sep 2023 09:35:58 -0600
Shuah Khan <skhan@linuxfoundation.org> wrote:

> On 9/11/23 19:24, Steven Rostedt wrote:
> > On Tue, 12 Sep 2023 10:10:39 +0900
> > "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> > 
> >> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> >>
> >> 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 <broonie@kernel.org>
> >> 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) <mhiramat@kernel.org>
> >> ---
> >>   Changes in v2:
> >>     - use -n option explictly for testing the string is non-zero.
> >> ---
> >>   tool
> > 
> > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> > 
> > -- Steve
> 
> Thank you all. Applied to linux-kselftest fixes branch for next rc
> 

Thanks Shuah!


> thanks,
> -- Shuah


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-13  3:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-12  1:10 [FIX PATCH v2] selftests: tracing: Fix to unmount tracefs for recovering environment Masami Hiramatsu (Google)
2023-09-12  1:24 ` Steven Rostedt
2023-09-12 15:35   ` Shuah Khan
2023-09-13  3:01     ` Masami Hiramatsu
2023-09-12 11:35 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®