* [PATCH] trace-cmd: Unlock tsync mutex on thread exit
@ 2022-04-11 4:10 Tzvetomir Stoyanov (VMware)
0 siblings, 0 replies; only message in thread
From: Tzvetomir Stoyanov (VMware) @ 2022-04-11 4:10 UTC (permalink / raw)
To: rostedt; +Cc: linux-trace-devel, ycaibb
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@gmail.com>
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-11 4:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-11 4:10 [PATCH] trace-cmd: Unlock tsync mutex on thread exit Tzvetomir Stoyanov (VMware)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).