Can an interrupt handler be preempted by the same interrupt handler?

后端 未结 5 1996
小蘑菇
小蘑菇 2020-12-15 13:06

Does the CPU disable all interrupts on local CPU before calling the interrupt handler? Or does it only disable that particular interrupt line, which is being served?

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-15 13:26

    We want ISR to be atomic and no one should be able to preempt the ISR.

    Therefore, An ISR disables the local interrupts ( i.e. the interrupt on the current processor) and once the ISR calls ret_from_intr() function ( i.e. we have finished the ISR) , interrupts are again enabled on the current processor.

    If an interrupt occurs, it will now be served by the other processor ( in SMP system) and ISR related to that interrupt will start running.

    In SMP system , We also need to include the proper synchronization mechanism ( spin lock) in an ISR.

提交回复
热议问题