mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Cc: linux-kernel@vger.kernel.org,
	Josh Triplett <josh@joshtriplett.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Shuah Khan <shuah@kernel.org>, Joel <agnel.joel@gmail.com>,
	rcu@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2] rcutorture: Copy out ftrace into its own console file
Date: Mon, 14 Aug 2023 14:27:34 -0700	[thread overview]
Message-ID: <8f952ce7-2122-45a4-82a3-a4e4dcd85ff4@paulmck-laptop> (raw)
In-Reply-To: <20230813203602.GA696907@google.com>

On Sun, Aug 13, 2023 at 08:36:02PM +0000, Joel Fernandes (Google) wrote:
> From: Joel Fernandes (Google) <joel@joelfernandes.org>
> 
> Often times during debugging, it is difficult to jump to the ftrace dump
> in the console log and treat it independent of the result of the log file.
> Copy the contents of the buffers into its own file to make it easier to refer
> to the ftrace dump. The original ftrace dump is still available in the
> console log if it is desired to refer to it there.
> 
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>

Queued, thank you!  I did the usual wordsmithing, please see below.

I also fixed up the indentation and spacing.  I don't know about you,
but the initial format made that a bit hard for me to read.  ;-)

If there are multiple ftrace dumps in a given console.log file, this
will concatenate them.  Is that the intent?

							Thanx, Paul

------------------------------------------------------------------------

commit ce1cf26540b96fc52aec6f6f8e365960ca79a0ad
Author: Joel Fernandes (Google) <joel@joelfernandes.org>
Date:   Sun Aug 13 20:36:02 2023 +0000

    rcutorture: Copy out ftrace into its own console file
    
    When debugging it can be difficult to quickly find the ftrace dump
    withiin the console log, which in turn makes it difficult to process it
    independent of the result of the console output.  This commit therefore
    copies the contents of the buffers into its own file to make it easier
    to locate and process the ftrace dump. The original ftrace dump is still
    available in the console log in cases where it is more convenient to
    process it there, for example, when you have a script that processes
    console output as well as ftrace-dump data.
    
    Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

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..40bcddf5f197
--- 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

  reply	other threads:[~2023-08-14 21:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-13 20:36 Joel Fernandes (Google)
2023-08-14 21:27 ` Paul E. McKenney [this message]
2023-08-14 22:03   ` Joel Fernandes
2023-08-14 22:27     ` Paul E. McKenney
2023-08-15  2:14       ` Joel Fernandes
2023-08-15 18:45         ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8f952ce7-2122-45a4-82a3-a4e4dcd85ff4@paulmck-laptop \
    --to=paulmck@kernel.org \
    --cc=agnel.joel@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®