Interrupts and Bottom Halves in Linux Kernel

Linux Kernel Programming - Interrupts and Bottom Halves
Instructor:
Linux Trainer
10 students enrolled
English [Auto]
Interrupts and Bottom Halves

What you will learn from this course

Interrupts and Exceptions
Types of Interrupts and Exceptions : Level Triggerred, Edge Triggerred, Traps, Faults
Programmable Interrput Controller, Advanced Programmable Interrupt Controller (APIC) – IO APIC, Local APIC
Find out information about your x86 CPU using CPUID Instruction
What happens when there is interrupt
How does CPU finds the interrupt handler: Interrupt Request, Interrupt Vector and Interrupt Descriptor Table
Interrupt Handling and Statistics in Linux Kernel : Interrupt sharing, return values, IRQ Affinity
Linux Driver for keyboard, mouse, ethernet interrupts
Write a Keylogger in Linux Kernel which will log all characters typed
Enabling/Disabling Interrupts
What happens when we add sleep and delay in interrupt handler
Top and Bottom Halves: Threaded IRQs,Softirqs, Tasklets and Workqueues (System Workqueues and own workqueues)
Differences between softirqs, tasklets and workqueues

Files
/proc/cpuinfo
/proc/interrupts
/proc/irq
/proc/softirqs

API’s/Macros/Structures

request_irq, irq_handler_t
local_irq_enable, local_irq_disable, cli, sei
local_irq_save, local_irq_restore
disable_irq, enable_irq
disable_irq_nosync, synchronize_irq
irqs_disabled
in_interrupt
request_threaded_irq
struct softirq_action, NR_SOFTIRQS
open_softirq, raise_softirq
in_irq
local_softirq_pending
in_softirq
local_bh_enable, local_bh_disable
spin_lock_bh, spin_unlock_bh
struct tasklet_struct, DECLARE_TASKLET, DECLARE_TASKLET_DISABLED, tasklet_init, tasklet_schedule, tasklet_hi_schedule
tasklet_trylock, tasklet_unlock, tasklet_disable, tasklet_disable_nosync, tasklet_enable, tasklet_kill
struct workqueue_struct, struct work_struct, DECLARE_WORK, INIT_WORK, queue_work, queue_work_on, schedule_work, schedule_work_on, cancel_work_sync, flush_work
struct delayed_work, DELAYED_DECLARED_WORK, INIT_DELAYED_WORK, schedule_delayed_work, schedule_delayed_work_on, flush_delayed_work, cancel_delayed_work
alloc_workqueue, destroy_workqueue, flush_workqueue, alloc_ordered_workqueue,

Commands
watch
lspci
dmesg

 

Introduction

1
Introduction
2
Exceptions
3
Traps and Faults
4
How debugger works
5
Triggerring Methods
6
Masking
7
X86 Interrupts Pins
8
Programmable Interrupt Controller
9
Device Interrupt Mapping
10
Programmable Interrupt Request
11
APIC
12
CPUID
13
What happens when there is interrupt
14
How does hardware finds interrupt handler

Interrupt Handling in Linux kernel

1
Interrupt Handling in Linux kernel
2
Interrupt Statistics in Linux Kernel
3
Monitoring Interrupts using watch command
4
PCI Interrupts
5
Requesting Interrupt Handler
6
Linux Driver for keyboard interrupt
7
Linux Driver logging each typed character
8
Linux Driver for ethernet interrupt
9
Linux Driver for mouse interrupt
10
Keylogger driver
11
Adding sysfs support for keylogger driver

request_irq

1
Return value of interrupt handlers
2
Interrupt Flags
3
Linux Driver registering all irqs
4
Other Interrupt Flags
5
IRQF_NOBALANCING
6
SMP IRQ Affinity
7
What happens when we pass NULL as last argument in case of shared irq
8
Print irq and device identifier in irq handler

Enabling and Disabling Interrupts

1
Enable & Disable Interrupt
2
Why do we need to disable interrupts
3
Linux Kernel Module example disabling and enabling interrupts on current process
4
Saving interrupt state before disabling interrupts
5
Disabling a specific interrupt line
6
disable_irq_nosync
7
What happens when we call disable_irq twice and enable_irq once
8
What happens when we disable shared interrupt line
9
Find out whether interrupts on local processor are disabled
10
Interrupt Context
11
Macro to find out whether we are in interrupt context
12
Using in_interrupt to allocate memory
13
Adding a delay in interrupt handler
14
Printing call trace in interrupt handler
15
Can we use current macro inside interrupt handler
16
What happens when we call sleep in interrupt handler

Threaded IRQs

1
Introduction
2
Example of Top and bottom halves
3
Threaded IRQs
4
Example of Threaded IRQs
5
Kernel Module example printing context in threaded irqs
6
IRQF_ONESHOT
7
Printing call trace in threaded irqs
8
Printing PID and process name in threaded irqs
9
Are interrupts enabled in threaded irqs

Softirqs

1
Introduction
2
Statistics of softirqs
3
Softirqs Methods
4
Create a new softirq
5
Linux Kernel Driver Example of softirq
6
Find out the context of softirq handler
7
Find out whether interrupts are enabled or disabled in softirq handler
8
Value of current in softirq handler
9
Prints call trace in softirq handler
10
Checking processor id in interrupt and softirq handler
11
Adding a delay in softirq handler
12
Find out whether softirq is running in hard or soft irq context
13
Important points related to softirq
14
ksoftirqd
15
Example of ksoftirqd
16
Find out pending softirqs
17
When are pending softirqs executed
18
Macro to tell whether you are running in softirq or not
19
Disabling and Enabling softirqs
20
Are interrupts enabled when we call spinlock
21
Locking between user context and softirqs

Tasklets

1
Introduction
2
State and count field of tasklet
3
Tasklet API
4
Example of using tasklet
5
Scheduling tasklets
6
Example of scheduling tasklets static initialization
7
Example of scheduling tasklets dynamic initialization
8
Steps performed by tasklet_schedule
9
Steps performed by tasklet softirq handlers
10
How kernel avoids running same tasklet on multiple processors
11
Can i sleep in tasklet handler
12
Are interrupts enabled when tasklet runs
13
Find out the context of tasklet handler
14
Printing PID and process name in tasklet handler
You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!

Be the first to add a review.

Please, login to leave a review
ee80a42a8151313045f0ca1fc3161523
30-Day Money-Back Guarantee

Includes

4 hours on-demand video
Full lifetime access
Access on mobile and TV
Certificate of Completion