mywiki:linux:linux_kernel_notes
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mywiki:linux:linux_kernel_notes [2015/04/15 15:00] – 180.87.185.80 | mywiki:linux:linux_kernel_notes [2019/09/15 18:55] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Spin Lock ====== | + | | [[http:// |
| - | + | ||
| - | + | ||
| - | ===== Table of Minimum Spin Lock Requirements ===== | + | |
| - | + | ||
| - | + | ||
| - | The following table lists the minimum locking requirements between various contexts. In some cases, the same context can only be running on one CPU at a time, so no locking is required for that context (eg. a particular thread can only run on one CPU at a time, but if it needs shares data with another thread, locking is required). \\ | + | |
| - | + | ||
| - | Remember the advice above: you can always use spin_lock_irqsave(), | + | |
| - | + | ||
| - | + | ||
| - | | | IRQ Handler A | IRQ Handler B | Softirq A | Softirq B | Tasklet A | Tasklet B | Timer A | Timer B | User Context A | User Context B | | + | |
| - | | IRQ Handler A | None | | + | |
| - | | IRQ Handler B | spin_lock_irqsave | None | | + | |
| - | | Softirq A | spin_lock_irq | spin_lock_irq | spin_lock | | + | |
| - | | Softirq B | spin_lock_irq | spin_lock_irq | spin_lock | spin_lock | | + | |
| - | | Tasklet A | spin_lock_irq | spin_lock_irq | spin_lock | spin_lock | None | | + | |
| - | | Tasklet B | spin_lock_irq | spin_lock_irq | spin_lock | spin_lock | spin_lock | None | | + | |
| - | | Timer A | spin_lock_irq | spin_lock_irq | spin_lock | spin_lock | spin_lock | spin_lock | None | | + | |
| - | | Timer B | spin_lock_irq | spin_lock_irq | spin_lock | spin_lock | spin_lock | spin_lock | spin_lock | None | | + | |
| - | | User Context A | spin_lock_irq | spin_lock_irq | spin_lock_bh | spin_lock_bh | spin_lock_bh | spin_lock_bh | spin_lock_bh | spin_lock_bh | None | | + | |
| - | | User Context B | spin_lock_irq | spin_lock_irq | spin_lock_bh | spin_lock_bh | spin_lock_bh | spin_lock_bh | spin_lock_bh | spin_lock_bh | down_interruptible | + | |
| ===== Kernel Context knowledge ===== | ===== Kernel Context knowledge ===== | ||
| | process context | includes user context, kernel thread, work queue | | | process context | includes user context, kernel thread, work queue | | ||
| - | | User Context | The kernel executing on behalf of a particular process (ie. a system call or trap, ioctl, module_init, | + | | User Context | The kernel executing on behalf of a particular process (ie. a system call or trap, ioctl, module_init, |
| - | | Interrupt context | includes kernel timer, softirq, hard irq, tasklet | if in_interrupt() true | | + | | Userspace (not kernel) | A process executing its own code outside the kernel |
| - | | Userspace | A process executing its own code outside the kernel | | + | | Interrupt context | includes |
| - | | Hardware Interrupt / Hardware IRQ | Hardware interrupt request | if in_irq() true | | + | | Hardware IRQ | Hardware interrupt request | if in_irq() true | |
| - | | Software Interrupt / softirq | + | | Softirq |
| - | | if in_irq() false and in_softirq() true | | + | |
| | Tasklet | A dynamically-registered software interrupt, which is guaranteed to only run on one CPU at a time | | | Tasklet | A dynamically-registered software interrupt, which is guaranteed to only run on one CPU at a time | | ||
| | Timer | which is running at (or close to) a given time. When running, it is just like a tasklet (in fact, they are called from the TIMER_SOFTIRQ). | | | Timer | which is running at (or close to) a given time. When running, it is just like a tasklet (in fact, they are called from the TIMER_SOFTIRQ). | | ||
| - | |||
| - | |||
mywiki/linux/linux_kernel_notes.1429081208.txt.gz · Last modified: (external edit)
