resourceview: fix stuck irq problem
authorpmf <pmf@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 21 May 2009 03:10:51 +0000 (03:10 +0000)
committerpmf <pmf@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 21 May 2009 03:10:51 +0000 (03:10 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@3384 04897980-b3bd-0310-b5e0-8ef037075253

trunk/lttv/lttv/lttv/state.c
trunk/lttv/lttv/lttv/state.h
trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c

index 821ea4d8112e70464777194f880398598e63aaa9..69497d37c681adc9031e50836698dc31653330e3 100644 (file)
@@ -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; j<nb_cpu; j++) {
       tcs->cpu_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; i<n; i++) {
-    retval[i].mode_stack = g_array_new(FALSE, FALSE, sizeof(LttvCPUMode));
-    retval[i].last_irq = states[i].last_irq;
     retval[i].last_soft_irq = states[i].last_soft_irq;
     retval[i].last_trap = states[i].last_trap;
+
+    retval[i].irq_stack = g_array_new(FALSE, FALSE, sizeof(gint));
+    g_array_set_size(retval[i].irq_stack, states[i].irq_stack->len);
+    for(j=0; j<states[i].irq_stack->len; 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; j<states[i].mode_stack->len; 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; i<n; i++) {
     g_array_free(states[i].mode_stack, TRUE);
+    g_array_free(states[i].irq_stack, TRUE);
   }
 
   g_free(states);
@@ -2565,7 +2573,7 @@ static gboolean irq_entry(void *hook_data, void *call_data)
   cpu_push_mode(s->cpu_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;
 }
index d3d28ec4af8eeaf7034ca4182272b176ad3704da..a65f2635eae4b8859cc7b1ee0b2cf1bb86bcb7b1 100644 (file)
@@ -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;
index 0befc8a78f052951181647e0459bb8dc8507d2b0..e0a0e347323f042e42eecd25131004be7d674228 100644 (file)
@@ -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;
 
This page took 0.027276 seconds and 4 git commands to generate.