Manish
Manish

Reputation: 79

What will happen to the state of the tasklet when tasklet is running and hardware interrupt triggered?

What will happen to the state of the tasklet when tasklet is executing and hardware interrupt triggered in the middle of tasklet execution ?

Upvotes: 2

Views: 2138

Answers (3)

chinmoy ghosh
chinmoy ghosh

Reputation: 9

Check tasklet_schedule function.

It will save the state of the interrupt system and restore interrupts to their previous state and return after do_softirq operation.

Upvotes: 0

skaushal
skaushal

Reputation: 705

Tasklet are the bottom half. They run in softirq context and not in hardware interrupt context. So hardware interrupts are always enabled. When hardware interrupts is triggered while executing tasklets then it will interrupt the tasklet. Then top half is run on the respective IRQ stack and acknowledge the interrupt. This behavior is especially useful with interrupt handlers, where the hardware interrupt must be managed as quickly as possible, but most of the data management can be safely delayed to a later time. Actually, a tasklet, just like a kernel timer, is executed (in atomic mode) in the context of a soft interrupt, a kernel mechanism that executes asynchronous tasks with hardware interrupts enabled.

Upvotes: 3

Milind Dumbare
Milind Dumbare

Reputation: 3244

Tasklets run in interrupt context. So code in tasklets should not sleep (or be interrupted). If the tasklet is interruped by an interrupt, your system crashes. To prevent interrupts while running tasklet you have to prevent the interrupts by using spinlock_irq_save()

Upvotes: -1

Related Questions