Fix the underlying problem that caused the issue of running threads being

enqueued into the run_queue again. Modified the workaround to a panic in the
scheduler so we notice when something else does the same.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23731 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2008-01-25 13:27:00 +00:00
parent 28fa064595
commit 2f3f3d79b5
2 changed files with 9 additions and 13 deletions
+3 -11
View File
@@ -219,17 +219,9 @@ scheduler_reschedule(void)
if (nextThread->cpu if (nextThread->cpu
&& nextThread->cpu->cpu_num != oldThread->cpu->cpu_num) { && nextThread->cpu->cpu_num != oldThread->cpu->cpu_num) {
// ToDo: This thread is still running on another CPU. The panic("thread in run queue that's still running on another CPU!\n");
// thread just missed a semaphore, put itself into the notify // ToDo: remove this check completely when we're sure that this
// queue but was not yet rescheduled. During this time frame // cannot happen anymore.
// release_sem_etc() was called for said semaphore and put the
// thread into the run queue to notify it.
// Therefore it is now _still_ running on one CPU and _already_
// part of the run queue again. We have to skip this thread
// here because otherwise we would overwrite the thread->cpu
// pointer with the current CPU which would make both CPUs
// "think" they are the same one and kill off the scheduler
// logic in here as well as all calls to smp_get_current_cpu().
prevThread = nextThread; prevThread = nextThread;
nextThread = nextThread->queue_next; nextThread = nextThread->queue_next;
continue; continue;
+5 -1
View File
@@ -1065,7 +1065,6 @@ release_sem_etc(sem_id id, int32 count, uint32 flags)
// release this thread // release this thread
thread = thread_dequeue(&sSems[slot].u.used.queue); thread = thread_dequeue(&sSems[slot].u.used.queue);
thread_enqueue(thread, &releaseQueue); thread_enqueue(thread, &releaseQueue);
thread->state = B_THREAD_READY;
thread->sem.count = 0; thread->sem.count = 0;
} }
} else if (flags & B_RELEASE_IF_WAITING_ONLY) } else if (flags & B_RELEASE_IF_WAITING_ONLY)
@@ -1091,8 +1090,13 @@ release_sem_etc(sem_id id, int32 count, uint32 flags)
thread->next_priority = thread->priority >= B_FIRST_REAL_TIME_PRIORITY ? thread->next_priority = thread->priority >= B_FIRST_REAL_TIME_PRIORITY ?
thread->priority : thread->priority + 1; thread->priority : thread->priority + 1;
#endif #endif
if (thread->state == B_THREAD_RUNNING)
thread->next_state = B_THREAD_READY;
else {
thread->state = B_THREAD_READY;
scheduler_enqueue_in_run_queue(thread); scheduler_enqueue_in_run_queue(thread);
} }
}
if ((flags & B_DO_NOT_RESCHEDULE) == 0) if ((flags & B_DO_NOT_RESCHEDULE) == 0)
scheduler_reschedule(); scheduler_reschedule();