From 5562ddce3ca8395196a310f23b566424ddc6d4a6 Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 8 Sep 2005 02:39:25 +0000 Subject: [PATCH] fix problem with time drift and process free : it may happen that a process is still on another CPU when freed git-svn-id: http://ltt.polymtl.ca/svn@1155 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/state.c | 11 ++++++++++- ltt/branches/poly/lttv/lttv/tracecontext.c | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index aef86ae5..930774a4 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -1338,10 +1338,19 @@ static gboolean process_free(void *hook_data, void *call_data) if(likely(process != NULL)) { /* release_task is happening at kernel level : we can now safely release * the data structure of the process */ + //This test is fun, though, as it may happen that + //at time t : CPU 0 : process_free + //at time t+150ns : CPU 1 : schedule out + //Clearly due to time imprecision, we disable it. (Mathieu) + //If this weird case happen, we have no choice but to put the + //Currently running process on the cpu to 0. guint num_cpus = ltt_trace_get_num_cpu(ts->parent.t); guint i; for(i=0; i< num_cpus; i++) { - g_assert(process != ts->running_process[i]); + //g_assert(process != ts->running_process[i]); + if(process == ts->running_process[i]) { + ts->running_process[i] = lttv_state_find_process(ts, i, 0); + } } exit_process(s, process); } diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index 8634b1be..e634ca57 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -1585,7 +1585,7 @@ guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self, lttv_process_traceset_begin(self, NULL, NULL, NULL, hooks, NULL); /* it will end on the end of traceset, or the fact that the - * hook returns TRUE. + * hook returns 2. */ lttv_process_traceset_middle(self, ltt_time_infinite, G_MAXUINT, NULL); -- 2.34.1