From: pmf Date: Thu, 21 May 2009 03:10:51 +0000 (+0000) Subject: resourceview: fix stuck irq problem X-Git-Tag: v0.12.20~105 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=165051d2d5b7e67c409ff3cc851fcebbb709e9c8;p=lttv.git resourceview: fix stuck irq problem git-svn-id: http://ltt.polymtl.ca/svn@3384 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/trunk/lttv/lttv/lttv/state.c b/trunk/lttv/lttv/lttv/state.c index 821ea4d8..69497d37 100644 --- a/trunk/lttv/lttv/lttv/state.c +++ b/trunk/lttv/lttv/lttv/state.c @@ -467,7 +467,8 @@ restore_init_state(LttvTraceState *self) /* reset cpu states */ if(self->cpu_states[i].mode_stack->len > 0) { g_array_remove_range(self->cpu_states[i].mode_stack, 0, self->cpu_states[i].mode_stack->len); - self->cpu_states[i].last_irq = -1; + if(self->cpu_states[i].irq_stack->len) + g_array_remove_range(self->cpu_states[i].irq_stack, 0, self->cpu_states[i].irq_stack->len); self->cpu_states[i].last_soft_irq = -1; self->cpu_states[i].last_trap = -1; } @@ -649,7 +650,7 @@ init(LttvTracesetState *self, LttvTraceset *ts) tcs->cpu_states = g_new(LttvCPUState, nb_cpu); for(j = 0; jcpu_states[j].mode_stack = g_array_new(FALSE, FALSE, sizeof(LttvCPUMode)); - tcs->cpu_states[j].last_irq = -1; + tcs->cpu_states[j].irq_stack = g_array_new(FALSE, FALSE, sizeof(gint)); tcs->cpu_states[j].last_soft_irq = -1; tcs->cpu_states[j].last_trap = -1; g_assert(tcs->cpu_states[j].mode_stack != NULL); @@ -1328,10 +1329,16 @@ static LttvCPUState *lttv_state_copy_cpu_states(LttvCPUState *states, guint n) retval = g_new(LttvCPUState, n); for(i=0; ilen); + for(j=0; jlen; j++) { + g_array_index(retval[i].irq_stack, gint, j) = g_array_index(states[i].irq_stack, gint, j); + } + + retval[i].mode_stack = g_array_new(FALSE, FALSE, sizeof(LttvCPUMode)); g_array_set_size(retval[i].mode_stack, states[i].mode_stack->len); for(j=0; jlen; j++) { g_array_index(retval[i].mode_stack, GQuark, j) = g_array_index(states[i].mode_stack, GQuark, j); @@ -1347,6 +1354,7 @@ static void lttv_state_free_cpu_states(LttvCPUState *states, guint n) for(i=0; icpu_state, LTTV_CPU_IRQ); /* update irq status */ - s->cpu_state->last_irq = irq; + g_array_append_val(s->cpu_state->irq_stack, irq); irq_push_mode(&ts->irq_states[irq], LTTV_IRQ_BUSY); return FALSE; @@ -2601,8 +2609,11 @@ static gboolean irq_exit(void *hook_data, void *call_data) cpu_pop_mode(s->cpu_state); /* update irq status */ - if (s->cpu_state->last_irq != -1) - irq_pop_mode(&ts->irq_states[s->cpu_state->last_irq]); + if (s->cpu_state->irq_stack->len > 0) { + gint last = g_array_index(s->cpu_state->irq_stack, gint, s->cpu_state->irq_stack->len-1); + g_array_remove_index(s->cpu_state->irq_stack, s->cpu_state->irq_stack->len-1); + irq_pop_mode(&ts->irq_states[last]); + } return FALSE; } diff --git a/trunk/lttv/lttv/lttv/state.h b/trunk/lttv/lttv/lttv/state.h index d3d28ec4..a65f2635 100644 --- a/trunk/lttv/lttv/lttv/state.h +++ b/trunk/lttv/lttv/lttv/state.h @@ -333,7 +333,7 @@ GType lttv_traceset_state_get_type (void); typedef struct _LttvCPUState { GArray *mode_stack; - gint last_irq; + GArray *irq_stack; gint last_soft_irq; gint last_trap; } LttvCPUState; diff --git a/trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c b/trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c index 0befc8a7..e0a0e347 100644 --- a/trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c +++ b/trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c @@ -846,9 +846,7 @@ int before_execmode_hook_irq(void *hook_data, void *call_data) if (minfo->name == LTT_EVENT_IRQ_ENTRY) { irq = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); } else if (minfo->name == LTT_EVENT_IRQ_EXIT) { - irq = ts->cpu_states[cpu].last_irq; - if (irq == -1) - return 0; + irq = g_array_index(ts->cpu_states[cpu].irq_stack, gint, ts->cpu_states[cpu].irq_stack->len-1); } else return 0; @@ -1029,8 +1027,6 @@ int before_execmode_hook_soft_irq(void *hook_data, void *call_data) softirq = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); } else if (minfo->name == LTT_EVENT_SOFT_IRQ_EXIT) { softirq = ts->cpu_states[cpu].last_soft_irq; - if (softirq == -1) - return 0; } else return 0; @@ -1205,9 +1201,6 @@ int before_execmode_hook_trap(void *hook_data, void *call_data) || minfo->name == LTT_EVENT_PAGE_FAULT_EXIT || minfo->name == LTT_EVENT_PAGE_FAULT_NOSEM_EXIT) { trap = ts->cpu_states[cpu].last_trap; - /* Handle case where a trace starts with a trap exit event */ - if (trap == -1) - return 0; } else return 0;