linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] trace-cmd record: Have -d only touch the instance its for
Date: Wed, 7 Apr 2021 17:54:27 -0400	[thread overview]
Message-ID: <20210407175427.536f0423@gandalf.local.home> (raw)

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The -d option for trace-cmd record disables the function tracing option.
It currently only does it for the top level, which does not affect the
instances. It should only disable the instances it is for and not touch
the top level if the top level is not part of the command line.

Also have set_ftrace return the result of set_ftrace_proc() if it was
called.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracecmd/trace-record.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 20cb5424..fd03a605 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -829,13 +829,14 @@ static int set_ftrace_proc(int set)
 	return ret;
 }
 
-static int set_ftrace(int set, int use_proc)
+static int set_ftrace(struct buffer_instance *instance, int set, int use_proc)
 {
 	char *path;
 	int ret;
 
-	/* First check if the function-trace option exists */
-	path = tracefs_get_tracing_file("options/function-trace");
+	path = tracefs_instance_get_file(instance->tracefs, "options/function-trace");
+	if (!path)
+		return -1;
 	ret = set_ftrace_enable(path, set);
 	tracefs_put_tracing_file(path);
 
@@ -843,7 +844,7 @@ static int set_ftrace(int set, int use_proc)
 	if (ret < 0 || set || use_proc)
 		ret = set_ftrace_proc(set);
 
-	return 0;
+	return ret;
 }
 
 static int write_file(const char *file, const char *str)
@@ -6653,7 +6654,7 @@ static void record_trace(int argc, char **argv,
 	page_size = getpagesize();
 
 	if (!is_guest(ctx->instance))
-		fset = set_ftrace(!ctx->disable, ctx->total_disable);
+		fset = set_ftrace(ctx->instance, !ctx->disable, ctx->total_disable);
 	if (!IS_CMDSET(ctx))
 		tracecmd_disable_all_tracing(1);
 
-- 
2.29.2


                 reply	other threads:[~2021-04-07 21:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210407175427.536f0423@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.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;
as well as URLs for NNTP newsgroup(s).