Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
* Use instance->name for guests and not tracefs instance name
@ 2021-02-03 22:29 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2021-02-03 22:29 UTC (permalink / raw)
  To: Linux Trace Devel

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

Recording a guest does not use tracefs, revert part of a7f44264f
("trace-cmd: New libtracefs APIs for ftrace instances") that mistakenly
switched the guest set up from instance->name to
tracefs_instance_get_name().

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

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 3bcb2403..a1c4e919 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -3658,11 +3658,9 @@ static void connect_to_agent(struct buffer_instance *instance)
 	unsigned int *ports;
 	int i, *fds = NULL;
 	bool use_fifos = false;
-	const char *name;
 
-	name = tracefs_instance_get_name(instance->tracefs);
 	if (!no_fifos) {
-		nr_fifos = open_guest_fifos(name, &fds);
+		nr_fifos = open_guest_fifos(instance->name, &fds);
 		use_fifos = nr_fifos > 0;
 	}
 
@@ -3703,7 +3701,7 @@ static void connect_to_agent(struct buffer_instance *instance)
 			instance->tsync.proto_name = strdup(tsync_protos_reply);
 			printf("Negotiated %s time sync protocol with guest %s\n",
 				instance->tsync.proto_name,
-				tracefs_instance_get_name(instance->tracefs));
+				instance->name);
 			tracecmd_host_tsync(instance, tsync_port);
 		} else
 			warning("Failed to negotiate timestamps synchronization with the guest");
@@ -3714,7 +3712,7 @@ static void connect_to_agent(struct buffer_instance *instance)
 		if (nr_cpus != nr_fifos) {
 			warning("number of FIFOs (%d) for guest %s differs "
 				"from number of virtual CPUs (%d)",
-				nr_fifos, name, nr_cpus);
+				nr_fifos, instance->name, nr_cpus);
 			nr_cpus = nr_cpus < nr_fifos ? nr_cpus : nr_fifos;
 		}
 		free(ports);
@@ -3747,8 +3745,7 @@ static void setup_guest(struct buffer_instance *instance)
 	int fd;
 
 	/* Create a place to store the guest meta data */
-	file = trace_get_guest_file(output_file,
-				    tracefs_instance_get_name(instance->tracefs));
+	file = trace_get_guest_file(output_file, instance->name);
 	if (!file)
 		die("Failed to allocate memory");
 
@@ -5771,6 +5768,7 @@ static void parse_record_options(int argc,
 			ctx->instance->flags |= BUFFER_FL_GUEST;
 			ctx->instance->cid = cid;
 			ctx->instance->port = port;
+			ctx->instance->name = name;
 			add_instance(ctx->instance, 0);
 			break;
 		}
-- 
2.25.4


^ 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-02-03 22:29 Use instance->name for guests and not tracefs instance name Steven Rostedt

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 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/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git