1

I don't understand how the preempt work on interrupt exit path.

the source code is under linux/v5.11.14/source/arch/arm/kernel/entry-armv.S

__irq_svc:
    svc_entry
    irq_handler

#ifdef CONFIG_PREEMPTION
    ldr r8, [tsk, #TI_PREEMPT]      @ get preempt count
    ldr r0, [tsk, #TI_FLAGS]        @ get flags
    teq r8, #0              @ if preempt count != 0
    movne   r0, #0              @ force flags to 0
    tst r0, #_TIF_NEED_RESCHED
    blne    svc_preempt
#endif

    svc_exit r5, irq = 1            @ return from exception
 UNWIND(.fnend      )
ENDPROC(__irq_svc)

after call svc_preempt, the scheduler will switch to another task. like this: (taskA interrupted by irq, then preempt from irq to taskB). irq preempt call path

my question is:

  1. when next schedule, it's direct switch back to taskA or back to svc_exit?
  2. if switch back to svc_exit, the context of svc_exit will be overwrite when another irq raise. if switch back to taskA, but we come from IRQ, when switch to taskB we didn't save context of taskA.

thanks.

jason
  • 36
  • 3

0 Answers0