Interrupts in SMP system
Posted: Fri Nov 13, 2009 8:49 pm
Hi,
I have implemented multiprocessor init in my kernel. I have it working with my scheduler and timer (apic timer). Each cpu sets its own apic timer when exiting the scheduler. The amount of time is dependent on scheduling parameters for current thread/process.
Implemented mutexes and locks to isolate the critical sections. Everything works fine. Threads run in paralell and threads are scheduled in and out like before when i only ran on one cpu.
All cpu's can interrupt each other if needed with an IPI. Either IPI to scheduler so that all cpus will enter scheduler or IPI for each cpu to synchronize in kernel reading a message.
I use same IDT and GDT for all processors so that all can access the same routines.
I guess i could deliver the interrupts to different cpus based on randomness or by priority or something.. Have not thought this through yet..
But i have a question. I have problem figuring out how to handle keyboard irq etc.. Anyone have a graphical schematic on how pic/apic/ioapic are connected so that i can understand it. Should one irq go to same cpu always? or should it vary? The same issue goes probably for all IRQ's from external hw.
-
Thomas
I have implemented multiprocessor init in my kernel. I have it working with my scheduler and timer (apic timer). Each cpu sets its own apic timer when exiting the scheduler. The amount of time is dependent on scheduling parameters for current thread/process.
Implemented mutexes and locks to isolate the critical sections. Everything works fine. Threads run in paralell and threads are scheduled in and out like before when i only ran on one cpu.
All cpu's can interrupt each other if needed with an IPI. Either IPI to scheduler so that all cpus will enter scheduler or IPI for each cpu to synchronize in kernel reading a message.
I use same IDT and GDT for all processors so that all can access the same routines.
I guess i could deliver the interrupts to different cpus based on randomness or by priority or something.. Have not thought this through yet..
But i have a question. I have problem figuring out how to handle keyboard irq etc.. Anyone have a graphical schematic on how pic/apic/ioapic are connected so that i can understand it. Should one irq go to same cpu always? or should it vary? The same issue goes probably for all IRQ's from external hw.
-
Thomas