[question] Can the execution of the atomtic operation instruction pair lwarx/stwcx be interrrupted by local HW interruptions?

Scott Wood scottwood at freescale.com
Tue Jan 7 09:05:39 EST 2014

On Mon, 2014-01-06 at 13:27 +0800, wyang wrote:
> On 01/06/2014 11:41 AM, Gavin Hu wrote:
> > Thanks your response.  :) 
> > But that means that these optimitive operations like atomic_add()
> > aren't optimitive actully in PPC architecture, right? Becuase they
> > can be interrupted by loacl HW interrupts. Theoretically, the ISR
> > also can access the atomic gloable variable.
> > 
> Nope, my understand is that if you wanna sync kernel primitive code
> with ISR, you have responsibility to disable local interrupts.
> atomic_add does not guarantee to handle such case.

atomic_add() and other atomics do handle that case.  Interrupts are not
disabled, but there's a stwcx. in the interrupt return code to make sure
the reservation gets cleared.


More information about the Linuxppc-dev mailing list