The logic for synchronising host and guest time stamps uses pthreads and mutexes. The guest pthread locks a mutex on the beginning of each synchronization iteration and uses it to wait on a conditional variable. When the synchronization is done and the thread exists, this mutex should be unlocked. fixes: 08b9d507 ("trace-cmd: Basic infrastructure for host - guest timestamp synchronization") Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215808 Reported-by: Ryan <ycaibb@xxxxxxxxx> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx> --- lib/trace-cmd/trace-timesync.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/trace-cmd/trace-timesync.c b/lib/trace-cmd/trace-timesync.c index f8ec15a3..90ffa6d0 100644 --- a/lib/trace-cmd/trace-timesync.c +++ b/lib/trace-cmd/trace-timesync.c @@ -807,8 +807,10 @@ static int tsync_with_guest(struct tracecmd_time_sync *tsync) first = false; pthread_barrier_wait(&tsync->first_sync); } - if (end || i < tsync->vcpu_count) + if (end || i < tsync->vcpu_count) { + pthread_mutex_unlock(&tsync->lock); break; + } if (tsync->loop_interval > 0) { get_ts_loop_delay(&timeout, tsync->loop_interval); ret = pthread_cond_timedwait(&tsync->cond, &tsync->lock, &timeout); -- 2.35.1