Linux-Trace-Devel Archive on
 help / color / Atom feed
* [PATCH] trace-cmd record: Have -d only touch the instance its for
@ 2021-04-07 21:54 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2021-04-07 21:54 UTC (permalink / raw)
  To: Linux Trace Devel

From: "Steven Rostedt (VMware)" <>

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

Signed-off-by: Steven Rostedt (VMware) <>
 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);
@@ -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))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 21:54 [PATCH] trace-cmd record: Have -d only touch the instance its for Steven Rostedt

Linux-Trace-Devel Archive on

Archives are clonable:
	git clone --mirror linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ \
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone