kernel: Allow scheduler initialization to fail
This commit is contained in:
parent
9ad558f01c
commit
6d7e291233
@ -67,19 +67,23 @@ scheduler_init(void)
|
|||||||
dprintf("scheduler_init: found %" B_PRId32 " logical cpu%s\n", cpuCount,
|
dprintf("scheduler_init: found %" B_PRId32 " logical cpu%s\n", cpuCount,
|
||||||
cpuCount != 1 ? "s" : "");
|
cpuCount != 1 ? "s" : "");
|
||||||
|
|
||||||
|
status_t result;
|
||||||
if (cpuCount > 1) {
|
if (cpuCount > 1) {
|
||||||
#if 0
|
#if 0
|
||||||
dprintf("scheduler_init: using affine scheduler\n");
|
dprintf("scheduler_init: using affine scheduler\n");
|
||||||
scheduler_affine_init();
|
result = scheduler_affine_init();
|
||||||
#else
|
#else
|
||||||
dprintf("scheduler_init: using simple SMP scheduler\n");
|
dprintf("scheduler_init: using simple SMP scheduler\n");
|
||||||
scheduler_simple_smp_init();
|
result = scheduler_simple_smp_init();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
dprintf("scheduler_init: using simple scheduler\n");
|
dprintf("scheduler_init: using simple scheduler\n");
|
||||||
scheduler_simple_init();
|
result = scheduler_simple_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result != B_OK)
|
||||||
|
panic("scheduler_init: failed to initialize scheduler\n");
|
||||||
|
|
||||||
// Disable rescheduling until the basic kernel initialization is done and
|
// Disable rescheduling until the basic kernel initialization is done and
|
||||||
// CPUs are ready to enable interrupts.
|
// CPUs are ready to enable interrupts.
|
||||||
sRescheduleFunction = gScheduler->reschedule;
|
sRescheduleFunction = gScheduler->reschedule;
|
||||||
|
@ -556,7 +556,7 @@ static scheduler_ops kAffineOps = {
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
status_t
|
||||||
scheduler_affine_init()
|
scheduler_affine_init()
|
||||||
{
|
{
|
||||||
gScheduler = &kAffineOps;
|
gScheduler = &kAffineOps;
|
||||||
@ -564,4 +564,6 @@ scheduler_affine_init()
|
|||||||
memset(sRunQueueSize, 0, sizeof(sRunQueueSize));
|
memset(sRunQueueSize, 0, sizeof(sRunQueueSize));
|
||||||
add_debugger_command_etc("run_queue", &dump_run_queue,
|
add_debugger_command_etc("run_queue", &dump_run_queue,
|
||||||
"List threads in run queue", "\nLists threads in run queue", 0);
|
"List threads in run queue", "\nLists threads in run queue", 0);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#define KERNEL_SCHEDULER_AFFINE_H
|
#define KERNEL_SCHEDULER_AFFINE_H
|
||||||
|
|
||||||
|
|
||||||
void scheduler_affine_init();
|
status_t scheduler_affine_init();
|
||||||
|
|
||||||
|
|
||||||
#endif // KERNEL_SCHEDULER_AFFINE_H
|
#endif // KERNEL_SCHEDULER_AFFINE_H
|
||||||
|
@ -328,13 +328,23 @@ static scheduler_ops kSimpleOps = {
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
status_t
|
||||||
scheduler_simple_init()
|
scheduler_simple_init()
|
||||||
{
|
{
|
||||||
sRunQueue = new(std::nothrow) RunQueue<Thread, THREAD_MAX_SET_PRIORITY>;
|
sRunQueue = new(std::nothrow) RunQueue<Thread, THREAD_MAX_SET_PRIORITY>;
|
||||||
|
if (sRunQueue == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
status_t result = sRunQueue->GetInitStatus();
|
||||||
|
if (result != B_OK) {
|
||||||
|
delete sRunQueue;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
gScheduler = &kSimpleOps;
|
gScheduler = &kSimpleOps;
|
||||||
|
|
||||||
add_debugger_command_etc("run_queue", &dump_run_queue,
|
add_debugger_command_etc("run_queue", &dump_run_queue,
|
||||||
"List threads in run queue", "\nLists threads in run queue", 0);
|
"List threads in run queue", "\nLists threads in run queue", 0);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#define KERNEL_SCHEDULER_SIMPLE_H
|
#define KERNEL_SCHEDULER_SIMPLE_H
|
||||||
|
|
||||||
|
|
||||||
void scheduler_simple_init();
|
status_t scheduler_simple_init();
|
||||||
|
|
||||||
|
|
||||||
#endif // KERNEL_SCHEDULER_SIMPLE_H
|
#endif // KERNEL_SCHEDULER_SIMPLE_H
|
||||||
|
@ -471,7 +471,7 @@ static scheduler_ops kSimpleSMPOps = {
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
status_t
|
||||||
scheduler_simple_smp_init()
|
scheduler_simple_smp_init()
|
||||||
{
|
{
|
||||||
sCPUCount = smp_get_num_cpus();
|
sCPUCount = smp_get_num_cpus();
|
||||||
@ -480,4 +480,6 @@ scheduler_simple_smp_init()
|
|||||||
|
|
||||||
add_debugger_command_etc("run_queue", &dump_run_queue,
|
add_debugger_command_etc("run_queue", &dump_run_queue,
|
||||||
"List threads in run queue", "\nLists threads in run queue", 0);
|
"List threads in run queue", "\nLists threads in run queue", 0);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#define KERNEL_SCHEDULER_SIMPLE_SMP_H
|
#define KERNEL_SCHEDULER_SIMPLE_SMP_H
|
||||||
|
|
||||||
|
|
||||||
void scheduler_simple_smp_init();
|
status_t scheduler_simple_smp_init();
|
||||||
|
|
||||||
|
|
||||||
#endif // KERNEL_SCHEDULER_SIMPLE_SMP_H
|
#endif // KERNEL_SCHEDULER_SIMPLE_SMP_H
|
||||||
|
Loading…
Reference in New Issue
Block a user