atomic operations in user space

Liu Dave-r63238 DaveLiu at freescale.com
Wed Aug 30 12:55:39 EST 2006


> > [snip]
> > > >
> > > > Is this your reason we cannot do atomic operation in user space?
> > > >
> > > > How about the kernel space? You can image it.
> > > > The context switching as above also happen in kernel space,
> > > Why we can
> > > > do atomic operation in kernel space, not do in user space?
> > > >
> > >
> > > There are substantial different between kernel and user control 
> > > path.  First, interrupt can't be interrupted by user process.  
> > > Second, context switch can be explicitly controlled in 
> kernel, but 
> > > not in user space.
> > 
> > I agree this, but from the processor's view, the context 
> switch is the 
> > same to user space and kernel space. The exception control 
> flow only 
> > happen at exception interrupt.
> > What is different you point ?
> 
> Exception is special and tiny part of the kernel, which 
> should be programmed carefully not to break any thing.  
> Anyway, as you found, clear reservation in exception do solve 
> all the problems.

Can we do atomic operation in user space as kernel space?

> > > > You are assuming the context switching cause the 
> reservation broken.
> > > > but we can do atomic operation in kernel space.  The
> > > context switching
> > > > really is the execption of processor, If we can clear the wrong 
> > > > RESERVATION before exception return, I think we can solve this 
> > > > problem. We can dummy stwcx. before exception return or the
> > > processor
> > > > automaticly clear the reservation in exception.
> > >
> > > I assume stwcx is a costing instruction, and I don't see 
> such code 
> > > indeed.



More information about the Linuxppc-dev mailing list