kernel/arch: Prioritize post_interrupt_callback over invoke_scheduler.
The profiler depends on this, and it's likely to invoke the scheduler of its own accord anyway. This logic could possibly be abstracted into a generic function, seeing as it's the same across all architectures...
This commit is contained in:
@@ -474,12 +474,7 @@ arch_arm_irq(struct iframe *iframe)
|
||||
|
||||
Thread* thread = thread_get_current_thread();
|
||||
cpu_status state = disable_interrupts();
|
||||
if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
} else if (thread->post_interrupt_callback != NULL) {
|
||||
if (thread->post_interrupt_callback != NULL) {
|
||||
void (*callback)(void*) = thread->post_interrupt_callback;
|
||||
void* data = thread->post_interrupt_data;
|
||||
|
||||
@@ -489,6 +484,11 @@ arch_arm_irq(struct iframe *iframe)
|
||||
restore_interrupts(state);
|
||||
|
||||
callback(data);
|
||||
} else if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -181,12 +181,7 @@ after_exception()
|
||||
{
|
||||
Thread* thread = thread_get_current_thread();
|
||||
cpu_status state = disable_interrupts();
|
||||
if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
} else if (thread->post_interrupt_callback != NULL) {
|
||||
if (thread->post_interrupt_callback != NULL) {
|
||||
void (*callback)(void*) = thread->post_interrupt_callback;
|
||||
void* data = thread->post_interrupt_data;
|
||||
|
||||
@@ -196,6 +191,11 @@ after_exception()
|
||||
restore_interrupts(state);
|
||||
|
||||
callback(data);
|
||||
} else if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -305,12 +305,7 @@ dprintf("handling I/O interrupts done\n");
|
||||
}
|
||||
|
||||
int state = disable_interrupts();
|
||||
if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
} else if (hardwareInterrupt && thread->post_interrupt_callback != NULL) {
|
||||
if (hardwareInterrupt && thread->post_interrupt_callback != NULL) {
|
||||
void (*callback)(void*) = thread->post_interrupt_callback;
|
||||
void* data = thread->post_interrupt_data;
|
||||
|
||||
@@ -320,6 +315,11 @@ dprintf("handling I/O interrupts done\n");
|
||||
restore_interrupts(state);
|
||||
|
||||
callback(data);
|
||||
} else if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
}
|
||||
|
||||
// pop iframe
|
||||
|
||||
@@ -246,12 +246,7 @@ dprintf("handling I/O interrupts done\n");
|
||||
}
|
||||
|
||||
cpu_status state = disable_interrupts();
|
||||
if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
} else if (thread->post_interrupt_callback != NULL) {
|
||||
if (thread->post_interrupt_callback != NULL) {
|
||||
void (*callback)(void*) = thread->post_interrupt_callback;
|
||||
void* data = thread->post_interrupt_data;
|
||||
|
||||
@@ -261,6 +256,11 @@ dprintf("handling I/O interrupts done\n");
|
||||
restore_interrupts(state);
|
||||
|
||||
callback(data);
|
||||
} else if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
}
|
||||
|
||||
// pop iframe
|
||||
|
||||
@@ -286,12 +286,7 @@ AfterInterrupt()
|
||||
|
||||
Thread* thread = thread_get_current_thread();
|
||||
cpu_status state = disable_interrupts();
|
||||
if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
} else if (thread->post_interrupt_callback != NULL) {
|
||||
if (thread->post_interrupt_callback != NULL) {
|
||||
void (*callback)(void*) = thread->post_interrupt_callback;
|
||||
void* data = thread->post_interrupt_data;
|
||||
|
||||
@@ -301,6 +296,11 @@ AfterInterrupt()
|
||||
restore_interrupts(state);
|
||||
|
||||
callback(data);
|
||||
} else if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -241,12 +241,7 @@ x86_hardware_interrupt(struct iframe* frame)
|
||||
}
|
||||
|
||||
cpu_status state = disable_interrupts();
|
||||
if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
} else if (thread->post_interrupt_callback != NULL) {
|
||||
if (thread->post_interrupt_callback != NULL) {
|
||||
void (*callback)(void*) = thread->post_interrupt_callback;
|
||||
void* data = thread->post_interrupt_data;
|
||||
|
||||
@@ -256,6 +251,11 @@ x86_hardware_interrupt(struct iframe* frame)
|
||||
restore_interrupts(state);
|
||||
|
||||
callback(data);
|
||||
} else if (thread->cpu->invoke_scheduler) {
|
||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||
scheduler_reschedule(B_THREAD_READY);
|
||||
schedulerLocker.Unlock();
|
||||
restore_interrupts(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user