Resolve strange IRQ issues which cause the scheduler to behave weirdly (IRQ mapping)
All checks were successful
Build documentation / build-and-deploy (push) Successful in 52s

This commit is contained in:
2026-01-19 01:51:34 +01:00
parent ddafc4eb19
commit 38a43b59b0
9 changed files with 36 additions and 35 deletions

View File

@@ -51,26 +51,27 @@ bool proc_mutex_unlock (struct proc* proc, struct proc_mutex* mutex) {
spin_lock (&mutex->suspension_q.lock, &ctxsq);
struct proc* resumed_proc;
struct proc* resumed_proc = NULL;
struct rb_node_link* node;
rbtree_first (&mutex->suspension_q.proc_tree, node);
if (node) {
resumed_proc = rbtree_entry (node, struct proc, suspension_link);
mutex->owner = resumed_proc;
mutex->locked = true;
spin_unlock (&mutex->suspension_q.lock, &ctxsq);
spin_unlock (&mutex->resource->lock, &ctxmt);
proc_resume (resumed_proc);
return true;
}
spin_unlock (&mutex->suspension_q.lock, &ctxsq);
mutex->locked = false;
mutex->owner = NULL;
spin_unlock (&mutex->suspension_q.lock, &ctxsq);
spin_unlock (&mutex->resource->lock, &ctxmt);
return true;

View File

@@ -355,10 +355,7 @@ void proc_kill (struct proc* proc, void* regs) {
DEBUG ("killed PID %d\n", proc->pid);
if (cpu == thiscpu)
proc_sched (regs);
else
cpu_request_sched (cpu);
cpu_request_sched (cpu);
}
void proc_suspend (struct proc* proc, struct proc_suspension_q* sq) {
@@ -408,13 +405,7 @@ void proc_resume (struct proc* proc) {
static void proc_irq_sched (void* arg, void* regs) {
(void)arg;
#if defined(__x86_64__)
struct saved_regs* s_regs = regs;
/* Only schedule, when we came from usermode */
if ((s_regs->cs & 0x03))
proc_sched (regs);
#endif
proc_sched (regs);
}
static void proc_kpproc_init (void) {
@@ -470,15 +461,15 @@ static void proc_kpproc_init (void) {
}
void proc_init (void) {
#if defined(__x86_64__)
irq_attach (&proc_irq_sched, NULL, SCHED_PREEMPT_TIMER, IRQ_INTERRUPT_SAFE);
irq_attach (&proc_irq_sched, NULL, CPU_REQUEST_SCHED, IRQ_INTERRUPT_SAFE);
#endif
proc_kpproc_init ();
struct proc* init = proc_spawn_rd ("init.exe");
proc_register (init, thiscpu);
#if defined(__x86_64__)
irq_attach (&proc_irq_sched, NULL, SCHED_PREEMPT_TIMER, IRQ_INTERRUPT_UNSAFE);
irq_attach (&proc_irq_sched, NULL, CPU_REQUEST_SCHED, IRQ_INTERRUPT_UNSAFE);
#endif
do_sched (init);
}