bblum / landslide-simics

the landslide codebase (old simics version)
11 stars 9 forks source link

Make a better way to ensure one-thread-per-PP invariant in pintos. #165

Open bblum opened 9 years ago

bblum commented 9 years ago

the problem is this semaphore implementation

 72   old_level = intr_disable ();
 73   while (sema->value == 0)
 74     {
 75       list_push_back (&sema->waiters, &thread_current ()->elem);
 76       thread_block ();
 77     }
 78   sema->value--;
 79   intr_set_level (old_level);

where, during a paradise lost situation, you can go around a whole spin of that while loop without getting interrupts ever turned on.

So you can have two voluntary rescheds in a row, e.g. 5->4->1, where interrupts go off in 5 and don't come back on until 1. Then, ls->save.next_tid is 5, but voluntary_resched_tid is 4.

bblum commented 9 years ago

At the very least, there should be some logic to ensure that the correct stack trace (the old voluntary_resched_stack) gets saved in the PP instead of the one for the spinning (more recent) thread.