Interrupts
- Interrupts and exceptions (x86)
- Interrupts and exceptions (Linux)
- Deferrable work
- Timers
- cli (CLear Interrupt flag)
- sti (SeT Interrupt flag)
check current privilege level
if need to change privilege level
- change stack with the one associated with new privilege
- save old stack information on the new stack
save EFLAGS, CS, EIP on stack
save error code on stack in case of an abort
execute interrupt handler
- runs as a result of an IRQ (not of an exception)
- there is no ‘process’ context associated
- can’t trigger a context switch
- no sleep
- no schedule
- no user memory access
- implemented using deferrable functions
- softIRQ
- runs in interrupt context
- statically allocated
- same handler may run in parallel on multiple cores
- tasklet
- runs in interrupt context
- can be dinamically allocated
- same handler runs are serialized
- workqueues
- run in process context
- init: open_softirq()
- activation: raise_softirq()
- execution: do_softirq()
- it runs
- after an interrupt handler
- from the ksoftirqd kernel thread
- HI_SOFTIRQ
- TIMER_SOFTIRQ
- NET_TX_SOFTIRQ
- NET_RX_SOFTIRQ
- BLOCK_SOFTIRQ
- TASKLET_SOFTIRQ
- HRTIMER_SOFTIRQ
- minimum priority kernel thread
- runs self raised softirqs
- trade-off between softirqs and process/kernel threads
- implemented on top of soft IRQ
- TASKLET_SOFITIRQ, HI_SOFTIRQ
- init: tasklet_init
- activation: tasklet_schedule
- masking: tasklet_disable(), tasklet_enable()
- implemented on top of kernel threads
- TASKLET_SOFITIRQ, HI_SOFTIRQ
- init: INIT_WORK
- activation: schedule_work()
- implemented on top of TIMER_SOFTIRQ
- init: setup_timer
- activation: mod_timer