[coyotos-dev] Usermode interrupt handling delayed until end of quanta?

Jeroen C. Visser jeroen.c.visser at gmail.com
Wed Jan 23 16:02:07 EST 2008

Hello Jonathan,

I your last commit you say:

The interrupt vector wait logic should now be working.

In theory, it should now be possible to wait for an interrupt,
do something about it, and then go back and wait for the next

Hmm... I managed to get a user-mode serial driver working before these
latest changes :) These changes are merely a cleanup and making things
more robust?

I did notice that a user-mode process interrupted by an IRQ gets to
finish its quantum before the IRQ handler process is scheduled. I used
the following patch to make things work even with 1 second quanta. I
bet you it is incorrect in some way or other :)

   if (atomic_read(&CUR_CPU->flags) & CPUFL_NEED_WAKEUP)

   flags_t f = locally_disable_interrupts();

-  if (CUR_CPU->wakeVectors)
+  if (CUR_CPU->wakeVectors) {
+    XTRACE("CUR_CPU->wakeVectors != 0x0");
+    // @bug
+    if(inProc) {
+      atomic_set_bits(&MY_CPU(current)->issues, pi_Preempted);
+      atomic_set_bits(&CUR_CPU->flags, CPUFL_WAS_PREEMPTED);
+    }
+  }

   // Last check for preemption interrupt:
   if (atomic_read(&p->issues) & pi_Preempted) {
-    printf("  process was preempted at last gasp!\n");
+    XTRACE("  process was preempted at last gasp!");


More information about the coyotos-dev mailing list