In linux, how to make sure the code sequence is executed without interruption

I have a routine that switches high / low GPIO output and has a delay between highs and lows (using udelay), and then selectively displays the GPIO status for a period of time. I need to make sure that this part of the code is executed without prior notice by the scheduler or any possible interruptions. I run the code on a dual-core ARM system, so it should be SMP. Is it Spin_Lock_IrqSave()safe enough for this purpose? I got the feeling that my code was still somehow interrupted, but so far no evidence.

Many thanks.

+5
source share
1 answer

If you want to disable pre-use, use preempt_disable()and preempt_enable(). If you want to disable interrupts, use local_irq_disable()andlocal_irq_enable()

spin_lock_irqsaveusually perform both of these actions, although some real-time improvements sometimes allow you to use lock lists, so it’s always better to say what you mean.

+4
source

All Articles