[PATCH 2/2] trace-cmd record: Set clock to TSC when connecting to a proxy with kvm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

If the time synchronization protocol for the recorder to a agent proxy is
KVM, then it means that the TSC clock must be used. Force it when this is
discovered.

Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
 tracecmd/trace-record.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index ce20402af7c2..169836bd493c 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -3849,16 +3849,29 @@ static int open_guest_fifos(const char *guest, int **fds)
 	return i;
 }
 
+static bool clock_is_supported(struct tracefs_instance *instance, const char *clock);
+
 static int host_tsync(struct common_record_context *ctx,
 		      struct buffer_instance *instance,
 		      unsigned int tsync_port, char *proto)
 {
+	struct buffer_instance *iter_instance;
 	int guest_id = -1;
 	int fd;
 
 	if (!proto)
 		return -1;
 
+	/* If connecting to a proxy, the clock may still need to be set */
+	if (strcmp(proto, "kvm") == 0 &&
+	    clock_is_supported(NULL, TSC_CLOCK)) {
+		ctx->clock = TSC_CLOCK;
+		for_all_instances(iter_instance) {
+			iter_instance->clock = TSC_CLOCK;
+			set_clock(ctx, iter_instance);
+		}
+	}
+
 	if (is_network(instance)) {
 		fd = connect_port(instance->name, tsync_port,
 				  instance->port_type);
-- 
2.35.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux