atomic operations in user space

Li Yang-r58472 LeoLi at freescale.com
Wed Aug 30 12:52:08 EST 2006


> -----Original Message-----
> From: Liu Dave-r63238
> Sent: Wednesday, August 30, 2006 10:43 AM
> To: Li Yang-r58472; 'linuxppc-embedded at ozlabs.org';
'linuxppc-dev at ozlabs.org'
> Subject: RE: RE: atomic operations in user space
> 
> [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.

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.

> 
> What is different you point ?
> 
> > > 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-embedded mailing list