Interrupt Handling and Bottom Halves

  • Upload
    avadcs

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

  • 7/29/2019 Interrupt Handling and Bottom Halves

    1/2

    Interrupt Handling - Bottom Halves

    1. What is a BH?a. Bottom half (BH) is interrupt handler to handle the deferred portion of interrupt

    handling It is not currently supported in linux since version 2.5

    2. What are taskques?a. Taskques are interrupt handler that are introduced to replace BH. Currently they are

    not supported in Linux since version 2.5

    3. What is a softirq?a. Softirq is bottom half interrupt handler. It is supported since linux 2.3

    i. Softirqs are declared in a 32 entry array static struct softirq_action softirw_vec [32]

    ii. There are only 32 possible softirqs but only 6 of them are currently defined.Softirq/tasklet Priority Softirq description

    Hi_SOFTIRQ 0 High priority tasklets

    TIMER_SOFTIRQ 1 Timer bottom half

    NET_TX_SOFTIRQ 2 Send Network packets

    NET_RX_SOFTIRQ 3 Receive Network packets

    SCSI_SOFTIRQ 4 SCSI bottom half

    TASKLET_ SOFTIRQ 5 Tasklets

    4. Softirqs are statically allocated at compile time via enum in interrupt.h5. Creating a new softirq needs adding corresponding entry in enum in stdio.h6. Softirq never preempt another softirq. Even the same softirq can run concurrently run on

    another processor.

    7. Softirq can only be preempted by interrupt handler.8. Softirq handlers are Interrupt enabled and cannot sleep.9. A softirq has to be first raised before executed. This is called raising softirq.10.When softirqs are run?

    a. Pending softirqs are run in following situations.i. After processing the hardware interrupt

    ii. By ksoftirqd kernel threadiii. By code that explicitly checks and executes pending softirqs, such as

    networking subsystem

    11.Where softirqs are used?a. Softirqs are only used for highly time critical, high frequency and highly threaded

    uses.

    12.What is a tasklet?a. Tasklet are implemented on top of softirqs. They are softirqs.

    i. They are of two types Hi_SOFTIRQ

  • 7/29/2019 Interrupt Handling and Bottom Halves

    2/2

    TASKLET_ SOFTIRQ13.Tasklets are dynamically created.14.How tasklets are scheduled?

    a. Tasklets are scheduled via tasklet_schedule ()i. Scheduled tasklets are stored in two per processor linked list of

    tasklet_struct.

    tasklist_vec for regular tasklets tasklet_hi_vec for high priority tasklets.

    15.What is a workque?a. Work Queues defer work into kernel thread. It always runs in process context.

    16.Work Queues are schedulable and can sleep.17.What is the difference between softirq and tasklet and workque?

    Property Softirq Tasklet Work queue

    Creation Statically created Dynamically created

    Preemptible By interrupt

    handler

    preemptible preemptible

    sleeping It cannot sleep Can sleep Can sleep

    Context Kernel context Kernel context Process context

    Concurrency of

    similar threads

    Possible Not possible Possible

    18. If data is shared between two tasklets then data must be protected by a spin lock.19.Softirqs are capable of running simultaneously, therefore if data is shared between two

    softirqs then it needs to be protected using a spin lock.20.List the bottom half control methods?

    a. Void local_bh_disable () disables softirqs and tasklets processing on the localprocessor

    b. Void local_bh_enable () enables softirqs and tasklets processing on the localprocessor

    21.What are tasklet_vec and tasklet_hi_vec?a. tasklist_vec is array of schedulable tasklets for regular taskletsb. tasklet_hi_vec is array of schedulable tasklets for high priority tasklets.

    22.Where are softirqs defined in kernel data structure?a. Softirqs are defined in enum of interrupt.h

    23.What are worker threads?a. Work Queue subsystem is an interface for creating kernel threads to handle work

    that is queued from elsewhere. These kernel threads are called worker threads.

    24.What is the relationship between work, workques and worker threads?