public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rcutorture: Copy out ftrace into its own console file
@ 2023-08-13  3:37 Joel Fernandes (Google)
  2023-08-13  3:40 ` Joel Fernandes
  2023-08-13  6:28 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Joel Fernandes (Google) @ 2023-08-13  3:37 UTC (permalink / raw)
  To: linux-kernel, Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Shuah Khan
  Cc: Joel, Joel Fernandes, rcu, linux-kselftest

From: Joel <agnel.joel@gmail.com>

Often times it is difficult to jump to the ftrace buffers and treat it
independently during debugging. Copy the contents of the buffers into
its own file.

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 .../selftests/rcutorture/bin/functions.sh     | 24 +++++++++++++++++++
 .../selftests/rcutorture/bin/parse-console.sh |  7 ++++++
 2 files changed, 31 insertions(+)
 mode change 100644 => 100755 tools/testing/selftests/rcutorture/bin/functions.sh

diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh
old mode 100644
new mode 100755
index b8e2ea23cb3f..2ec4ab87a7f0
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -331,3 +331,27 @@ specify_qemu_net () {
 		echo $1 -net none
 	fi
 }
+
+# Extract the ftrace output from the console log output
+# The ftrace output looks in the logs looks like:
+# Dumping ftrace buffer:
+# ---------------------------------
+# [...]
+# ---------------------------------
+extract_ftrace_from_console() {
+        awk '
+        /Dumping ftrace buffer:/ {
+        capture = 1
+        next
+    }
+    /---------------------------------/ {
+        if(capture == 1) {
+            capture = 2
+            next
+        } else if(capture == 2) {
+            capture = 0
+        }
+    }
+    capture == 2
+    ' "$1";
+}
diff --git a/tools/testing/selftests/rcutorture/bin/parse-console.sh b/tools/testing/selftests/rcutorture/bin/parse-console.sh
index 9ab0f6bc172c..e3d2f69ec0fb 100755
--- a/tools/testing/selftests/rcutorture/bin/parse-console.sh
+++ b/tools/testing/selftests/rcutorture/bin/parse-console.sh
@@ -182,3 +182,10 @@ if ! test -s $file.diags
 then
 	rm -f $file.diags
 fi
+
+# Call extract_ftrace_from_console function, if the output is empty,
+# don't create $file.ftrace. Otherwise output the results to $file.ftrace
+extract_ftrace_from_console $file > $file.ftrace
+if [ ! -s $file.ftrace ]; then
+	rm -f $file.ftrace
+fi
-- 
2.41.0.640.ga95def55d0-goog


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

* Re: [PATCH] rcutorture: Copy out ftrace into its own console file
  2023-08-13  3:37 [PATCH] rcutorture: Copy out ftrace into its own console file Joel Fernandes (Google)
@ 2023-08-13  3:40 ` Joel Fernandes
  2023-08-13  6:28 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Joel Fernandes @ 2023-08-13  3:40 UTC (permalink / raw)
  To: linux-kernel, Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Shuah Khan

On Sat, Aug 12, 2023 at 11:37 PM Joel Fernandes (Google)
<joel@joelfernandes.org> wrote:
>
> From: Joel <agnel.joel@gmail.com>

Sheesh, 'From' got messed up with my other email address. I can resend
unless Paul is OK with the patch and can fixup my From (appreciate the
help!).

 - Joel

>
> Often times it is difficult to jump to the ftrace buffers and treat it
> independently during debugging. Copy the contents of the buffers into
> its own file.
>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  .../selftests/rcutorture/bin/functions.sh     | 24 +++++++++++++++++++
>  .../selftests/rcutorture/bin/parse-console.sh |  7 ++++++
>  2 files changed, 31 insertions(+)
>  mode change 100644 => 100755 tools/testing/selftests/rcutorture/bin/functions.sh
>
> diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh
> old mode 100644
> new mode 100755
> index b8e2ea23cb3f..2ec4ab87a7f0
> --- a/tools/testing/selftests/rcutorture/bin/functions.sh
> +++ b/tools/testing/selftests/rcutorture/bin/functions.sh
> @@ -331,3 +331,27 @@ specify_qemu_net () {
>                 echo $1 -net none
>         fi
>  }
> +
> +# Extract the ftrace output from the console log output
> +# The ftrace output looks in the logs looks like:
> +# Dumping ftrace buffer:
> +# ---------------------------------
> +# [...]
> +# ---------------------------------
> +extract_ftrace_from_console() {
> +        awk '
> +        /Dumping ftrace buffer:/ {
> +        capture = 1
> +        next
> +    }
> +    /---------------------------------/ {
> +        if(capture == 1) {
> +            capture = 2
> +            next
> +        } else if(capture == 2) {
> +            capture = 0
> +        }
> +    }
> +    capture == 2
> +    ' "$1";
> +}
> diff --git a/tools/testing/selftests/rcutorture/bin/parse-console.sh b/tools/testing/selftests/rcutorture/bin/parse-console.sh
> index 9ab0f6bc172c..e3d2f69ec0fb 100755
> --- a/tools/testing/selftests/rcutorture/bin/parse-console.sh
> +++ b/tools/testing/selftests/rcutorture/bin/parse-console.sh
> @@ -182,3 +182,10 @@ if ! test -s $file.diags
>  then
>         rm -f $file.diags
>  fi
> +
> +# Call extract_ftrace_from_console function, if the output is empty,
> +# don't create $file.ftrace. Otherwise output the results to $file.ftrace
> +extract_ftrace_from_console $file > $file.ftrace
> +if [ ! -s $file.ftrace ]; then
> +       rm -f $file.ftrace
> +fi
> --
> 2.41.0.640.ga95def55d0-goog
>

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

* Re: [PATCH] rcutorture: Copy out ftrace into its own console file
  2023-08-13  3:37 [PATCH] rcutorture: Copy out ftrace into its own console file Joel Fernandes (Google)
  2023-08-13  3:40 ` Joel Fernandes
@ 2023-08-13  6:28 ` Greg KH
  2023-08-13 14:41   ` Joel Fernandes
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2023-08-13  6:28 UTC (permalink / raw)
  To: Joel Fernandes (Google)
  Cc: linux-kernel, Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Shuah Khan, Joel, rcu,
	linux-kselftest

On Sun, Aug 13, 2023 at 03:37:36AM +0000, Joel Fernandes (Google) wrote:
> From: Joel <agnel.joel@gmail.com>
> 
> Often times it is difficult to jump to the ftrace buffers and treat it
> independently during debugging. Copy the contents of the buffers into
> its own file.
> 
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>

"From:" doesn't match the signed-off-by :(


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

* Re: [PATCH] rcutorture: Copy out ftrace into its own console file
  2023-08-13  6:28 ` Greg KH
@ 2023-08-13 14:41   ` Joel Fernandes
  0 siblings, 0 replies; 4+ messages in thread
From: Joel Fernandes @ 2023-08-13 14:41 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-kernel, Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Shuah Khan, Joel, rcu,
	linux-kselftest

On Sun, Aug 13, 2023 at 2:28 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sun, Aug 13, 2023 at 03:37:36AM +0000, Joel Fernandes (Google) wrote:
> > From: Joel <agnel.joel@gmail.com>
> >
> > Often times it is difficult to jump to the ftrace buffers and treat it
> > independently during debugging. Copy the contents of the buffers into
> > its own file.
> >
> > Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
>
> "From:" doesn't match the signed-off-by :(

Yeah I suck. Apparently I still don't know how to send a patch after 13 years.

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

end of thread, other threads:[~2023-08-13 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-13  3:37 [PATCH] rcutorture: Copy out ftrace into its own console file Joel Fernandes (Google)
2023-08-13  3:40 ` Joel Fernandes
2023-08-13  6:28 ` Greg KH
2023-08-13 14:41   ` Joel Fernandes

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