trace-cmd time-sync: Pass role to tracecmd_tsync_get_proto()
PATCH 1/1 trace-cmd time-sync: Pass role to tracecmd_tsync_get_proto()
From: "Steven Rostedt (Google)" <[email protected]>
If the agent is a proxy server (host), then it should not pick the kvm protocol if it can not find the kvm offset and multiplier. If it does, it will fail the sync on the agent side which locks up the recorder side which will still run.
This also shows how fragile the tsync code is but that is another project to have fixed.
Signed-off-by Steven Rostedt (Google) <[email protected]>
---
Based on top of:
https://lore.kernel.org/all/[email protected]/
lib/trace-cmd/include/private/trace-cmd-private.h | 2 +- lib/trace-cmd/trace-timesync.c | 5 ++--- tracecmd/trace-agent.c | 6 ++++-- 3 files changed, 7 insertions(+), 6 deletions(-)
lib/trace-cmd/include/private/trace-cmd-private.h +1 -1
@@ -530,7 +530,7 @@ int tracecmd_tsync_get_offsets(struct tracecmd_time_sync *tsync, int cpu, int *count, long long **ts, long long **offsets, long long **scalings, long long **frac);const char *tracecmd_tsync_get_proto (const struct tracecmd_tsync_protos *protos, -const char *clock); +const char *clock,enum tracecmd_time_sync_role role);void tracecmd_tsync_free (struct tracecmd_time_sync *tsync);int tracecmd_write_guest_time_shift (struct tracecmd_output *handle,struct tracecmd_time_sync *tsync);
lib/trace-cmd/trace-timesync.c +2 -3
@@ -250,10 +250,9 @@ tsync_proto_select(const struct tracecmd_tsync_protos *protos,*/ __hidden const char *tracecmd_tsync_get_proto (const struct tracecmd_tsync_protos *protos, -const char *clock) +const char *clock,enum tracecmd_time_sync_role role) { -return tsync_proto_select (protos, clock, -TRACECMD_TIME_SYNC_ROLE_GUEST ); +return tsync_proto_select (protos, clock, role); }/**
tracecmd/trace-agent.c +4 -2
@@ -157,6 +157,7 @@ static void agent_handle(int sd, int nr_cpus, int page_size,unsigned long long peer_trace_id;unsigned long long trace_id;unsigned long flags = rcid >=0 ?TRACECMD_MSG_FL_PROXY :0 ; +enum tracecmd_time_sync_role tsync_role =TRACECMD_TIME_SYNC_ROLE_GUEST ;unsigned int remote_id;unsigned int local_id;unsigned int tsync_port =0 ;
@@ -180,6 +181,7 @@ static void agent_handle(int sd, int nr_cpus, int page_size,die ("Failed to allocate message handle" );if (rcid >=0 ) { + tsync_role =TRACECMD_TIME_SYNC_ROLE_HOST ; ret = tracecmd_msg_recv_trace_proxy(msg_handle, &argc, &argv, &use_fifos, &peer_trace_id, &tsync_protos,
@@ -197,8 +199,8 @@ static void agent_handle(int sd, int nr_cpus, int page_size,if (ret <0 )die ("Failed to receive trace request" ); - tsync_proto =tracecmd_tsync_get_proto (tsync_protos, -get_clock (argc, argv)); + tsync_proto =tracecmd_tsync_get_proto (tsync_protos,get_clock (argc, argv), + tsync_role);if (use_fifos &&open_agent_fifos (nr_cpus, fds)) use_fifos = false;
Signature · 1 line
2.35.1